mcp-opnsense

mcp-opnsense

Slim OPNsense MCP Server — 62 tools for managing firewall infrastructure via the OPNsense REST API. Covers DNS/Unbound, Firewall rules, Diagnostics, Interfaces, DHCP (ISC + Kea), System/Backups, ACME/Let's Encrypt, and Firmware. No SSH, no shell, API-only with 3 runtime dependencies. AGPL-3.0 + Commercial dual-licensed.

Category
访问服务器

README

mcp-opnsense

GitHub release License: AGPL-3.0 CalVer Node.js MCP Tools TypeScript mcp-opnsense MCP server

Slim OPNsense MCP Server for managing firewall infrastructure via the OPNsense REST API.

No SSH. No shell execution. API-only. 3 runtime dependencies.

Table of Contents

Features

62 tools across 8 domains:

  • DNS/Unbound (12) — Host overrides, forwards, blocklist, cache management
  • Firewall (8) — Rules, aliases, NAT, apply changes
  • Diagnostics (8) — ARP, routes, ping, traceroute, DNS lookup, firewall states/logs
  • Interfaces (3) — List, configuration, statistics (read-only)
  • DHCP (5) — Leases, static mappings (ISC DHCPv4 + Kea dual support)
  • System (7) — Info, backup (list/download/revert), certificate listing, service control
  • ACME/Let's Encrypt (14) — Accounts, challenges, certificates, renewal, settings
  • Firmware/Plugins (5) — Version info, plugin management

Quick Start

npm install
cp .env.example .env   # Edit with your OPNsense API credentials
npm run build
node dist/index.js     # stdio transport for MCP

Claude Code Integration

Add to .mcp.json in your project root:

{
  "mcpServers": {
    "opnsense": {
      "command": "node",
      "args": ["/path/to/mcp-opnsense/dist/index.js"],
      "env": {
        "OPNSENSE_URL": "https://your-opnsense.example.com",
        "OPNSENSE_API_KEY": "your-api-key",
        "OPNSENSE_API_SECRET": "your-api-secret",
        "OPNSENSE_VERIFY_SSL": "true"
      }
    }
  }
}

Environment Variables

