Skip to main content
Glama
coreyhines/opnsense-mcp

coreyhines/opnsense-mcp

by coreyhines

opnsense-mcp

OPNsense MCP Server

opnsense-mcp MCP server opnsense-mcp MCP server

MCP server for OPNsense firewall operations (ARP, DHCP, logs, rules, interfaces, system status, packet capture).

Use one of two deployment modes:

  • STDIO (local): best for Cursor/Claude Code/Continue running the server process directly.

  • Streamable HTTP (centralized): best for a shared, long-lived service over HTTPS, at /mcp.

Demo

Query your firewall with Claude Code CLI. Live example with real network data:

opnsense-mcp demo

Related MCP server: OPNSense MCP Server

Why This Exists

Built this because SSH'ing into the firewall to check logs or grab ARP data got old fast. Now you can ask Claude:

  • "What's happening on the network right now?"

  • "Show me the latest firewall blocks"

  • "Tell me about that host"

  • "Capture packets from the suspicious traffic"

Claude handles the firewall query via MCP and gives you analysis + context in one shot. Works on homelab or business deployments equally well.

Quick Start

1) Local setup (required for both modes)

uv venv
source .venv/bin/activate
uv pip install -r requirements.txt
cp examples/.env.example ~/.env

Edit ~/.env:

OPNSENSE_API_KEY=your_api_key
OPNSENSE_API_SECRET=your_api_secret
OPNSENSE_FIREWALL_HOST=your.firewall.host
# HTTP transports only; stdio ignores it. Generate with: openssl rand -hex 32
MCP_SECRET_KEY=

2) Choose mode

Mode A: STDIO (local IDE/client)

Configure your MCP client to launch mcp_start.sh:

{
  "mcpServers": {
    "opnsense-mcp": {
      "command": "/bin/bash",
      "args": ["/absolute/path/to/opnsense-mcp/mcp_start.sh"],
      "cwd": "/absolute/path/to/opnsense-mcp"
    }
  }
}

See full guide: docs/GETTING_STARTED.md.

Mode B: streamable HTTP (centralized service)

Run the Linux installer (Podman + quadlet + Caddy TLS):

sudo bash deploy/install.sh

Clients connect to:

https://<your-hostname>/mcp

The deployed container serves streamable HTTP only. There is no /sse endpoint and no /health route; both answer 404.

Every request must send Authorization: Bearer <MCP_SECRET_KEY>. The server refuses to start on an HTTP transport when the key is blank or a placeholder.

See deployment docs:

What Is Available

Primary tools:

  • Discovery: arp, dhcp, lldp

  • Monitoring: system, get_logs, packet_capture

  • Firewall rules: fw_rules, mkfw_rule, set_fw_rule, toggle_fw_rule, rmfw_rule

  • Interfaces: interface_list

Full reference: docs/REFERENCE/FUNCTION_REFERENCE.md

What's New (June 2026)

Five PRs landed recently. See docs/FEATURES_UPDATE.md for full details and usage examples.

  • Streamable HTTP transport — native FastMCP server supports stdio and streamable-http (MCP spec 2025-03-26). deploy/install.sh deploys streamable HTTP at /mcp.

  • DHCP client_id (DUID) support — mk_dhcp_host and move_dhcp_host accept an optional DUID for stateful DHCPv6 matching.

  • Semver image tags — main builds are tagged as a prerelease of the next patch after the pyproject.toml version (1.0.1-dev.a1b2c3d after 1.0.0) or release tags (1.0.0).

  • Container registry — pinned tags only; :latest is rejected. Set OPNSENSE_MCP_IMAGE_REPO, or build locally with --build-local.

  • install.sh readonly fix — Bash readonly clash between install.sh and lib.sh resolved.

Use Cases

  • Homelab network troubleshooting — Query firewall logs from terminal, get Claude's take on what's happening

  • Security operations — Automate incident triage: "Analyze the last hour of blocks"

  • Infrastructure automation — Write MCP-aware scripts that query firewall state dynamically

  • DevOps troubleshooting — Quick VLAN/interface status checks without SSH sessions

Feedback

First 10 users get feedback incorporated into the tool. If you find bugs or have ideas, file an issue or discussion.

Where to look first when reviewing

scripts/risk_map.py ranks source files by defect likelihood from git history — churn times fix density — so a review reads the risky files first and can stop early. It finds no bugs; it finds where they concentrate.

python3 scripts/risk_map.py --top 15

