pfSense MCP Server
Integrates ACME/Let's Encrypt certificate management on pfSense, supporting generation, renewal, and export of certificates.
Enables management of OpenVPN servers and clients on pfSense, including CRUD operations, status monitoring, and applying configuration changes.
Provides comprehensive management of a pfSense firewall through 332 tools covering firewall rules, NAT, VPN, routing, DNS, DHCP, certificates, users, interfaces, system settings, services, logs, traffic shaping, schedules, virtual IPs, troubleshooting, and packages. Enables creating, updating, deleting, and reordering firewall rules, managing aliases, configuring port forwards and outbound NAT, handling VPN connections, and running diagnostics—all with safety guardrails and rollback support.
Allows creation, update, and deletion of WireGuard peers on pfSense, along with viewing client configuration for import.
Click on "Deploy 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 ServerBlock all traffic from 203.0.113.5 on WAN"
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.
332 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 point: config revision 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. Every destructive action needs explicit confirmation, and the server records the config revision it can be rolled back to.
Letting an AI change a production firewall is only safe if the details are right, and that's where the work went:
A contract-test layer checks every tool's request format against the pfSense REST API schema.
Every change goes through a multi-layer guardrail pipeline.
CI runs 661 tests on Python 3.11–3.13, plus an end-to-end MCP protocol test.
Latest release: v1.1.0 · Changelog
Jump to theQuick Start. Setup takes about two minutes with uvx, and you don't need to clone anything. If this project is useful to you, a ⭐ helps others find it.
Contents
Why this exists · Quick start · What you can do · Safety · Supported versions · Authentication · Deployment · Configuration · Testing · MCP compliance · Known limitations · Architecture · Contributing
Related MCP server: pfSense Enhanced 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
The config revision is captured before every high-risk change. The response gives the revision ID to restore from Diagnostics › Backup & Restore › Config History in the webGUI, or warns explicitly if no revision could be captured.
Rate limits on every tool that changes configuration stop a runaway AI loop 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.2 schema by a contract-test layer, so tools send exactly what the API expects
Quick Start
Prerequisites:
Python 3.11 or later.
pfSense with the REST API v2 package installed. See Supported pfSense versions.
For Option A, uv.
This project isnot published on PyPI. A different, unrelated project uses the PyPI name pfsense-mcp-server, so never run pip install pfsense-mcp-server. Install from Git or from the release assets as shown below.
Option A: run without cloning (uvx):
uvx --from git+https://github.com/gensecaihq/pfsense-mcp-server@v1.1.0 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 the server to claude_desktop_config.json:
macOS:
~/Library/Application Support/Claude/Windows:
%APPDATA%\Claude\
Using the installed entry point (Option A):
{
"mcpServers": {
"pfsense": {
"command": "uvx",
"args": ["--from", "git+https://github.com/gensecaihq/pfsense-mcp-server@v1.1.0", "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",
"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"
}
}
}
}Remove PFSENSE_CA_FILE if your pfSense certificate is signed by a public CA.
About the 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
332 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 | 23 | 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 | 43 | Status, settings, diagnostics, state table, config history, reboot, ping. |
Services | 14 | Start/stop/restart services. NTP, cron, SSH, service watchdog. |
Logs | 4 | Firewall log analysis with parsed IPv4/IPv6 filterlog data. Raw tail/grep reads of the dhcpd/filter/resolver/system/auth log files. |
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": "To undo this change, restore revision 42 manually in the pfSense webGUI: Diagnostics > Backup & Restore > Config History."
}All 201 tools that change configuration carry a guardrail, and a test fails the build if a new one ships without it.
Every change tool is rate-limited, audit-logged and checked against the allowlist.
High-risk tools (51): deletes, disconnects, reboot, halt and bulk block are also blocked until the caller passes
confirm=True.manage_*tools: these requireconfirm=Truefor their remove and delete actions.Secrets: passwords, keys, PSKs, bind passwords and tokens are redacted in the audit log and in echoed API error responses.
confirm=True is a parameter the MCP client sends. It is not a separate human-approval step, so keep your client's tool-approval prompts on for destructive tools.
You can also:
Pass
dry_run=Trueto preview any destructive operation without running it.Pass
verify_descr="Allow HTTPS"to check that you're changing or deleting the rule you expect. This guards against rule IDs shifting.Set
MCP_READ_ONLY=trueto expose only the 131 read-only tools (search, get, diagnose).Set
MCP_ALLOWED_TOOLS=create_firewall_rule_advanced,delete_firewall_ruleto permit only the listed write tools. Read tools stay available.
See SECURITY.md for the vulnerability-disclosure policy and deployment-hardening guidance.
Supported pfSense Versions
Version | REST API package | Status |
pfSense CE 2.9.0 | v2.10.2 (latest) | Supported |
pfSense CE 2.8.1 | v2.10.2 (latest) | Verified |
pfSense Plus 26.07 | v2.10.2 (latest) | Supported |
pfSense Plus 26.03.1 | v2.10.2 (latest) | Supported |
pfSense Plus 26.03 | v2.10.2 (latest) | Verified |
pfSense Plus 25.11.1 | v2.10.2 (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; CE 2.9.0 and Plus 26.07 need v2.10.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, obtained and renewed automatically (assumes pfSense's default 1-hour lifetime) |
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. It requires MCP_API_KEY, and the server refuses to start with an empty, placeholder or short token.
export MCP_API_KEY="$(python3 -c 'import secrets; print(secrets.token_urlsafe(32))')"
python3 -m src.main -t streamable-http --port 3000The HTTP transport is plain HTTP. Put it behind a TLS-terminating reverse proxy before exposing it beyond localhost.
Docker: a hardened container running the HTTP transport.
cp .env.example .env # set PFSENSE_URL, credentials, and MCP_API_KEY
docker compose up -dThe published port binds to 127.0.0.1 by default. Set MCP_BIND_ADDR=0.0.0.0 to expose it, but only behind TLS. For a private CA, put the PEM in ./certs/ and set PFSENSE_CA_FILE=/certs/<file>.pem.
Container security:
Runs as a non-root user (
mcp:1000).Read-only filesystem, a
noexectmpfs, andno-new-privileges.All Linux capabilities dropped.
The health check probes an unauthenticated /health endpoint, because /mcp requires the 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 | |
|
| Set |
Boolean settings accept true/false, 1/0, yes/no or on/off. Any other value stops the server at startup rather than guessing, so a typo can't turn off TLS verification.
Variable | Default | Description |
|
| Enable HATEOAS links in API responses |
|
|
|
|
|
|
|
| Bind address for HTTP mode |
|
| Port for HTTP mode |
|
| Docker Compose only: host address the published port binds to |
| — | 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 settings changes ( |
|
| Max critical ops per 300 seconds |
| all | Comma-separated allowlist of write tools. Read tools are always available; |
|
| Rollback entries kept in memory |
|
|
|
Response Encoding (GCF)
By default the tools return JSON. Setting RESPONSE_FORMAT=gcf returns each eligible tool result as a single Graph Compact Format block instead: the record arrays these read tools produce (firewall rules, aliases, DHCP leases, certificates, DNS records) have their repeated field names factored into one header, cutting the token cost when the result crosses the LLM boundary. Results that are not a single JSON body — or that GCF would not shrink — stay JSON (see below).
Install the optional extra into the server's environment and set the variable:
pip install '.[gcf]' # from a clone of this repo
export RESPONSE_FORMAT=gcf
# or, with uvx (the extra must go into uvx's isolated tool environment):
RESPONSE_FORMAT=gcf uvx --with 'gcf-python[fastmcp]==2.7.1' \
--from git+https://github.com/gensecaihq/pfsense-mcp-server pfsense-mcp-serverIt is opt-in and conservative — GCF is used only when it is both smaller than the JSON and a verified lossless round-trip, otherwise the JSON is kept, so no record is ever dropped or altered. structuredContent is preserved, so output-schema validation and non-model clients keep receiving JSON. If the gcf extra is not install
This server cannot be deployed
Maintenance
Related MCP Connectors
Security-first WordPress MCP server. 129 tools for Claude, ChatGPT, Gemini. Free on wp.org.
- QuallaaOAuthcom.quallaa
Talk to your public-facing AI from any MCP client — Claude, ChatGPT, Cursor, Cline, Windsurf.
Zero-setup MCP gateway securely connecting AI to your tools with authentication and workflows
Unified MCP Server is a remote MCP connector for AI agents and vertical AI products that provides access to 22,000+ authorized SaaS tools across 400+ integrations and 24 categories directly inside LLMs (Claude, GPT, Gemini, Cohere). Tools operate only on explicitly authorized customer connections, enabling agents to safely read and write against live third-party systems.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables bidirectional control and monitoring of pfSense firewalls through Claude, with full API access for configuration and diagnostics, plus autonomous emergency response capabilities when network connectivity is lost.1MIT
- 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
- AlicenseNot gradedqualityAmaintenanceEnables AI clients to manage OPNsense firewall, interfaces, DHCP, DNS, routes, and services via natural language through 42 MCP tools.MIT
- FlicenseNot gradedqualityCmaintenanceEnables AI agents to manage and configure pfSense routers through the pfSense REST API, offering 240 tools across 17 modules with safety features like confirm gates, config backups, and read-only mode.-