mcp-opnsense
Provides tools for managing OPNsense firewall including system status, services, DHCP leases, DNS overrides, firewall rules, and NAT port forwards via the OPNsense REST API.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-opnsenseshow me the current firewall rules"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-opnsense
MCP server for OPNsense firewall management. Exposes 16 tools for system status, services, DHCP, DNS overrides, firewall rules, and NAT port forwards via the OPNsense REST API.
Quick Start
With uvx (recommended):
OPNSENSE_HOST=https://192.168.1.1 \
OPNSENSE_API_KEY=yourkey \
OPNSENSE_API_SECRET=yoursecret \
uvx mcp-opnsenseWith Docker:
docker run -i \
-e OPNSENSE_HOST=https://10.0.0.1 \
-e OPNSENSE_API_KEY=yourkey \
-e OPNSENSE_API_SECRET=yoursecret \
ghcr.io/aaronckj/mcp-opnsense:latestAdd to Claude Code:
claude mcp add opnsense -s user \
-e OPNSENSE_HOST=https://10.0.0.1 \
-e OPNSENSE_API_KEY=yourkey \
-- uvx mcp-opnsenseThen set OPNSENSE_API_SECRET in your Claude Code MCP settings.
Related MCP server: OPNsense MCP Server
Creating API Credentials
In OPNsense: System → User Manager → Users → edit a user → API keys → Add key. Copy the key and secret (the secret is only shown once).
Configuration
Variable | Required | Default | Description |
| Yes | — | API key from OPNsense user manager |
| Yes | — | API secret from OPNsense user manager |
| No |
| OPNsense host URL |
| No |
| HTTP timeout in seconds |
| No |
| Set to |
Tools
Tool | Description |
| CPU, memory, uptime, firmware version |
| WAN gateway status and packet loss |
| All interfaces with IPs and link state |
| All services and running status |
| Restart a named service |
| Apply pending firewall changes |
| Active and static DHCP leases |
| Add a static DHCP mapping |
| Unbound host overrides |
| Add a host override (auto-reconfigures) |
| Remove a host override by UUID (auto-reconfigures) |
| All firewall filter rules |
| Add a rule (auto-applies) |
| Delete a rule by UUID (auto-applies) |
| NAT port forward rules |
| Add a port forward (auto-applies) |
Development
git clone https://github.com/aaronckj/mcp-opnsense
cd mcp-opnsense
uv sync --extra dev
uv run pytest -vThis server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for Hostinger API
MCP server for Pentest-Tools.com: run scans, manage findings and reports via your preffered LLM.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA 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.1AGPL 3.0
- AlicenseAqualityBmaintenanceA secure MCP server for managing OPNsense firewalls through AI assistants. Provides 81 tools across system, firewall, network, DNS, DHCP, VPN, HAProxy, services, diagnostics, and security domains.81109 PyPI21MIT
- AlicenseAqualityCmaintenanceEnables interaction with OPNsense firewalls through MCP tools for managing firewall rules, interfaces, DHCP leases, and system monitoring.26MIT
- FlicenseNot gradedqualityBmaintenanceA LAN-hosted MCP server for safely querying and managing OPNsense Dnsmasq DHCP state through the official OPNsense API, with tools to view and modify DHCP leases, static reservations, settings, and more.-