opn-mcp
Provides tools for interacting with the OPNsense firewall API, covering all core and plugin endpoints (searchable/describable index of ~2469 endpoints and 169 models). Supports generic API calls, model CRUD operations on any controller (search, get, add, set, delete, toggle, then apply), reading and writing a whole settings model, and curated tools for a system overview, service management, neighbor discovery, firewall log inspection, and ping. Writes are disabled unless explicitly enabled.
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., "@opn-mcp give me an overview of my firewall and its service status"
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.
opn-mcp
MCP server for OPNsense. It covers the whole API of core and the plugins, using an index generated from the OPNsense sources, and checks request bodies against the model XML.
Index:
src/opn_mcp/data/opnsense-api.json.gzcomes fromopnsense/core+opnsense/pluginsat tag 26.7.4: 2469 endpoints (986 core, 69 plugins) and 169 models. Methods are read from the controller code and inheritance, bodies from the CRUD helpers plus the model XML. Regenerate it after an upgrade:git clone --depth 1 --branch <ver> https://github.com/opnsense/core opn-src/core-<ver> git clone --depth 1 --filter=blob:none --sparse --branch <ver> https://github.com/opnsense/plugins opn-src/plugins-<ver> (cd opn-src/plugins-<ver> && git sparse-checkout set --no-cone '/*/*/src/opnsense/mvc/' '/*/*/Makefile') python scripts/gen_endpoints.py opn-src/core-<ver> opn-src/plugins-<ver> <ver>Generic:
opn_api_search,opn_api_describe,opn_api. Plugin endpoints are refused when the plugin is not installed.Model CRUD:
opn_items(search/get/add/set/del/toggle for any controller, then apply) andopn_settings(get/set a whole model).Curated:
opn_overview,opn_service,opn_neighbors,opn_firewall_log,opn_ping.
Install in your agent
It works with any MCP client that can start a stdio command. It needs uv. uvx fetches the pinned release, so no clone or virtualenv is needed. Pick your agent below.
Variable | Meaning | Example |
| Firewall API URL |
|
| API key |
|
| API secret |
|
Optional: OPNSENSE_ALLOW_WRITES=true (writes), OPNSENSE_VERIFY_SSL (true or a CA path). Without OPNSENSE_ALLOW_WRITES the server is read-only. Create the key under System → Access → Users → (user) → API keys. A dedicated user with only the pages you need is safer than root.
The VS Code buttons ask for each value, keeping secrets out of files. The Cursor button writes placeholders: edit them in ~/.cursor/mcp.json afterwards. Elsewhere, replace the example values.
claude mcp add opnsense -s user -e OPNSENSE_URL=https://opnsense.example.lan/api -e OPNSENSE_API_KEY=your-api-key -e OPNSENSE_API_SECRET=your-api-secret -- uvx --from git+https://github.com/bigbatmanorg/opn-mcp@v0.1.0 opn-mcpSettings → Developer → Edit Config (claude_desktop_config.json):
{
"mcpServers": {
"opnsense": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/bigbatmanorg/opn-mcp@v0.1.0",
"opn-mcp"
],
"env": {
"OPNSENSE_URL": "https://opnsense.example.lan/api",
"OPNSENSE_API_KEY": "your-api-key",
"OPNSENSE_API_SECRET": "your-api-secret"
}
}
}
}Use the button above, or add this to .vscode/mcp.json (workspace) or to the user mcp.json (command
MCP: Open User Configuration):
{
"inputs": [
{
"type": "promptString",
"id": "opnsense_url",
"description": "Firewall API URL",
"password": false
},
{
"type": "promptString",
"id": "opnsense_api_key",
"description": "API key",
"password": true
},
{
"type": "promptString",
"id": "opnsense_api_secret",
"description": "API secret",
"password": true
}
],
"servers": {
"opnsense": {
"type": "stdio",
"command": "uvx",
"args": [
"--from",
"git+https://github.com/bigbatmanorg/opn-mcp@v0.1.0",
"opn-mcp"
],
"env": {
"OPNSENSE_URL": "${input:opnsense_url}",
"OPNSENSE_API_KEY": "${input:opnsense_api_key}",
"OPNSENSE_API_SECRET": "${input:opnsense_api_secret}"
}
}
}
}Use the button above, or add this to ~/.cursor/mcp.json (global) or .cursor/mcp.json (project):
{
"mcpServers": {
"opnsense": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/bigbatmanorg/opn-mcp@v0.1.0",
"opn-mcp"
],
"env": {
"OPNSENSE_URL": "https://opnsense.example.lan/api",
"OPNSENSE_API_KEY": "your-api-key",
"OPNSENSE_API_SECRET": "your-api-secret"
}
}
}
}Add this to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"opnsense": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/bigbatmanorg/opn-mcp@v0.1.0",
"opn-mcp"
],
"env": {
"OPNSENSE_URL": "https://opnsense.example.lan/api",
"OPNSENSE_API_KEY": "your-api-key",
"OPNSENSE_API_SECRET": "your-api-secret"
}
}
}
}codex mcp add opnsense --env OPNSENSE_URL=https://opnsense.example.lan/api --env OPNSENSE_API_KEY=your-api-key --env OPNSENSE_API_SECRET=your-api-secret -- uvx --from git+https://github.com/bigbatmanorg/opn-mcp@v0.1.0 opn-mcpOr add this to ~/.codex/config.toml:
[mcp_servers.opnsense]
command = "uvx"
args = ["--from", "git+https://github.com/bigbatmanorg/opn-mcp@v0.1.0", "opn-mcp"]
env = { OPNSENSE_URL = "https://opnsense.example.lan/api", OPNSENSE_API_KEY = "your-api-key", OPNSENSE_API_SECRET = "your-api-secret" }Add this to ~/.gemini/settings.json (or to .gemini/settings.json in a project):
{
"mcpServers": {
"opnsense": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/bigbatmanorg/opn-mcp@v0.1.0",
"opn-mcp"
],
"env": {
"OPNSENSE_URL": "https://opnsense.example.lan/api",
"OPNSENSE_API_KEY": "your-api-key",
"OPNSENSE_API_SECRET": "your-api-secret"
}
}
}
}Deep Agents CLI: add this to ~/.deepagents/.mcp.json (all projects) or to .mcp.json in a project. ${VAR} values are read from your shell or ~/.deepagents/.env, so secrets stay out of the file.
{
"mcpServers": {
"opnsense": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/bigbatmanorg/opn-mcp@v0.1.0",
"opn-mcp"
],
"env": {
"OPNSENSE_URL": "${OPNSENSE_URL}",
"OPNSENSE_API_KEY": "${OPNSENSE_API_KEY}",
"OPNSENSE_API_SECRET": "${OPNSENSE_API_SECRET}"
}
}
}
}Python library (pip install deepagents langchain-mcp-adapters):
import asyncio
import os
from deepagents import create_deep_agent
from langchain_mcp_adapters.client import MultiServerMCPClient
client = MultiServerMCPClient({
"opnsense": {
"transport": "stdio",
"command": "uvx",
"args": ["--from", "git+https://github.com/bigbatmanorg/opn-mcp@v0.1.0", "opn-mcp"],
"env": {
"OPNSENSE_URL": os.environ["OPNSENSE_URL"],
"OPNSENSE_API_KEY": os.environ["OPNSENSE_API_KEY"],
"OPNSENSE_API_SECRET": os.environ["OPNSENSE_API_SECRET"],
},
}
})
async def main():
tools = await client.get_tools()
agent = create_deep_agent(model="anthropic:claude-sonnet-5-5", tools=tools)
result = await agent.ainvoke({"messages": [{"role": "user", "content": "What can you do?"}]})
print(result["messages"][-1].content)
asyncio.run(main())Save this as agent.yaml, then run docker agent run agent.yaml:
agents:
root:
model: anthropic/claude-sonnet-5-5
description: Assistant with the opnsense MCP tools
instruction: Use the opnsense tools to answer the user's requests.
toolsets:
- type: mcp
command: uvx
args:
- "--from"
- "git+https://github.com/bigbatmanorg/opn-mcp@v0.1.0"
- "opn-mcp"
env:
OPNSENSE_URL: "https://opnsense.example.lan/api"
OPNSENSE_API_KEY: "your-api-key"
OPNSENSE_API_SECRET: "your-api-secret"Add this to ~/.hermes/config.yaml, then run /reload-mcp in a chat:
mcp_servers:
opnsense:
command: uvx
args: ["--from", "git+https://github.com/bigbatmanorg/opn-mcp@v0.1.0", "opn-mcp"]
env:
OPNSENSE_URL: "https://opnsense.example.lan/api"
OPNSENSE_API_KEY: "your-api-key"
OPNSENSE_API_SECRET: "your-api-secret"MCP Servers → Configure (cline_mcp_settings.json / mcp_settings.json):
{
"mcpServers": {
"opnsense": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/bigbatmanorg/opn-mcp@v0.1.0",
"opn-mcp"
],
"env": {
"OPNSENSE_URL": "https://opnsense.example.lan/api",
"OPNSENSE_API_KEY": "your-api-key",
"OPNSENSE_API_SECRET": "your-api-secret"
}
}
}
}Add this to settings.json:
{
"context_servers": {
"opnsense": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/bigbatmanorg/opn-mcp@v0.1.0",
"opn-mcp"
],
"env": {
"OPNSENSE_URL": "https://opnsense.example.lan/api",
"OPNSENSE_API_KEY": "your-api-key",
"OPNSENSE_API_SECRET": "your-api-secret"
}
}
}
}Add this to opencode.json (project) or ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"opnsense": {
"type": "local",
"command": [
"uvx",
"--from",
"git+https://github.com/bigbatmanorg/opn-mcp@v0.1.0",
"opn-mcp"
],
"environment": {
"OPNSENSE_URL": "https://opnsense.example.lan/api",
"OPNSENSE_API_KEY": "your-api-key",
"OPNSENSE_API_SECRET": "your-api-secret"
},
"enabled": true
}
}
}Run goose configure → Add Extension → Command-line Extension, with the command uvx --from git+https://github.com/bigbatmanorg/opn-mcp@v0.1.0 opn-mcp. Or add this to
~/.config/goose/config.yaml:
extensions:
opnsense:
type: stdio
enabled: true
cmd: uvx
args: ["--from", "git+https://github.com/bigbatmanorg/opn-mcp@v0.1.0", "opn-mcp"]
envs:
OPNSENSE_URL: "https://opnsense.example.lan/api"
OPNSENSE_API_KEY: "your-api-key"
OPNSENSE_API_SECRET: "your-api-secret"Most clients take the standard mcpServers JSON shown for Claude Desktop. Some use servers instead.
To install once instead of fetching on each start:
uv tool install git+https://github.com/bigbatmanorg/opn-mcp@v0.1.0then use "command": "opn-mcp", "args": [].
From a checkout: "command": "uv", "args": ["run", "--directory", "/abs/path/opn-mcp", "opn-mcp"].
Related MCP server: OPNsense MCP Server
Safety
Read-only by default.
OPNSENSE_ALLOW_WRITES=trueenables writes. Destructive actions (del, stop, reboot, firmware update, revert) also needconfirm=trueon the call.Unknown body fields are rejected. OPNsense itself drops them silently and still answers "saved".
Firewall auto-revert: OPNsense 26.7 removed
firewall/filter/savepoint. Instead, the first firewall write records the newest config-history entry, and applying arms a 60 s timer. The timer reverts to that entry (core/backup/revert_backup, then alias reconfigure and filter apply) unlessopn_firewall_confirmis called.opn_firewall_revert_nowreverts at once. The timer lives in the server process, so it does not fire if the server exits.
Configuration
OPNSENSE_URL (https://host/api), OPNSENSE_API_KEY, OPNSENSE_API_SECRET, OPNSENSE_VERIFY_SSL
(false, true or a CA path), OPNSENSE_ALLOW_WRITES, OPNSENSE_TIMEOUT.
Tests
uv run pytest # unit tests (mocked HTTP)
OPN_LAB=1 uv run pytest -m lab # lab OPNsense onlyLab tests create and delete real objects; run them only against a disposable instance (OPN_LAB=1 with OPN_URL, OPN_API_KEY, OPN_API_SECRET).
License
BSD-2-Clause. The bundled index (src/opn_mcp/data/opnsense-api.json.gz) is generated from opnsense/core and opnsense/plugins, BSD-2-Clause, Copyright Deciso B.V. and the OPNsense contributors.
Available Tools
14 toolsopn_apiA
Call any endpoint: path is module/controller/action plus positional args, e.g. "core/service/restart/unbound" or "firewall/alias/set_item/". The method defaults to what the endpoint expects. POST bodies are checked against the model unless strict=false. dry_run=true shows the request without sending it. Changes saved this way are not active until the controller's apply/reconfigure runs (see opn_items).
Inputs: path (required), body, method, params, +3 more.
opn_api_describeB
Method, path args, body fields (types, required, options) and search params of an endpoint, e.g. "firewall/alias/add_item".
Inputs: path (required). Returns: object
opn_api_searchB
Search OPNsense API endpoints by words in the path, description or model (e.g. "alias", "kea reservation", "unbound host override", "wireguard peer").
Inputs: query (required), limit, installed_only. Returns: object
opn_config_historyA
Config history (newest first: id, time, description, user). With diff_with=, the diff between that backup and the newest one.
Inputs: limit, diff_with.
opn_config_revertA
Restore config.xml from a history entry (id from opn_config_history). Services other than the firewall keep running with their old config until reconfigured. Needs confirm=true.
Inputs: backup (required), confirm, reload_firewall. Returns: object
opn_firewall_confirmA
Keep the applied firewall changes and cancel the pending auto-revert.
Inputs: no named parameters. Returns: object
opn_firewall_logB
Recent firewall log entries (newest first), optionally filtered by a substring (IP, port, interface).
Inputs: limit, search. Returns: result
opn_firewall_revert_nowA
Revert the pending firewall changes immediately instead of waiting for the timer.
Inputs: no named parameters. Returns: object
opn_itemsB
Work with the items of any OPNsense model controller. controller + item name the endpoints: ("firewall/alias", "item") -> firewall/alias/search_item, add_item, ...; ("firewall/filter", "rule"), ("firewall/d_nat", "rule"), ("unbound/settings", "host_override"), ("dnsmasq/settings", "host"), ("kea/dhcpv4", "reservation"), ("nginx/settings", "upstream"). data holds just the item's fields (see opn_api_describe on the add_ endpoint). apply=true runs the controller's apply/reconfigure afterwards; for firewall rules that arms the auto-revert (confirm with opn_firewall_confirm). del needs confirm=true.
Inputs: item (required), controller (required), data, rows, +7 more.
opn_neighborsA
ARP (ipv4) or NDP (ipv6) table, optionally filtered by IP/MAC/hostname substring.
Inputs: family, search. Returns: object
opn_overviewA
Version, update status, interfaces, gateways and services in one call, plus whether writes are enabled.
Inputs: no named parameters. Returns: object
opn_pingA
Ping a host from the firewall and return loss and round-trip times. Works in read-only mode: it only runs a temporary diagnostics job, which is removed afterwards.
Inputs: host (required), count, timeout. Returns: object
opn_serviceA
List services (no name), or start/stop/restart one by name (e.g. "unbound", "dhcpd", "openvpn" with service_id for multi-instance services). stop needs confirm=true.
Inputs: name, action, confirm, service_id.
opn_settingsB
Read a controller's whole settings model (controller/get), or change part of it: data is merged into the model and saved with controller/set, e.g. opn_settings("unbound/settings", {"general": {"port": "53"}}). apply=true then runs the service reconfigure.
Inputs: controller (required), data, apply, dry_run.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 14 tools
Most tools have clear, distinct purposes: discovery (search/describe), the generic caller (opn_api), convenience wrappers (opn_items/opn_settings), and domain-specific helpers (ping, neighbors, firewall_log, overview, service, config tools). The main soft overlap is opn_api vs opn_items vs opn_settings, since all can write to model controllers, but descriptions explain the layering (generic escape hatch vs item-level vs whole-model).
All tools share a consistent opn_ snake_case prefix, which is readable and predictable. The verb/noun mix (opn_api_search, opn_config_revert vs opn_items, opn_overview, opn_service) is slightly inconsistent but each name still signals its role clearly.
14 tools is well within the ideal 3-15 range and each one earns its place: discovery, generic call, item/settings helpers, and targeted diagnostics/management tools. Nothing is redundant filler, and the count fits a broad OPNsense management surface.
The surface covers the full lifecycle well: discovery, read/write via opn_api/opn_items/opn_settings, apply/confirm/revert-now for firewall safety, config history/restore, plus diagnostics (ping, neighbors, log, overview, services). The generic opn_api acts as a catch-all for any gap, so coverage is strong, with only minor friction from needing controller/item knowledge to use the wrappers.
Maintenance
Related MCP Connectors
Discover, inspect and run 63,000+ agent tools from one balance. Pay per call, no subscriptions.
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Lets AI agents analyze API metrics, request logs, and traces, and manage apps and alerts.
Verified, pay-per-use API tools for AI agents through one authenticated connection.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables natural language management of OPNsense firewalls through AI clients, providing tools for firewall rules, system health, VPN monitoring, and more.AGPL 3.0
- AlicenseNot gradedqualityCmaintenanceEnables AI clients to manage OPNsense firewall, interfaces, DHCP, DNS, routes, and services via natural language through 42 MCP tools.1MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to manage and configure pfSense routers through the pfSense REST API, offering 240 tools across 17 modules with safety features like confirm gates, config backups, and read-only mode.-
- FlicenseNot gradedqualityAmaintenanceEnables Claude Desktop, Claude Code, and other MCP clients to manage a pfSense firewall through natural language — handling firewall rules, aliases, NAT, VPNs, routing, DNS, DHCP, certificates, users, services, logs, traffic shaping, and diagnostics across 332 API-verified tools. Every destructive change is guarded by confirmation prompts, rate limits, config-revision backup for rollback, and audit logging.-