pfSense MCP Server
This server provides conversational management of pfSense firewalls via AI, offering 333 tools across 18 subsystems with strong safety guardrails. It enables natural language control through MCP clients (Claude Desktop, Claude Code, etc.) and can be deployed as stdio, HTTP server, or Docker container.
Key capabilities include:
Firewall Rules: Create, update, delete, reorder, and bulk-block rules; view compiled rulesets; apply changes.
Aliases: Manage host, network, port, and URL aliases; add/remove addresses.
NAT: Configure port forwards, outbound NAT, 1:1 NAT.
VPN: Manage OpenVPN, IPsec, and WireGuard peers.
Routing: Configure gateways, gateway groups, static routes.
DNS: Manage Unbound resolver and dnsmasq forwarder; host/domain overrides; access lists.
DHCP: View leases, manage static mappings, address pools, custom options; switch backends (ISC/Kea).
Certificates: Manage certificates, CAs, CRLs; generate, import, export (PKCS#12).
Users & Groups: Manage accounts, groups, authentication servers.
Interfaces: Configure interfaces, VLANs, bridges, interface groups.
System: Run diagnostics (ping), view config history, compare revisions, restore backups, reboot/halt.
Services: Start/stop/restart services; manage NTP, cron, SSH.
Logs: Analyze firewall logs; search firewall states.
Traffic Shaping: Configure shapers, queues, limiters.
Schedules: Create/update time-based firewall schedules.
Virtual IPs: Manage CARP, ProxyARP, IP aliases.
Troubleshooting: Connectivity, VPN, DHCP, DNS, HA diagnostics.
Packages: Manage HAProxy, ACME, BIND, FreeRADIUS.
Safety & Guardrails: Destructive actions require explicit confirmation; dry-run available; auto-config backup before changes with rollback instructions; rate limiting; input validation; secret redaction. Supports read-only mode and tool allowlisting. Authenticate via Basic Auth, API Key, or JWT.
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 in plain English โ from Claude Desktop, Claude Code, or any MCP client.
333 tools across every subsystem ยท wire-format verified against the pfSense REST API ยท safety guardrails on every change
You: Block all traffic from 203.0.113.5 on WAN
Claude: โ created block rule โ โ applied changes โ rollback: restore_config_backup(revision_id=42)
You: Why can't 192.168.1.50 reach the internet?
Claude: ran diagnostics โ gateway WAN_DHCP is down, and a block rule on LAN matches this host
You: Add a WireGuard peer for my laptop and show me the config
Claude: โ created peer on tun_wg0 โ here's the client config to importpfSense MCP Server connects Claude Desktop, Claude Code, and any other MCP client to your pfSense firewall. Ask questions, diagnose issues, and change configuration through conversation โ with a confirmation gate, config backup, and rollback on every destructive action.
Letting an AI touch a production firewall is only safe if the plumbing is right, so that's where the work went: every tool's wire format is verified against the pfSense REST API schema by a contract-test layer, and every change runs through a guardrail pipeline. 572 tests plus a wire-protocol E2E suite in CI on Python 3.11โ3.13.
Jump to theQuick Start โ about two minutes with uvx, no clone required. And if this saves you a trip through the pfSense web UI, a โญ helps others find it.
Contents
Why this exists ยท Quick start ยท What you can do ยท Safety ยท Supported versions ยท Authentication ยท Deployment ยท Configuration ยท Testing ยท MCP compliance ยท Architecture ยท Contributing
Related MCP server: Firewalla MCP Server
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
Config backup before every delete/reboot โ with a one-line rollback command (and an explicit warning if a backup point can't be captured)
Rate limiting on every mutating tool prevents runaway AI loops from flooding your firewall
Positive input validation (IP/port/MAC/CIDR) plus path-traversal/XSS screening, and secrets redacted from logs and API error responses
Wire-format verified against the pfSense REST API v2.10.0 schema by a contract-test layer, so tools send exactly what the API expects
Quick Start
Prerequisites: Python 3.11+, pfSense with REST API v2 package installed
Option A โ run without cloning (uvx):
uvx --from git+https://github.com/gensecaihq/pfsense-mcp-server pfsense-mcp-serverOption B โ clone for development:
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.
Using the installed entry point (Option A):
{
"mcpServers": {
"pfsense": {
"command": "uvx",
"args": ["--from", "git+https://github.com/gensecaihq/pfsense-mcp-server", "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_1",
"PFSENSE_CA_FILE": "/path/to/pfsense-ca.pem"
}
}
}
}Or running from a clone (Option B):
{
"mcpServers": {
"pfsense": {
"command": "python3.11",
"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_1",
"PFSENSE_CA_FILE": "/path/to/pfsense-ca.pem"
}
}
}
}About that CA file. pfSense ships with a self-signed certificate from its own
CA, and Python does not read your OS trust store โ so verification fails out of
the box. Export the CA at System > Cert. Manager > CAs (the export-certificate
icon), save the PEM anywhere readable, and point PFSENSE_CA_FILE at it. A
missing or unparseable file is a startup error, never a silent downgrade.
VERIFY_SSL=false also connects, and is fine for a throwaway lab. Understand what
it costs: nothing authenticates the firewall, so anything that can intercept the
connection can read the API key and act as the firewall. This tool changes
firewall rules โ treat that credential accordingly.
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
333 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, state table, 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 | 49 | 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 one of the 202 mutating tools carries a guardrail, enforced at registration by a meta-test so a new tool can't ship ungated: the 52 destructive (delete/reboot/halt) tools require confirm=True, and the other 150 (create/update/apply/manage/export/service-control) are rate-limited, audited, and allowlist-checked. Sensitive parameters (passwords, keys, PSKs, bind passwords, tokens) are redacted in the audit log and in echoed API error responses.
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 the 131 read-only tools (search, get, diagnose)Set
MCP_ALLOWED_TOOLS=search_firewall_rules,get_firewall_logto restrict to specific tools
See SECURITY.md for the vulnerability-disclosure policy and deployment-hardening guidance.
Supported pfSense Versions
Version | REST API package | Status |
pfSense CE 2.8.1 | v2.10.0 (latest) | Verified |
pfSense Plus 26.03.1 | v2.10.0 (latest) | Supported |
pfSense Plus 26.03 | v2.10.0 (latest) | Verified |
pfSense Plus 25.11.1 | v2.10.0 (latest) | Supported |
pfSense Plus 25.11 | v2.7.3 (legacy) | Verified |
pfSense CE 2.8.0 | v2.7.3 (legacy) | Supported |
pfSense Plus 24.11 | v2.7.3 (legacy) | Supported |
Requires the pfSense REST API v2 package by jaredhendrickson13. Package v2.8.x+ ships builds only for CE 2.8.1 and Plus 25.11.1/26.03/26.03.1; v2.7.3 is the last release with builds for CE 2.8.0 and Plus 24.11/25.11.
Security note: run REST API package v2.10.0+. It fixes a command-injection flaw in the interface-group endpoints (GHSA-w3w4-mvcc-vmgr) and adds core command auto-escaping; v2.9.0 fixed an earlier settings-sync privilege escalation (GHSA-8q8g-9f77-8g8g).
v2.10.0 also marks
OpenVPNClient.auth_pass,User.ipsecpsk, andWireGuardPeer.presharedkeyas sensitive, so the API no longer returns them by default. This server still sets them normally; if a workflow needs to read one back, add a sensitive-field override in the REST API settings.
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.main # from a clone
pfsense-mcp-server # via the installed console entry point (pip/uvx/pipx)HTTP โ 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. In HTTP mode the container health check probes an unauthenticated /health endpoint (the /mcp endpoint requires a bearer token).
Behind an MCP gateway โ the HTTP transport is a spec-compliant Streamable
HTTP endpoint with bearer-token auth, so it can be registered as an MCP-server
target behind managed gateways such as
AWS Bedrock AgentCore Gateway
(use its API-key credential provider to supply the MCP_API_KEY bearer token,
and add the gateway's origin to MCP_ALLOWED_ORIGINS). Such gateways add
centralized OAuth/IAM in front and translate between protocol revisions,
including 2026-07-28. No gateway is required โ this is purely an option for
environments that already run one.
Configuration
Variable | Required | Default | Description |
| Yes | โ | pfSense URL (e.g., |
|
|
| |
| * | โ | REST API key |
| * | โ | pfSense username (for basic/jwt) |
| * | โ | pfSense password (for basic/jwt) |
|
| Current: | |
|
|
| |
| โ | PEM file for pfSense's private/self-signed CA, so verification stays on | |
|
| 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 # 572 tests
python3 -m pytest tests/ --cov=src # with coverage (~48%)The suite includes a wire-contract layer (tests/contract/) that asserts every tool's payload against the real pfSense REST API v2.10.0 schema (distilled from the upstream OpenAPI spec), so a wrong field name or type is a failing test rather than a silent misconfiguration. CI runs on Python 3.11/3.12/3.13 with pip-audit dependency scanning.
On top of the in-process suite, an end-to-end protocol smoke test drives the server over the real MCP wire protocol with the official MCP Inspector CLI โ on both transports, in CI on every push:
make test-e2e # or: ./scripts/inspector_smoke.sh (needs node/npx, jq)It verifies the initialize handshake, the 333-tool listing with annotations, the guardrail confirm-gate over the wire, read-only mode, and HTTP bearer-auth plus Origin enforcement โ no pfSense instance required.
MCP Specification Compliance
Compliant with MCP 2025-11-25 โ the newest revision with stable SDK support โ and negotiates down to older revisions per connection, so existing clients keep working:
ToolAnnotationson all 333 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
The stateless 2026-07-28 revision
The newest revision, MCP 2026-07-28 (published 28 July 2026), is the protocol's largest overhaul yet: it removes the initialize handshake and protocol-level sessions entirely โ every request is self-contained, so remote MCP servers become ordinary stateless HTTPS endpoints โ and adds an official extensions system, tighter OAuth 2.0/OIDC alignment, and a formal feature-lifecycle policy with a minimum twelve-month deprecation window.
SDK support ships in fastmcp 4, currently in beta. This codebase is verified ready: the full test suite and the MCP Inspector wire-protocol smoke test pass on the fastmcp 4 beta (4.0.0b2 / mcp SDK 2.0, checked continuously by a non-blocking CI job), the server holds no session state by design, and it uses none of the features 2026-07-28 deprecates (Roots, Sampling, MCP Logging). Adopting the stateless protocol when fastmcp 4 is stable is a dependency-pin change; fastmcp 4 servers negotiate the protocol era per connection, keeping today's handshake-era clients fully supported.
Project Structure
src/
main.py Entry point (transports, read-only filter, key validation)
server.py FastMCP instance + API client
client.py pfSense REST API v2 HTTP client (retry/backoff, pooling)
guardrails.py Risk classification, confirm gate, rate limit, audit, redaction
helpers.py Validation, parsing, pagination, safety guards
models.py Data models
middleware.py HTTP bearer auth + Origin validation + /health
tools/ 34 tool modules (333 tools)
scripts/
generate_contract.py Regenerate the wire contract from an OpenAPI spec
generate_token.py Generate a secure MCP_API_KEY bearer token
inspector_smoke.sh End-to-end MCP protocol smoke test (MCP Inspector CLI)
tests/ 572 tests (incl. tests/contract/ wire-contract suite)See ARCHITECTURE.md for the request lifecycle, guardrail model, and wire-contract layer; SECURITY.md for disclosure and hardening; and RELEASE_AUDIT.md for the audit and roadmap.
Contributing
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), log endpoint OOM safeguards (PR #6)
shawnpetersen โ API v2 endpoint discovery (PR #3)
aemitic โ DELETE-body fix (PR #9), firewall
ipprotocolfor IPv6/dual-stack (PR #10),logconfigchanges(PR #11)pbhorjee โ live-status diagnostics fix (PR #21), firewall-log freshness + exact-IP filtering (PR #23)
hossamnagy โ resilient startup on transient preflight failure (PR #14)
bill-mccormick-dg โ independent DELETE-body fix (PR #16)
w1ld3r โ DELETE and remote-syslog bug reports (#12, #13)
tvlc โ WebGUI port type-mismatch report (#7)
renanwilliam โ uvx/pipx packaging request (#8)
Netgate โ pfSense
FastMCP โ MCP framework
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
- AlicenseCqualityBmaintenanceA server that enables managing OPNSense firewalls through natural language interactions with Claude Desktop, supporting VLAN management, firewall rules configuration, and network interface queries.6414875MIT
- -licenseNot gradedqualityNot gradedmaintenanceA production-ready server that connects Claude Desktop to Firewalla network management capabilities, allowing users to monitor devices, analyze network traffic, manage security alerts, and configure firewall rules through natural language.
- AlicenseNot gradedqualityDmaintenanceEnables natural language interaction and management of pfSense firewalls through Claude and other GenAI applications using the Model Context Protocol. It provides advanced tools for firewall rule configuration, interface management, and intelligent log analysis via a REST API integration.1MIT
- AlicenseCqualityCmaintenanceAn AI-powered penetration testing server that integrates over 30 security tools with Groq LLM analysis for automated vulnerability scanning, triage, and reporting. It enables users to perform comprehensive security assessments through natural language natively within Claude Desktop.29MIT
Related MCP Connectors
Security-first WordPress MCP server. 129 tools for Claude, ChatGPT, Gemini. Free on wp.org.
GibsonAI MCP server: manage your databases with natural language
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
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/gensecaihq/pfsense-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server