O

Opnsense Guard MCP

by d3ltasecurity · io.github.d3ltasecurity/opnsense-guard-mcp

Enables AI clients to inspect OPNsense 26.7+ firewall state and, with policy and a separate write-capable API user, plan, approve, apply, verify, and automatically revert firewall rule and alias changes under hash-chained auditing.

pypi Local · stdio GlamaOfficial MCP Registry High confidence

Install

Add to ~/Library/Application Support/Claude/claude_desktop_config.json

Windows / Linux path
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "io-github-d3ltasecurity-opnsense-guard-mcp": {
      "command": "uvx",
      "args": [
        "opnsense-guard-mcp"
      ],
      "env": {
        "OPNSENSE_URL": "<VALUE>",
        "OPNSENSE_API_KEY": "<YOUR_VALUE>",
        "OPNSENSE_API_SECRET": "<YOUR_VALUE>",
        "OPNSENSE_CA_BUNDLE": "<VALUE>",
        "MCP_HOST": "127.0.0.1",
        "MCP_PORT": "8848",
        "MCP_TLS_KEY": "<VALUE>",
        "MCP_TLS_CERT": "<VALUE>",
        "MCP_TRANSPORT": "<VALUE>",
        "MCP_ALLOWED_HOSTS": "<VALUE>",
        "MCP_TLS_CLIENT_CA": "<VALUE>",
        "MCP_ALLOWED_ORIGINS": "<VALUE>",
        "MCP_ALLOW_PLAINTEXT": "false",
        "NODE_EXTRA_CA_CERTS": "<VALUE>",
        "OPNSENSE_VERIFY_SSL": "<VALUE>",
        "OPNSENSE_GUARD_POLICY": "<VALUE>",
        "MCP_RATE_LIMIT_PER_MIN": "120",
        "OPNSENSE_WRITE_API_KEY": "<VALUE>",
        "OPNSENSE_GUARD_DATA_DIR": "./data",
        "OPNSENSE_WRITE_API_SECRET": "<VALUE>",
        "OPNSENSE_GUARD_TOKENS_FILE": "./tokens.json"
      }
    }
  }
}

Restart Claude Desktop to activate the new server.

Add to .cursor/mcp.json (project) or ~/.cursor/mcp.json (global)

Windows / Linux path
Windows: .cursor\mcp.json (project) or %USERPROFILE%\.cursor\mcp.json (global)
Linux: .cursor/mcp.json (project) or ~/.cursor/mcp.json (global)
{
  "mcpServers": {
    "io-github-d3ltasecurity-opnsense-guard-mcp": {
      "command": "uvx",
      "args": [
        "opnsense-guard-mcp"
      ],
      "env": {
        "OPNSENSE_URL": "<VALUE>",
        "OPNSENSE_API_KEY": "<YOUR_VALUE>",
        "OPNSENSE_API_SECRET": "<YOUR_VALUE>",
        "OPNSENSE_CA_BUNDLE": "<VALUE>",
        "MCP_HOST": "127.0.0.1",
        "MCP_PORT": "8848",
        "MCP_TLS_KEY": "<VALUE>",
        "MCP_TLS_CERT": "<VALUE>",
        "MCP_TRANSPORT": "<VALUE>",
        "MCP_ALLOWED_HOSTS": "<VALUE>",
        "MCP_TLS_CLIENT_CA": "<VALUE>",
        "MCP_ALLOWED_ORIGINS": "<VALUE>",
        "MCP_ALLOW_PLAINTEXT": "false",
        "NODE_EXTRA_CA_CERTS": "<VALUE>",
        "OPNSENSE_VERIFY_SSL": "<VALUE>",
        "OPNSENSE_GUARD_POLICY": "<VALUE>",
        "MCP_RATE_LIMIT_PER_MIN": "120",
        "OPNSENSE_WRITE_API_KEY": "<VALUE>",
        "OPNSENSE_GUARD_DATA_DIR": "./data",
        "OPNSENSE_WRITE_API_SECRET": "<VALUE>",
        "OPNSENSE_GUARD_TOKENS_FILE": "./tokens.json"
      }
    }
  }
}

Cursor usually picks up config changes automatically; if the server does not appear, reload the window.

Add to .mcp.json (project) or ~/.claude.json (global)

