mcp-opnsense
Provides read-only tools for managing OPNsense firewalls, including listing firewall rules and aliases, retrieving individual rules and aliases, and obtaining network interface statistics and gateway status.
Click on "Install 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-opnsensecheck the gateway status for the office firewall"
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 managing OPNsense firewalls via Claude Code. Read-only tools first — write support planned.
Setup
1. Install dependencies
npm install
npm run build2. Create OPNsense API user
⚠️ Do not use the admin/root user. Create a dedicated user with minimal privileges.
2a. Create a group
System → Access → Groups → Add
Group name:
mcp_readonlyAssign these privileges:
Privilege
Needed for
GUI - Firewall: Rules
list-firewall-rules,get-firewall-rule,list-aliases,get-aliasGUI - Gateways
get-gateway-statusGUI - Diagnostics: Interface
get-interface-statsSave
2b. Create a user
System → Access → Users → Add
Username:
mcpPassword: (generate a strong random password)
Group:
mcp_readonly
Save
2c. Generate API key
System → Access → API Keys → Add
User:
mcpDownload the key file (INI/txt format)
Keep it secure — it contains the
keyandsecret
Note: OPNsense ACLs are page-level — the "Firewall: Rules" privilege grants both read and write API access. The MCP server currently only exposes read tools, so this is safe. When write tools are added, the same user will work without changes.
3. Create config file
mkdir -p ~/.mcp-opnsense
cp config.example.json ~/.mcp-opnsense/config.json
chmod 600 ~/.mcp-opnsense/config.jsonEdit ~/.mcp-opnsense/config.json with your OPNsense connection details:
{
"instances": [
{
"name": "home",
"url": "https://192.168.1.1",
"api_key": "your-key-here",
"api_secret": "your-secret-here",
"allow_insecure": true
},
{
"name": "office",
"url": "https://10.0.0.1",
"api_key": "your-key-here",
"api_secret": "your-secret-here",
"allow_insecure": false
}
],
"default": "home"
}name— short label for this instanceurl— OPNsense base URL (HTTPS without trailing/api)api_key/api_secret— from the downloaded key file in step 2callow_insecure— settrueif using self-signed certificates (common on LAN)
Set OPNSENSE_CONFIG_PATH env var to override the config file location.
4. Configure Claude Code
Add to your Claude Code MCP config (usually ~/.claude/settings.json):
{
"mcpServers": {
"opnsense": {
"command": "node",
"args": ["/path/to/mcp-opnsense/dist/index.js"],
"env": {}
}
}
}Or use the dev mode (no build step):
{
"mcpServers": {
"opnsense": {
"command": "npx",
"args": ["tsx", "/path/to/mcp-opnsense/src/index.ts"],
"env": {}
}
}
}Related MCP server: opnsense-mcp
Available Tools
All tools accept an optional instance parameter to target a specific OPNsense instance (uses the configured default if omitted).
Tool | Description |
| List firewall filter rules with optional search |
| Get a single rule by UUID |
| List firewall aliases (host, network, port, URL types) |
| Get a single alias by UUID |
| Get network interface statistics |
| Live gateway monitoring (online/offline, latency, loss) |
Note: The OPNsense API only manages rules created under Firewall → Automation → Filter. Legacy rules from Firewall → Rules are not accessible via API.
Development
# Run typecheck
npm run typecheck
# Run dev server (via tsx, no build step)
npm run dev
# Build to dist/
npm run build
# Run production
npm startMulti-Instance
Define all your OPNsense endpoints in ~/.mcp-opnsense/config.json under the instances array. Use the instance parameter in any tool to target a specific instance:
"Check the gateway status for the office firewall"
→ get-gateway-status(instance: "office")When no instance is specified, the default from config is used.
Known Limitations
Automation rules only — the API only exposes rules from Firewall → Automation. Classic Firewall → Rules entries are not reachable.
Self-signed certs — set
allow_insecure: truefor LAN OPNsense boxes with self-signed TLS.API permissions — the OPNsense user must have the relevant permissions (Gateways, Firewall, Diagnostics) assigned.
Roadmap
Read-only tools (firewall rules, aliases, diagnostics)
Write tools — add/update aliases (low risk)
Write tools — toggle firewall rules (with rollback)
Write tools — create/update/delete firewall rules
DHCP leases & static mappings
DNS overrides (Unbound/Dnsmasq)
VPN status (WireGuard, OpenVPN)
Service management (restart, status)
Config backup & restore via API
License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityDmaintenanceA 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.8110MIT
- AlicenseAqualityCmaintenanceEnables interaction with OPNsense firewalls through MCP tools for managing firewall rules, interfaces, DHCP leases, and system monitoring.26MIT
- Flicense-qualityBmaintenanceA 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.
- Alicense-qualityAmaintenanceThis MCP server enables AI agents to inspect and modify an OPNsense firewall via natural language, using a compact set of generic tools and a resource registry to cover 96 CRUD operations.51AGPL 3.0
Related MCP Connectors
MCP server for managing Prisma Postgres.
An MCP server giving access to Grafana dashboards, data and more.
The MCP server for Azure DevOps, bringing the power of Azure DevOps directly to your agents.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/drmfar/mcp-opnsense'
If you have feedback or need assistance with the MCP directory API, please join our Discord server