pfSense MCP Server
Supports containerized deployment for easy installation and management of the MCP server.
Enables natural language control of pfSense firewalls with multiple access levels for monitoring, security rule modification, system administration, compliance auditing, and emergency response.
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., "@pfSense MCP Servershow me the current firewall rules"
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.
pfSense MCP Server
Manage your pfSense firewall with natural language. 327 tools. 9 layers of safety. One command to start.
You: "Block all traffic from 203.0.113.5 on WAN"
Claude: Creates block rule → applies changes → confirms with rollback instructionspfSense MCP Server connects Claude Desktop, Claude Code, and other MCP-compatible AI clients to your pfSense firewall. Ask questions, diagnose issues, and manage your firewall — all through conversation.
Why This Exists
Managing a pfSense firewall means clicking through web UI tabs, remembering field names, and hoping you don't fat-finger a rule that locks you out. With this MCP server, you describe what you want in plain English and the AI handles the REST API calls, validates inputs, and warns you before anything destructive happens.
What makes it different:
Every destructive operation requires explicit confirmation and shows you exactly what will happen
Automatic config backup before every delete/reboot — with a one-line rollback command
Rate limiting prevents runaway AI loops from flooding your firewall with rules
Input sanitization blocks command injection, path traversal, and XSS in every parameter
Related MCP server: MCP Server UniFi
Quick Start
Prerequisites: Python 3.10+, pfSense with REST API v2 package installed
git clone https://github.com/gensecaihq/pfsense-mcp-server.git
cd pfsense-mcp-server
pip install -r requirements.txt
cp .env.example .env
# Edit .env: set PFSENSE_URL, AUTH_METHOD, and credentialsConnect to Claude Desktop — add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"pfsense": {
"command": "python3",
"args": ["-m", "src.main"],
"cwd": "/path/to/pfsense-mcp-server",
"env": {
"PFSENSE_URL": "https://192.168.1.1",
"AUTH_METHOD": "basic",
"PFSENSE_USERNAME": "admin",
"PFSENSE_PASSWORD": "your-password",
"PFSENSE_VERSION": "CE_2_8_0",
"VERIFY_SSL": "false"
}
}
}
}Start talking to your firewall. Open Claude Desktop and ask:
"Show me all blocked traffic in the last hour"
"What services are running?"
"Create a port forward for port 443 to 192.168.1.50"
"Run a full system health check"
What You Can Do
327 tools across every major pfSense subsystem:
Domain | Tools | What You Can Do |
Firewall Rules | 9 | Create, update, delete, reorder rules. Bulk block IPs. View compiled pf ruleset. |
Aliases | 5 | Manage host/network/port/URL aliases. Add and remove addresses. |
NAT | 16 | Port forwards, outbound NAT, 1:1 NAT — full lifecycle management. |
VPN | 51 | OpenVPN servers and clients, IPsec tunnels, WireGuard peers — CRUD, status, apply. |
Routing | 16 | Gateways, gateway groups, static routes, default gateway management. |
DNS | 24 | Unbound resolver and dnsmasq forwarder: host overrides, domain overrides, access lists. |
DHCP | 17 | Leases, static mappings, address pools, custom options, server config. |
Certificates | 15 | Certs, CAs, CRLs — generate, renew, export PKCS12. |
Users | 12 | User accounts, groups, LDAP/RADIUS auth server config. |
Interfaces | 14 | Interface config, VLANs, bridges, groups. |
System | 44 | Status, settings, diagnostics, config history, reboot, ping. |
Services | 14 | Start/stop/restart services. NTP, cron, SSH, service watchdog. |
Logs | 3 | Firewall log analysis with parsed IPv4/IPv6 filterlog data. |
Traffic Shaping | 12 | Shapers, queues, and limiters for bandwidth management. |
Schedules | 8 | Time-based firewall rule scheduling. |
Virtual IPs | 5 | CARP, ProxyARP, and IP Alias management. |
Troubleshooting | 10 | Diagnose connectivity, blocked traffic, VPN, DHCP, DNS, HA. Full health report. |
Packages | 43 | HAProxy, ACME/Let's Encrypt, BIND DNS, FreeRADIUS. |
Utility | 9 | HATEOAS navigation, object ID management, guardrail status. |
Safety First
AI managing a production firewall needs guardrails. This server has 9 layers:
"Delete firewall rule 5"
1. CLASSIFY → HIGH risk (destructive)
2. ALLOWLIST → tool is permitted
3. SANITIZE → parameters clean (no injection)
4. RATE LIMIT → under 10 deletes/minute
5. DRY RUN? → user can preview first
6. CONFIRM → blocked until confirm=True
7. BACKUP → config revision captured
8. EXECUTE → API call made
9. AUDIT LOG → action recorded with redacted params
Response includes:
"config_backup": {
"pre_change_revision_id": 42,
"rollback_instruction": "restore_config_backup(revision_id=42, confirm=True)"
}Every destructive operation (52 delete/reboot/halt tools) requires confirm=True. Every create and update operation (112 tools) is rate-limited and sanitized. Every sensitive parameter (passwords, keys, tokens) is redacted in logs and outputs.
You can also:
Pass
dry_run=Trueto preview any destructive operation without executingPass
verify_descr="Allow HTTPS"to verify you're deleting the right rule (guards against ID shifts)Set
MCP_READ_ONLY=trueto expose only 118 read-only tools (search, get, diagnose)Set
MCP_ALLOWED_TOOLS=search_firewall_rules,get_firewall_logto restrict to specific tools
Supported pfSense Versions
Version | REST API | Status |
pfSense CE 2.8.1 | Verified | |
pfSense Plus 25.11 | Verified | |
pfSense CE 2.8.0 | v2.6.0+ | Supported |
pfSense Plus 24.11 | v2.6.0+ | Supported |
Requires the pfSense REST API v2 package by jaredhendrickson13.
Authentication
Three methods supported (configure in .env):
Method | Config | Best For |
Basic Auth |
| Quick setup, local users |
API Key |
| Automation, service accounts |
JWT |
| Short-lived tokens, auto-refresh |
Deployment Options
stdio (default) — for Claude Desktop and Claude Code:
python3 -m src.mainHTTP — for remote access and multi-client setups:
python3 -m src.main -t streamable-http --port 3000Docker — hardened container with read-only filesystem:
docker compose upContainer security: non-root user (mcp:1000), read-only filesystem, all capabilities dropped, noexec tmpfs, no-new-privileges.
Configuration
Variable | Required | Default | Description |
| Yes | — | pfSense URL (e.g., |
|
|
| |
| * | — | REST API key |
| * | — | pfSense username (for basic/jwt) |
| * | — | pfSense password (for basic/jwt) |
|
|
| |
|
|
| |
|
| Request timeout in seconds | |
|
| Only expose read-only tools |
Variable | Default | Description |
|
| Enable HATEOAS links in API responses |
|
|
|
|
|
|
|
| Bind address for HTTP mode |
|
| Port for HTTP mode |
| — | Bearer token for HTTP transport (required) |
| localhost | Comma-separated allowed origins |
| — | Path to audit log file (JSON lines) |
|
| Max deletes per 60 seconds |
|
| Max creates per 60 seconds |
|
| Max critical ops per 300 seconds |
| all | Comma-separated tool allowlist |
|
| Rollback entries kept in memory |
Testing
python3 -m pytest tests/ -v # 308 tests
python3 -m pytest tests/ --cov=src # with coverageMCP Specification Compliance
Compliant with MCP 2025-11-25 (latest):
ToolAnnotationson all 327 tools (readOnlyHint, destructiveHint, idempotentHint)serverInfo.versionandinstructionsprovidedOrigin header validation (MUST requirement)
Bearer token auth with timing-safe comparison
Default bind to localhost per spec SHOULD
stdio and Streamable HTTP transports
Project Structure
src/
main.py Entry point
server.py FastMCP instance + API client
client.py pfSense REST API v2 HTTP client
guardrails.py 9-layer defense-in-depth system
helpers.py Validation, parsing, safety guards
models.py Data models
middleware.py HTTP auth + Origin validation
tools/ 34 tool modules (327 tools)
tests/ 308 testsContributing
We need real-world testing across diverse pfSense environments. See CONTRIBUTING or:
Fork and create a feature branch
Run
python3 -m pytest tests/ -vSubmit a PR
Ideas: integration tests against real pfSense, additional package support (Snort, Suricata), Ollama local LLM bridge, multi-instance management.
License
Acknowledgments
jaredhendrickson13 / pfrest — pfSense REST API v2 package
JeremiahChurch — modular rewrite (PR #5)
shawnpetersen — API v2 endpoint discovery (PR #3)
Netgate — pfSense
FastMCP — MCP framework
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.
Latest Blog Posts
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/gensecaihq/pfsense-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server