Windows / Linux path
Windows: .mcp.json (project) or %USERPROFILE%\.claude.json (global)
Linux: .mcp.json (project) or ~/.claude.json (global)
{
  "mcpServers": {
    "io-github-d3ltasecurity-opnsense-guard-mcp": {
      "command": "uvx",
      "args": [
        "opnsense-guard-mcp"
      ],
      "env": {
        "OPNSENSE_URL": "<VALUE>",
        "OPNSENSE_API_KEY": "<YOUR_VALUE>",
        "OPNSENSE_API_SECRET": "<YOUR_VALUE>",
        "OPNSENSE_CA_BUNDLE": "<VALUE>",
        "MCP_HOST": "127.0.0.1",
        "MCP_PORT": "8848",
        "MCP_TLS_KEY": "<VALUE>",
        "MCP_TLS_CERT": "<VALUE>",
        "MCP_TRANSPORT": "<VALUE>",
        "MCP_ALLOWED_HOSTS": "<VALUE>",
        "MCP_TLS_CLIENT_CA": "<VALUE>",
        "MCP_ALLOWED_ORIGINS": "<VALUE>",
        "MCP_ALLOW_PLAINTEXT": "false",
        "NODE_EXTRA_CA_CERTS": "<VALUE>",
        "OPNSENSE_VERIFY_SSL": "<VALUE>",
        "OPNSENSE_GUARD_POLICY": "<VALUE>",
        "MCP_RATE_LIMIT_PER_MIN": "120",
        "OPNSENSE_WRITE_API_KEY": "<VALUE>",
        "OPNSENSE_GUARD_DATA_DIR": "./data",
        "OPNSENSE_WRITE_API_SECRET": "<VALUE>",
        "OPNSENSE_GUARD_TOKENS_FILE": "./tokens.json"
      }
    }
  }
}

The server will be available in the next Claude Code session.

Add to .vscode/mcp.json

Windows / Linux path
Windows: .vscode\mcp.json
Linux: .vscode/mcp.json
{
  "servers": {
    "io-github-d3ltasecurity-opnsense-guard-mcp": {
      "command": "uvx",
      "args": [
        "opnsense-guard-mcp"
      ],
      "env": {
        "OPNSENSE_URL": "<VALUE>",
        "OPNSENSE_API_KEY": "<YOUR_VALUE>",
        "OPNSENSE_API_SECRET": "<YOUR_VALUE>",
        "OPNSENSE_CA_BUNDLE": "<VALUE>",
        "MCP_HOST": "127.0.0.1",
        "MCP_PORT": "8848",
        "MCP_TLS_KEY": "<VALUE>",
        "MCP_TLS_CERT": "<VALUE>",
        "MCP_TRANSPORT": "<VALUE>",
        "MCP_ALLOWED_HOSTS": "<VALUE>",
        "MCP_TLS_CLIENT_CA": "<VALUE>",
        "MCP_ALLOWED_ORIGINS": "<VALUE>",
        "MCP_ALLOW_PLAINTEXT": "false",
        "NODE_EXTRA_CA_CERTS": "<VALUE>",
        "OPNSENSE_VERIFY_SSL": "<VALUE>",
        "OPNSENSE_GUARD_POLICY": "<VALUE>",
        "MCP_RATE_LIMIT_PER_MIN": "120",
        "OPNSENSE_WRITE_API_KEY": "<VALUE>",
        "OPNSENSE_GUARD_DATA_DIR": "./data",
        "OPNSENSE_WRITE_API_SECRET": "<VALUE>",
        "OPNSENSE_GUARD_TOKENS_FILE": "./tokens.json"
      }
    }
  }
}

Reload the VS Code window to activate.

Add to ~/.codeium/windsurf/mcp_config.json

Windows / Linux path
Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json
Linux: ~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "io-github-d3ltasecurity-opnsense-guard-mcp": {
      "command": "uvx",
      "args": [
        "opnsense-guard-mcp"
      ],
      "env": {
        "OPNSENSE_URL": "<VALUE>",
        "OPNSENSE_API_KEY": "<YOUR_VALUE>",
        "OPNSENSE_API_SECRET": "<YOUR_VALUE>",
        "OPNSENSE_CA_BUNDLE": "<VALUE>",
        "MCP_HOST": "127.0.0.1",
        "MCP_PORT": "8848",
        "MCP_TLS_KEY": "<VALUE>",
        "MCP_TLS_CERT": "<VALUE>",
        "MCP_TRANSPORT": "<VALUE>",
        "MCP_ALLOWED_HOSTS": "<VALUE>",
        "MCP_TLS_CLIENT_CA": "<VALUE>",
        "MCP_ALLOWED_ORIGINS": "<VALUE>",
        "MCP_ALLOW_PLAINTEXT": "false",
        "NODE_EXTRA_CA_CERTS": "<VALUE>",
        "OPNSENSE_VERIFY_SSL": "<VALUE>",
        "OPNSENSE_GUARD_POLICY": "<VALUE>",
        "MCP_RATE_LIMIT_PER_MIN": "120",
        "OPNSENSE_WRITE_API_KEY": "<VALUE>",
        "OPNSENSE_GUARD_DATA_DIR": "./data",
        "OPNSENSE_WRITE_API_SECRET": "<VALUE>",
        "OPNSENSE_GUARD_TOKENS_FILE": "./tokens.json"
      }
    }
  }
}

