Manage OPNsense firewalls using Infrastructure as Code (IaC) principles.
A Model Context Protocol (MCP) server for comprehensive OPNsense firewall management. This server enables AI assistants like Claude to directly manage firewall configurations, diagnose network issues, and automate complex networking tasks.
npm install -g opnsense-mcp-server
.env
file with your credentials:# Required
OPNSENSE_HOST=https://your-opnsense-host:port
OPNSENSE_API_KEY=your-api-key
OPNSENSE_API_SECRET=your-api-secret
OPNSENSE_VERIFY_SSL=false
# Optional - for SSH features
OPNSENSE_SSH_HOST=your-opnsense-host
OPNSENSE_SSH_USERNAME=root
OPNSENSE_SSH_PASSWORD=your-password
# Or use SSH key
# OPNSENSE_SSH_KEY_PATH=~/.ssh/id_rsa
opnsense-mcp-server
Add to your Claude Desktop configuration (claude_desktop_config.json
):
{
"mcpServers": {
"opnsense": {
"command": "npx",
"args": ["opnsense-mcp-server"],
"env": {
"OPNSENSE_HOST": "https://your-opnsense:port",
"OPNSENSE_API_KEY": "your-key",
"OPNSENSE_API_SECRET": "your-secret",
"OPNSENSE_VERIFY_SSL": "false"
}
}
}
}
// Automatically fix DMZ to LAN routing
await mcp.call('nat_fix_dmz', {
dmzNetwork: '10.0.6.0/24',
lanNetwork: '10.0.0.0/24'
});
// Allow NFS from DMZ to NAS
await mcp.call('firewall_create_rule', {
action: 'pass',
interface: 'opt8',
source: '10.0.6.0/24',
destination: '10.0.0.14/32',
protocol: 'tcp',
destination_port: '2049',
description: 'Allow NFS from DMZ'
});
// Run comprehensive routing diagnostics
await mcp.call('routing_diagnostics', {
sourceNetwork: '10.0.6.0/24',
destNetwork: '10.0.0.0/24'
});
// Run any OPNsense CLI command
await mcp.call('system_execute_command', {
command: 'pfctl -s state | grep 10.0.6'
});
The server provides 50+ MCP tools organized by category:
firewall_list_rules
- List all firewall rulesfirewall_create_rule
- Create a new rulefirewall_update_rule
- Update existing rulefirewall_delete_rule
- Delete a rulefirewall_apply_changes
- Apply pending changesnat_list_outbound
- List outbound NAT rulesnat_set_mode
- Set NAT modenat_create_outbound_rule
- Create NAT rulenat_fix_dmz
- Fix DMZ NAT issuesnat_analyze_config
- Analyze NAT configurationarp_list
- List ARP table entriesrouting_diagnostics
- Diagnose routing issuesrouting_fix_all
- Auto-fix routing problemsinterface_list
- List network interfacesvlan_create
- Create VLANsystem_execute_command
- Execute CLI commandbackup_create
- Create configuration backupservice_restart
- Restart a serviceFor a complete list, see docs/api/mcp-tools.md.
The repository includes comprehensive testing utilities:
# Test NAT functionality
npx tsx scripts/test/test-nat-ssh.ts
# Test firewall rules
npx tsx scripts/test/test-rules.ts
# Test routing diagnostics
npx tsx scripts/test/test-routing.ts
# Run all tests
npm test
git clone https://github.com/vespo92/OPNSenseMCP.git
cd OPNSenseMCP
npm install
npm run build
OPNSenseMCP/
βββ src/ # Source code
β βββ api/ # API client
β βββ resources/ # Resource implementations
β βββ index.ts # MCP server entry
βββ docs/ # Documentation
βββ scripts/ # Utility scripts
β βββ test/ # Test scripts
β βββ debug/ # Debug utilities
β βββ fixes/ # Fix scripts
βββ dist/ # Build output
.env
npx tsx scripts/test/test-nat-ssh.ts
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
This project is licensed under the MIT License - see the LICENSE file for details.
Version: 0.8.2 | Status: Production Ready | Last Updated: August 2025
A template for building Model Context Protocol (MCP) servers using the mcp-framework for Node.js.
Connects Blender to Claude AI via the Model Context Protocol (MCP), enabling direct interaction and control for prompt-assisted 3D modeling, scene creation, and manipulation.
A Docker Compose-based collection of MCP servers for LLM workflows, featuring centralized configuration and management scripts.
An example of deploying a remote MCP server on Cloudflare Workers without authentication.
A Go tool for converting OpenAPI specifications into MCP tools.
Integrates Galley's GraphQL API with MCP clients. It automatically introspects the GraphQL schema for seamless use with tools like Claude and VS Code.
An MCP server providing searchable access to multiple AI/ML SDK documentation and source code.
Integrates with Ollama to run local large language models. Requires a running Ollama instance.
Validate and visualize chess positions using FEN notation.
Fetches comprehensive information about Composer packages from Packagist, including READMEs, metadata, and search functionality.