by vespo92
Manage OPNsense firewalls through conversational AI, providing network configuration, device discovery, DNS filtering, HAProxy setup, and backup/restore via simple commands.
Enables control of OPNsense firewalls using natural‑language instructions. The server translates Claude Desktop or Claude Code queries into OPNsense API calls, handling VLANs, rules, device lookup, DNS filtering, HAProxy, and IaC deployments.
npx opnsense-mcp-server
or install globally with npm i -g opnsense-mcp-server
.claude_desktop_config.json
(macOS, Windows, Linux) or .claude/config.json
for Claude Code. Use the NPX command and provide the required environment variables (OPNSENSE_HOST
, OPNSENSE_API_KEY
, OPNSENSE_API_SECRET
, optional OPNSENSE_VERIFY_SSL
).Q: Do I need to install anything on the OPNsense appliance? A: Only enable the built‑in API (System → Settings → Administration → Enable API) and create an API user with appropriate privileges.
Q: Can I store API credentials securely?
A: Yes. Use the system keychain syntax {{keychain:opnsense-api-key}}
in the MCP configuration to pull secrets from macOS Keychain, Windows Credential Manager, or Linux Secret Service.
Q: What Node.js version is required? A: Node 18 or newer.
Q: How do I run the server in HTTP mode for automation?
A: Execute npm run start:sse
(default port 3000) and point your automation tools to http://localhost:3000
.
Q: What if Claude cannot connect to the server?
A: Verify the NPX command path, ensure all environment variables are set correctly (host must include https://
), and test the server manually via npx opnsense-mcp-server
.
A Model Context Protocol (MCP) server for managing OPNsense firewalls through Claude Desktop or Claude Code.
OPNSense MCP Server enables you to control your OPNsense firewall using conversational AI. Instead of navigating complex firewall interfaces, simply tell Claude what you want to do.
Example interactions:
# Use directly with npx - no installation needed
npx opnsense-mcp-server
# Or install globally
npm install -g opnsense-mcp-server
# Use latest from GitHub
npx github:vespo92/OPNSenseMCP
git clone https://github.com/vespo92/OPNSenseMCP
cd OPNSenseMCP
npm install
npm run build
Add to your Claude Desktop configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/claude/claude_desktop_config.json
{
"mcpServers": {
"opnsense": {
"command": "npx",
"args": ["--yes", "opnsense-mcp-server@latest"],
"env": {
"OPNSENSE_HOST": "https://192.168.1.1",
"OPNSENSE_API_KEY": "your-api-key",
"OPNSENSE_API_SECRET": "your-api-secret",
"OPNSENSE_VERIFY_SSL": "true"
}
}
}
}
Add to .claude/config.json
in your project root:
Option 1: Using NPX (Recommended)
{
"mcpServers": {
"opnsense": {
"command": "npx",
"args": ["--yes", "opnsense-mcp-server@latest"],
"env": {
"OPNSENSE_HOST": "https://192.168.1.1",
"OPNSENSE_API_KEY": "your-api-key",
"OPNSENSE_API_SECRET": "your-api-secret",
"OPNSENSE_VERIFY_SSL": "true"
}
}
}
}
Option 2: Local Installation
{
"mcpServers": {
"opnsense": {
"command": "node",
"args": ["node_modules/opnsense-mcp-server/dist/index.js"],
"env": {
"OPNSENSE_HOST": "https://192.168.1.1",
"OPNSENSE_API_KEY": "your-api-key",
"OPNSENSE_API_SECRET": "your-api-secret",
"OPNSENSE_VERIFY_SSL": "true"
}
}
}
}
Instead of hardcoding credentials:
{
"mcpServers": {
"opnsense": {
"command": "npx",
"args": ["opnsense-mcp-server"],
"env": {
"OPNSENSE_HOST": "https://192.168.1.1",
"OPNSENSE_API_KEY": "{{keychain:opnsense-api-key}}",
"OPNSENSE_API_SECRET": "{{keychain:opnsense-api-secret}}",
"OPNSENSE_VERIFY_SSL": "true"
}
}
}
}
Then store credentials in your system keychain:
Variable | Description | Required | Default |
---|---|---|---|
OPNSENSE_HOST |
OPNsense URL (include https://) | Yes | - |
OPNSENSE_API_KEY |
API key from OPNsense | Yes | - |
OPNSENSE_API_SECRET |
API secret from OPNsense | Yes | - |
OPNSENSE_VERIFY_SSL |
Verify SSL certificates | No | true |
LOG_LEVEL |
Logging level | No | info |
CACHE_ENABLED |
Enable response caching | No | true |
CACHE_TTL |
Cache time-to-live in seconds | No | 300 |
{
"mcpServers": {
"opnsense": {
"command": "npx",
"args": ["opnsense-mcp-server"],
"env": {
"OPNSENSE_HOST": "https://192.168.1.1",
"OPNSENSE_API_KEY": "{{keychain:opnsense-api-key}}",
"OPNSENSE_API_SECRET": "{{keychain:opnsense-api-secret}}",
// Optional: Redis cache configuration
// "REDIS_HOST": "localhost",
// "REDIS_PORT": "6379",
// "REDIS_PASSWORD": "{{keychain:redis-password}}",
// "REDIS_DB": "0",
// Optional: PostgreSQL for state persistence
// "POSTGRES_HOST": "localhost",
// "POSTGRES_PORT": "5432",
// "POSTGRES_DB": "opnsense_mcp",
// "POSTGRES_USER": "mcp_user",
// "POSTGRES_PASSWORD": "{{keychain:postgres-password}}",
// Optional: State encryption
// "STATE_ENCRYPTION_KEY": "{{keychain:state-encryption-key}}",
// Optional: Performance tuning
// "CACHE_COMPRESSION_ENABLED": "true",
// "CACHE_COMPRESSION_THRESHOLD": "1024",
// "MAX_CONCURRENT_REQUESTS": "10"
}
}
}
}
Enable API in OPNsense:
Create API credentials:
Required privileges:
Then restart Claude Desktop/Code and start chatting!
"Create a guest network on VLAN 20 with internet access only"
"Show me all devices from Apple on my network"
"Block gambling and adult content sites"
"Configure HAProxy to load balance my web servers"
More examples in the examples/ directory.
npm run start:sse # HTTP server on port 3000
Deploy entire network configurations declaratively. See IaC documentation.
Build reusable network templates. See pattern examples.
We welcome contributions! Please see our Contributing Guide for details.
npm install
npm run dev # Development mode with hot reload
If the MCP server fails to connect:
Check the command path:
["npx", "--yes", "opnsense-mcp-server@latest"]
to ensure latest versionnode_modules/opnsense-mcp-server/dist/index.js
Verify environment variables:
https://192.168.1.1
not just 192.168.1.1
Test standalone first:
npx opnsense-mcp-server
# Or if installed locally:
node node_modules/opnsense-mcp-server/dist/index.js
Check Claude logs:
~/Library/Logs/Claude/
%APPDATA%\Claude\logs\
~/.config/claude/logs/
npm i -g opnsense-mcp-server
or use npxMIT License - see LICENSE for details.
Built with ❤️ for the MCP ecosystem
Please log in to share your review and rating for this MCP.
{ "mcpServers": { "opnsense": { "command": "npx", "args": [ "-y", "opnsense-mcp-server@latest" ], "env": { "OPNSENSE_HOST": "https://<YOUR_OPNSENSE_IP_OR_HOST>", "OPNSENSE_API_KEY": "<YOUR_API_KEY>", "OPNSENSE_API_SECRET": "<YOUR_API_SECRET>", "OPNSENSE_VERIFY_SSL": "true" } } } }
Explore related MCPs that share similar capabilities and solve comparable challenges
by chaitin
A self‑hosted web application firewall and reverse proxy that protects web applications from attacks and exploits by filtering, monitoring, and blocking malicious HTTP/S traffic.
by PortSwigger
Enables Burp Suite to communicate with AI clients via the Model Context Protocol, providing an MCP server and bundled stdio proxy.
by cycodehq
Boost security in the development lifecycle via SAST, SCA, secrets, and IaC scanning.
by ChristophEnglisch
Provides AI‑powered administration of Keycloak users and realms through the Model Context Protocol, enabling automated creation, deletion, and listing of users and realms from MCP clients such as Claude Desktop.
by Spathodea-Network
Provides a Model Context Protocol server that enables querying and retrieving threat intelligence data from OpenCTI through a standardized interface.
by firstorderai
Provides seamless access to two‑factor authentication codes and passwords for AI agents, enabling automated login while maintaining security.
by mytechnotalent
Provides an AI-driven interface to Malware Bazaar, delivering real-time threat intelligence and sample metadata for authorized cybersecurity research workflows.
by co-browser
Verify that any MCP server is running the intended and untampered code via hardware attestation.
by Hexix23
Provides a powerful interface to the Shodan API, enabling advanced search, host intelligence, vulnerability discovery, and network mapping for security research.