Restart Windsurf (or refresh its MCP servers panel) to activate the new server.

Windsurf Next uses ~/.codeium/windsurf-next/mcp_config.json. Devin Desktop (the Windsurf rebrand) uses ~/.config/devin/mcp_config.json and imports the Windsurf file.

Add to ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json

Windows / Linux path
Windows: %APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json
Linux: ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
{
  "mcpServers": {
    "io-github-d3ltasecurity-opnsense-guard-mcp": {
      "command": "uvx",
      "args": [
        "opnsense-guard-mcp"
      ],
      "env": {
        "OPNSENSE_URL": "<VALUE>",
        "OPNSENSE_API_KEY": "<YOUR_VALUE>",
        "OPNSENSE_API_SECRET": "<YOUR_VALUE>",
        "OPNSENSE_CA_BUNDLE": "<VALUE>",
        "MCP_HOST": "127.0.0.1",
        "MCP_PORT": "8848",
        "MCP_TLS_KEY": "<VALUE>",
        "MCP_TLS_CERT": "<VALUE>",
        "MCP_TRANSPORT": "<VALUE>",
        "MCP_ALLOWED_HOSTS": "<VALUE>",
        "MCP_TLS_CLIENT_CA": "<VALUE>",
        "MCP_ALLOWED_ORIGINS": "<VALUE>",
        "MCP_ALLOW_PLAINTEXT": "false",
        "NODE_EXTRA_CA_CERTS": "<VALUE>",
        "OPNSENSE_VERIFY_SSL": "<VALUE>",
        "OPNSENSE_GUARD_POLICY": "<VALUE>",
        "MCP_RATE_LIMIT_PER_MIN": "120",
        "OPNSENSE_WRITE_API_KEY": "<VALUE>",
        "OPNSENSE_GUARD_DATA_DIR": "./data",
        "OPNSENSE_WRITE_API_SECRET": "<VALUE>",
        "OPNSENSE_GUARD_TOKENS_FILE": "./tokens.json"
      }
    }
  }
}

Cline reloads cline_mcp_settings.json automatically; if the server does not appear, reload the VS Code window.

Open it from Cline's MCP Servers panel → Configure. Roo Code uses a different file and format.

Configuration

Environment variables this server reads. Secrets stay on your machine.

NameRequiredDescription
OPNSENSE_URL Yes Base URL of the OPNsense firewall, e.g. https://firewall.example.internal
OPNSENSE_API_KEY secret Yes API key for the least-privilege read-only OPNsense API user
OPNSENSE_API_SECRET secret Yes API secret for the least-privilege read-only OPNsense API user
OPNSENSE_CA_BUNDLE No Path to the firewall CA bundle (alternative to OPNSENSE_VERIFY_SSL=false)
MCP_HOST No HTTP listen address Default: 127.0.0.1
MCP_PORT No HTTP listen port Default: 8848
MCP_TLS_KEY No TLS private key file for serving HTTPS
MCP_TLS_CERT No TLS certificate file for serving HTTPS
MCP_TRANSPORT No Transport to use: stdio or http
MCP_ALLOWED_HOSTS No Accepted Host headers (DNS-rebinding guard); defaults to localhost/127.0.0.1/MCP_HOST on the configured port
MCP_TLS_CLIENT_CA No CA file used to require client certificates (mTLS)
MCP_ALLOWED_ORIGINS No Browser origins allowed; any other Origin is refused
MCP_ALLOW_PLAINTEXT No Allow plain HTTP on a non-loopback address (only behind a TLS proxy) Default: false
NODE_EXTRA_CA_CERTS No Path to a CA file for Claude Code (Node) to trust a private CA when connecting to the MCP server
OPNSENSE_VERIFY_SSL No Set to false to disable TLS verification (alternative to OPNSENSE_CA_BUNDLE)
OPNSENSE_GUARD_POLICY No Path to policy.yaml; without it the server is read-only
MCP_RATE_LIMIT_PER_MIN No Requests per token per minute Default: 120
OPNSENSE_WRITE_API_KEY No API key for a second, write-capable OPNsense API user; enables change tools when a write-mode policy is configured
OPNSENSE_GUARD_DATA_DIR No Directory for the audit log, change journal and related data Default: ./data
OPNSENSE_WRITE_API_SECRET No API secret for the second, write-capable OPNsense API user; enables change tools when a write-mode policy is configured
OPNSENSE_GUARD_TOKENS_FILE No File containing HTTP bearer token hashes Default: ./tokens.json

Similar servers