CI runs it on every pull request alongside a complexity report (radon) and a security-pattern pass (bandit) in the advisory Insights workflow, which never blocks a merge. Thresholds that gate the build come later, once the numbers are trusted.

Documentation Map

License

This project is released under the MIT License.

Available Tools

14 tools
aliasB

Manage firewall aliases, the named address and port groups rules reference. Call action='help' for each action's fields and rules.

Inputs: action (required), name, type, uuid, +6 more.

arpC

Show ARP/NDP table

Inputs: ip, mac, search.

bgpC

FRR BGP: peering state and neighbours. FRR ships disabled, so an empty result usually means it has not been turned on yet. Call action='help' for each action's fields and rules.

Inputs: action (required), bfd, uuid, apply, +11 more.

config_backupC

Configuration backups, revision history and boot environment snapshots. Call action='help' for each action's fields and rules.

Inputs: action (required), limit, rev_a, rev_b, +3 more.

dhcpB

DHCP: leases, static reservations, ranges, options and per-subnet DNS. Call action='help' for each action's fields and rules.

Inputs: action (required), ip, mac, tag, +27 more.

diagnosticsA

Read-only views of what the firewall currently sees: neighbours, interfaces, state table, logs, captures, and reachability. Call action='help' for each action's fields and rules.

Inputs: action (required), ip, raw, count, +27 more.

dns_overrideA

Manage Unbound host overrides. Call action='help' for each action's fields and rules.

Inputs: action (required), mode, uuid, apply, +6 more.

fw_ruleC

Firewall filter rules, and the interface groups a rule can target so one rule covers several networks. Call action='help' for each action's fields and rules.

Inputs: action (required), log, uuid, apply, +20 more.

interface_deviceC

Create the devices interfaces are built on: 802.1Q VLANs and loopbacks. Call action='help' for each action's fields and rules.

Inputs: action (required), pcp, tag, uuid, +11 more.

ipv6C

IPv6: NPTv6 prefix translation, virtual IPs, router advertisements, and planning or applying a ULA conversion. Call action='help' for each action's fields and rules.

Inputs: action (required), mode, uuid, vhid, +18 more.

nat_outboundC

Outbound source NAT rules and how they are generated. Call action='help' for each action's fields and rules.

Inputs: action (required), mode, uuid, apply, +9 more.

routingA

Static routes and gateways. Note routes use enabled and gateways use disabled, so a toggle means the opposite thing on each. Call action='help' for each action's fields and rules.

Inputs: action (required), name, uuid, apply, +9 more.

shaperB

Traffic shaper: pipes, queues, rules, and applying or auditing them. Call action='help' for each action's fields and rules.

Inputs: action (required), uuid, apply, proto, +27 more.

systemA

Show system status information

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 14 tools

    Disambiguation4/5

    Each tool generally maps to a distinct OPNsense module, so firewall rules, NAT, aliases, routing, DHCP, and other concerns are clearly separated. Minor overlap exists among system, diagnostics, and arp for read-only status information, and ipv6 is broad, but the descriptions provide enough boundaries.

    Naming Consistency4/5

    Tool names follow a consistent lowercase domain-module convention, with snake_case for compound names like config_backup, dns_override, and nat_outbound. They do not use a verb-noun pattern, but the naming is predictable and uniform across the set.

    Tool Count5/5

    Fourteen tools is well within the ideal range, and each tool represents a coherent functional area of an OPNsense firewall. There are no redundant or filler tools that make the surface feel bloated.

    Completeness3/5

    The set covers core firewall workflows: filtering, NAT, aliases, routing, DHCP, DNS overrides, traffic shaping, diagnostics, and backups. However, major OPNsense areas such as VPN configuration, certificate management, interface assignment, and general Unbound settings are absent, which could create dead ends for common tasks.

    Maintenance

    ActivityActive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol (MCP) server implementation for managing OPNsense firewalls. This server allows Claude and other MCP-compatible clients to interact with all features exposed by the OPNsense API.
      1
      AGPL 3.0
    • A
      license
      C
      quality
      B
      maintenance
      A server that enables managing OPNSense firewalls through natural language interactions with Claude Desktop, supporting VLAN management, firewall rules configuration, and network interface queries.
      64
      102 npm
      97
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A modular MCP server that provides access to over 2,000 OPNsense firewall management methods through 88 specialized tools. It enables AI assistants to securely manage firewall rules, network interfaces, and system diagnostics using a type-safe TypeScript interface.
      126 npm
      95
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      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.
      100
      54 npm
      2
      AGPL 3.0