Labsco
MCP SERVER

OPNSense MCP Server

by vespo92

Run an OPNsense firewall from a conversation — rules, VLANs, NAT, HAProxy, DNS blocklists — over the API, with SSH for the things the API cannot reach.

Network, Endpoint & Fleet ManagementVerified
Summary
It reaches the parts of OPNsense the API leaves out, which is where the hard problems are.

Outbound NAT, DMZ routing and packet-filter inspection are exactly the things an API-only integration cannot touch, and they are the things that break inter-VLAN traffic; here they run over SSH alongside the API tools, so a diagnosis and its fix happen in one session. Two things to weigh before pointing it at a live firewall: SSH access means shell execution on the box, so the credential you give it is as powerful as the account behind it, and the plan-then-apply and macro-recording paths are the safer way to make a multi-step change than issuing the calls one at a time and hoping.

What it is

A wide operations surface for an OPNsense firewall, working two ways: the OPNsense API for most configuration, and SSH into the box for the parts that need direct XML or shell access, such as outbound NAT and routing repair.

What you get
  • Firewall rules created, listed, read, updated, toggled and deleted, with find_firewall_rules for locating one and create_firewall_preset for common shapes
  • VLANs created, listed, read, updated and deleted, and interfaces listed, read and reconfigured — including inter-VLAN routing and DMZ setup
  • NAT handled through its own family: port forwards and outbound rules created, listed and deleted, nat_get_mode and nat_set_mode switching between automatic, hybrid, manual and disabled, and nat_analyze_config plus nat_apply_changes around them
  • Routing diagnostics and repair — routing_diagnostics, routing_create_intervlan_rules, routing_fix_dmz and routing_fix_all
  • Network visibility: list_dhcp_leases, list_arp_entries with lookups by IP, MAC, hostname or interface, get_arp_stats, and device lookups by name, MAC, VLAN or interface, including get_guest_devices
  • DNS blocklisting: block_domain and block_multiple_domains, unblock_domain, list and search the blocklist, toggle single entries, and subscribe to blocklist categories with add_dnsbl_subscription and apply_blocklist_category
  • HAProxy managed in full — frontends, backends, servers, ACLs, actions and certificates created, updated and deleted, with haproxy_backend_health, haproxy_stats and haproxy_service_control
  • ACME certificates signed, renewed, revoked and updated, with its own actions and settings
  • Monit monitoring: services, tests and alerts added, updated and deleted, plus monit_status
  • SSH and CLI execution for what the API will not do — ssh_execute, ssh_batch_execute, ssh_show_routing, ssh_show_pf_rules, ssh_system_status, ssh_reload_firewall and targeted fixes such as ssh_fix_dmz_routing
  • Configuration backups created, listed and restored, with ssh_backup_config and ssh_restore_config as the shell-side equivalent
  • Macros: start and stop recording a sequence of calls, replay it, export or import it, analyse it, and turn a recorded macro into a tool of its own
  • An infrastructure-as-code path — iac_list_resource_types, iac_plan_deployment, iac_apply_deployment and iac_destroy_deployment — so a change can be planned before it is applied
  • test_connection and configure for checking and setting up the connection itself
Requirements

An OPNsense firewall — v24.7 or later recommended — and API credentials: OPNSENSE_HOST, OPNSENSE_API_KEY and OPNSENSE_API_SECRET, with OPNSENSE_VERIFY_SSL for self-signed certificates. Node.js 18+ or Bun 1.0+, installed as npm install -g opnsense-mcp-server. The SSH and CLI tools need separate access — OPNSENSE_SSH_HOST and OPNSENSE_SSH_USERNAME with either OPNSENSE_SSH_PASSWORD or OPNSENSE_SSH_KEY_PATH — and NAT management in particular runs through SSH rather than the API. MIT.

Setup effort

One command plus a key — npm install -g opnsense-mcp-server, then supply credentials