Variable Required Default Description
OPNSENSE_URL Yes — OPNsense base URL (e.g. https://192.168.1.1)
OPNSENSE_API_KEY Yes — API key for authentication
OPNSENSE_API_SECRET Yes — API secret for authentication
OPNSENSE_VERIFY_SSL No true Set to false for self-signed certificates
OPNSENSE_TIMEOUT No 30000 Request timeout in milliseconds

Available Tools (62)

DNS/Unbound (12 tools)

Tool Description
opnsense_dns_list_overrides List host overrides (A/AAAA/CNAME)
opnsense_dns_add_override Add a host override record
opnsense_dns_delete_override Delete a host override by UUID
opnsense_dns_list_forwards List DNS-over-TLS forwarding servers
opnsense_dns_add_forward Add a DNS forwarding server
opnsense_dns_delete_forward Delete a DNS forward by UUID
opnsense_dns_list_blocklist List domain overrides (blocked domains)
opnsense_dns_block_domain Block a domain
opnsense_dns_unblock_domain Unblock a domain by UUID
opnsense_dns_flush_cache Flush DNS cache and DNSBL data
opnsense_dns_diagnostics Dump DNS cache for diagnostics
opnsense_dns_apply Apply DNS changes (reconfigure Unbound)

Firewall (8 tools)

Tool Description
opnsense_fw_list_rules List all firewall filter rules
opnsense_fw_add_rule Create a firewall rule
opnsense_fw_update_rule Update a firewall rule by UUID
opnsense_fw_delete_rule Delete a firewall rule by UUID
opnsense_fw_toggle_rule Enable/disable a firewall rule
opnsense_fw_list_aliases List firewall aliases (host, network, port, URL)
opnsense_fw_manage_alias Create/update/delete aliases
opnsense_fw_apply Apply pending firewall changes

Diagnostics (8 tools)

Tool Description
opnsense_diag_arp_table Show ARP table (IP-to-MAC mappings)
opnsense_diag_routes Show routing table
opnsense_diag_ping Ping a host from OPNsense
opnsense_diag_traceroute Traceroute to a destination
opnsense_diag_dns_lookup Perform DNS lookup from OPNsense
opnsense_diag_fw_states List active firewall connection states
opnsense_diag_fw_logs Retrieve recent firewall log entries
opnsense_diag_system_info Get system status (CPU, memory, uptime, disk)

Interfaces (3 tools, read-only)

Tool Description
opnsense_if_list List all network interfaces with device mappings
opnsense_if_get Get detailed interface configuration
opnsense_if_stats Get traffic statistics for all interfaces

DHCP (5 tools)

Tool Description
opnsense_dhcp_list_leases List all current DHCPv4 leases
opnsense_dhcp_find_lease Search leases by IP, MAC, or hostname
opnsense_dhcp_list_static List static DHCP mappings (reservations)
opnsense_dhcp_add_static Add a static DHCP mapping
opnsense_dhcp_delete_static Delete a static mapping by UUID

System (7 tools)

Tool Description
opnsense_sys_info Get system status (hostname, versions, CPU, memory, uptime, disk)
opnsense_sys_backup_list List all configuration backups with timestamps and descriptions
opnsense_sys_backup_download Download configuration backup as XML (current or specific)
opnsense_sys_backup_revert Revert to a previous configuration backup (destructive)
opnsense_sys_list_certs List all certificates in the trust store
opnsense_svc_list List all services and their running status
opnsense_svc_control Start, stop, or restart a service by name

ACME/Let's Encrypt (14 tools)

Tool Description
opnsense_acme_list_accounts List ACME accounts (Let's Encrypt, ZeroSSL, etc.)
opnsense_acme_add_account Register a new ACME account with a CA
opnsense_acme_delete_account Delete an ACME account by UUID
opnsense_acme_register_account Trigger registration of an ACME account with its CA
opnsense_acme_list_challenges List all challenge/validation methods
opnsense_acme_add_challenge Add a DNS-01 challenge (Cloudflare, AWS, etc.)
opnsense_acme_update_challenge Update an existing challenge configuration
opnsense_acme_delete_challenge Delete a challenge by UUID
opnsense_acme_list_certs List all ACME certificates and their status
opnsense_acme_create_cert Create a new certificate request
opnsense_acme_delete_cert Delete an ACME certificate by UUID
opnsense_acme_renew_cert Trigger immediate certificate renewal
opnsense_acme_settings Get or update ACME service settings
opnsense_acme_apply Apply pending ACME configuration changes

Firmware/Plugins (5 tools)

Tool Description
opnsense_firmware_info Get firmware version, architecture, update status
opnsense_firmware_status Check for available firmware upgrades
opnsense_firmware_list_plugins List all available and installed plugins
opnsense_firmware_install Install an OPNsense plugin package
opnsense_firmware_remove Remove a plugin package (requires confirmation)

Skills

Claude Code skills compose MCP tools into higher-level workflows. See .claude/skills/README.md for detailed documentation.

Skill Slash Command Description
opnsense-service-health /opn-health Health dashboard — system status, services, firmware, interfaces
opnsense-acme-renew /opn-renew-cert ACME certificate status check and renewal
opnsense-backup /opn-backup Configuration backup management — list, download, revert
opnsense-live-test /opn-test Live integration test — read + safe writes with cleanup
opnsense-diagnostics — Network connectivity diagnostics — ping, traceroute, DNS, ARP
opnsense-dns-management — DNS record management — add, delete, apply, verify resolution
opnsense-firewall-audit — Firewall security audit — permissive rules, disabled rules, patterns

Known Limitations

Some OPNsense operations are not available via the REST API and require manual GUI access:

  • Web GUI SSL certificate assignment — ssl-certref can only be changed via System > Settings > Administration in the web UI. See docs/manual-operations.md.
  • Configuration upload/import — OPNsense has no API to upload configuration XML files. Use opnsense_sys_backup_revert to revert to local backups, or upload via the web GUI.
  • User/group management — Not exposed via REST API.
  • VPN configuration — Limited API coverage; most settings require the web UI.

Security

  • Transport: stdio only — no HTTP endpoints exposed
  • Authentication: OPNsense API key/secret via environment variables
  • SSL: Enabled by default, configurable for self-signed certs
  • No SSH: All operations use the OPNsense REST API exclusively
  • Input validation: Strict Zod schemas for all tool parameters
  • Destructive operations: Require explicit confirm: true parameter
  • See SECURITY.md for the full security policy

Development

npm test          # Run unit tests (vitest)
npm run build     # Compile TypeScript
npx tsc --noEmit  # Type check only

See CONTRIBUTING.md for contribution guidelines.

License

This project is dual-licensed:

If you use mcp-opnsense in a proprietary product or SaaS offering, a commercial license is required. Support development by sponsoring us on GitHub.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选