MCP Hub
Back to servers

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.

glama
Forks
1
Updated
Mar 15, 2026

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

VariableRequiredDefaultDescription
OPNSENSE_URLYesOPNsense base URL (e.g. https://192.168.1.1)
OPNSENSE_API_KEYYesAPI key for authentication
OPNSENSE_API_SECRETYesAPI secret for authentication
OPNSENSE_VERIFY_SSLNotrueSet to false for self-signed certificates
OPNSENSE_TIMEOUTNo30000Request timeout in milliseconds

Available Tools (62)

DNS/Unbound (12 tools)

ToolDescription
opnsense_dns_list_overridesList host overrides (A/AAAA/CNAME)
opnsense_dns_add_overrideAdd a host override record
opnsense_dns_delete_overrideDelete a host override by UUID
opnsense_dns_list_forwardsList DNS-over-TLS forwarding servers
opnsense_dns_add_forwardAdd a DNS forwarding server
opnsense_dns_delete_forwardDelete a DNS forward by UUID
opnsense_dns_list_blocklistList domain overrides (blocked domains)
opnsense_dns_block_domainBlock a domain
opnsense_dns_unblock_domainUnblock a domain by UUID
opnsense_dns_flush_cacheFlush DNS cache and DNSBL data
opnsense_dns_diagnosticsDump DNS cache for diagnostics
opnsense_dns_applyApply DNS changes (reconfigure Unbound)

Firewall (8 tools)

ToolDescription
opnsense_fw_list_rulesList all firewall filter rules
opnsense_fw_add_ruleCreate a firewall rule
opnsense_fw_update_ruleUpdate a firewall rule by UUID
opnsense_fw_delete_ruleDelete a firewall rule by UUID
opnsense_fw_toggle_ruleEnable/disable a firewall rule
opnsense_fw_list_aliasesList firewall aliases (host, network, port, URL)
opnsense_fw_manage_aliasCreate/update/delete aliases
opnsense_fw_applyApply pending firewall changes

Diagnostics (8 tools)

ToolDescription
opnsense_diag_arp_tableShow ARP table (IP-to-MAC mappings)
opnsense_diag_routesShow routing table
opnsense_diag_pingPing a host from OPNsense
opnsense_diag_tracerouteTraceroute to a destination
opnsense_diag_dns_lookupPerform DNS lookup from OPNsense
opnsense_diag_fw_statesList active firewall connection states
opnsense_diag_fw_logsRetrieve recent firewall log entries
opnsense_diag_system_infoGet system status (CPU, memory, uptime, disk)

Interfaces (3 tools, read-only)

ToolDescription
opnsense_if_listList all network interfaces with device mappings
opnsense_if_getGet detailed interface configuration
opnsense_if_statsGet traffic statistics for all interfaces

DHCP (5 tools)

ToolDescription
opnsense_dhcp_list_leasesList all current DHCPv4 leases
opnsense_dhcp_find_leaseSearch leases by IP, MAC, or hostname
opnsense_dhcp_list_staticList static DHCP mappings (reservations)
opnsense_dhcp_add_staticAdd a static DHCP mapping
opnsense_dhcp_delete_staticDelete a static mapping by UUID

System (7 tools)

ToolDescription
opnsense_sys_infoGet system status (hostname, versions, CPU, memory, uptime, disk)
opnsense_sys_backup_listList all configuration backups with timestamps and descriptions
opnsense_sys_backup_downloadDownload configuration backup as XML (current or specific)
opnsense_sys_backup_revertRevert to a previous configuration backup (destructive)
opnsense_sys_list_certsList all certificates in the trust store
opnsense_svc_listList all services and their running status
opnsense_svc_controlStart, stop, or restart a service by name

ACME/Let's Encrypt (14 tools)

ToolDescription
opnsense_acme_list_accountsList ACME accounts (Let's Encrypt, ZeroSSL, etc.)
opnsense_acme_add_accountRegister a new ACME account with a CA
opnsense_acme_delete_accountDelete an ACME account by UUID
opnsense_acme_register_accountTrigger registration of an ACME account with its CA
opnsense_acme_list_challengesList all challenge/validation methods
opnsense_acme_add_challengeAdd a DNS-01 challenge (Cloudflare, AWS, etc.)
opnsense_acme_update_challengeUpdate an existing challenge configuration
opnsense_acme_delete_challengeDelete a challenge by UUID
opnsense_acme_list_certsList all ACME certificates and their status
opnsense_acme_create_certCreate a new certificate request
opnsense_acme_delete_certDelete an ACME certificate by UUID
opnsense_acme_renew_certTrigger immediate certificate renewal
opnsense_acme_settingsGet or update ACME service settings
opnsense_acme_applyApply pending ACME configuration changes

Firmware/Plugins (5 tools)

ToolDescription
opnsense_firmware_infoGet firmware version, architecture, update status
opnsense_firmware_statusCheck for available firmware upgrades
opnsense_firmware_list_pluginsList all available and installed plugins
opnsense_firmware_installInstall an OPNsense plugin package
opnsense_firmware_removeRemove a plugin package (requires confirmation)

Skills

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

SkillSlash CommandDescription
opnsense-service-health/opn-healthHealth dashboard — system status, services, firmware, interfaces
opnsense-acme-renew/opn-renew-certACME certificate status check and renewal
opnsense-backup/opn-backupConfiguration backup management — list, download, revert
opnsense-live-test/opn-testLive integration test — read + safe writes with cleanup
opnsense-diagnosticsNetwork connectivity diagnostics — ping, traceroute, DNS, ARP
opnsense-dns-managementDNS record management — add, delete, apply, verify resolution
opnsense-firewall-auditFirewall 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 assignmentssl-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.

Reviews

No reviews yet

Sign in to write a review