Supports deployment of optional self-hosted cloud beacon receiver for remote pfSense status monitoring and command relay.
Enables email-based emergency command interface and notification delivery through SMTP, allowing remote control when network access is limited.
Required runtime environment for the MCP server component that runs on the workstation to communicate with pfSense.
Package manager used for installing the pfclaude-mcp client component.
Provides tools for monitoring OpenVPN connection status and managing VPN clients through pfSense.
Comprehensive control of pfSense router through MCP tools covering system management, firewall rules, NAT configuration, DHCP/DNS services, VPN status, routing, traffic analysis, and diagnostics with bidirectional communication and autonomous emergency response capabilities.
Used for local pattern memory storage to track network behavior baselines, historical issues, and learned insights for autonomous decision-making.
Optional notification channel for sending critical alerts and emergency status updates from pfSense.
Provides tools for monitoring WireGuard peer connections and tunnel status through pfSense.
pfclaude
A bidirectional AI agent for pfSense. Two components, one package: an MCP server for Claude Code control, and an emergency brain that activates when your network needs help.
Status: Planning Author: Claude (claude@arktechnwa.com) + Meldrey License: MIT Organization: ArktechNWA
Why?
Your AI assistant can help configure firewalls, but it's blind to your network's health. It can't see if your WAN is down, can't check DHCP leases, can't restart a stuck interface.
Worse: when your network breaks, you lose access to your AI assistant entirely.
pfclaude solves both problems:
Normal mode: Claude Code controls pfSense via MCP — full visibility, full capability
Emergency mode: When Claude Code is unreachable, pfSense's onboard brain activates — diagnostics, notifications, autonomous recovery
Philosophy
Maximum capability — Expose everything pfSense can do
User controls exposure — Checkbox permissions, not hardcoded limits
Maximum availability — Multiple transport channels, graceful fallbacks
Lightweight emergency brain — Minimal resource usage, adaptive monitoring
Bidirectional communication — Email commands work even when network is broken
Architecture
Authentication
API Authentication
Simple, proven security:
API key transmitted in header:
X-PfClaude-Key: <key>HTTPS required (uses pfSense's existing certificate)
Optional IP whitelist (only accept from known Claude IPs)
Rate limiting: 100 requests/min default
Failed auth lockout: 5 failures → 15 min ban
Email Authentication
For inbound email commands:
Sender must be in whitelist
PIN must match configured value
Timestamp validation (reject if >5min old)
Rate limit: 10 commands/hour
Trigger Conditions
Tiered detection with configurable thresholds:
Tier 1: Monitoring (always on, ultra-light)
Check | Description | Default |
Interface link state | Is the physical link up? | ✓ |
Heartbeat reception | Has Claude Code checked in? | ✓ |
Gateway reachability | Can we ping default gateway? | ✓ |
WAN connectivity | Can we reach external IPs? | ✓ |
Tier 2: Concern (triggers increased monitoring)
Check | Description | Default |
Packet loss > 10% | Network degraded | ✓ |
Latency spike > 3x | Something's congested | ✓ |
DNS resolution failing | Name lookups broken | ✓ |
DHCP not responding | Clients can't get IPs | ✓ |
Unusual traffic volume | 5x normal (attack? loop?) | ✓ |
Tier 3: Emergency (activates autonomous response)
Check | Description | Default |
LAN interface down | Physical link lost | ✓ |
N consecutive heartbeat misses | Default: 3 | ✓ |
Gateway unreachable for N seconds | Default: 60 | ✓ |
WAN up but LAN unreachable | Asymmetric failure | ✓ |
All monitored hosts unreachable | Total LAN failure | ✓ |
Health Check Design
Lightweight, adaptive, CPU-aware:
Autonomous Actions
User configures what pfClaude can do WITHOUT asking:
Always Safe (default: enabled)
Action | Description |
Log events locally | Always on |
Send email notification | Alert user |
Update cloud beacon status | External visibility |
Capture diagnostic snapshot | Preserve state |
Diagnostic (default: enabled)
Action | Description |
Run connectivity tests | ping, traceroute |
Capture interface statistics | Counters, errors |
Gather recent log entries | Context for diagnosis |
Check service status | What's running/stopped |
Query ARP/NDP tables | Who's on the network |
Restorative (default: disabled)
Action | Description |
Restart specific interface | Often fixes link issues |
Flush connection state table | Clears stuck connections |
Restart DHCP service | Fixes lease issues |
Restart DNS resolver | Fixes resolution issues |
Clear ARP cache | Fixes stale entries |
Restart specific service | Configurable list |
Failover (default: disabled)
Action | Description |
Switch to backup WAN gateway | Major network change |
Enable/disable interface | Significant impact |
Apply emergency ruleset | Pre-configured safe rules |
Trigger CARP failover | HA environments |
Defensive (default: disabled)
Action | Description |
Block IPs exceeding threshold | Anti-DoS |
Enable emergency rate limiting | Protect resources |
Activate lockdown ruleset | Maximum security |
Disable non-essential services | Reduce attack surface |
Local Intelligence
Pattern Memory
Stores: "Last time X happened, Y was the cause"
Learns: "Interface restart fixed this 3/4 times"
Tracks: Normal baselines (traffic, latency, errors)
SQLite DB, <10MB footprint
Haiku Batch Analysis (optional)
Nightly batch: Send sanitized logs to Anthropic
Haiku analyzes patterns, anomalies, recommendations
Results stored locally as "learned insights"
Cost: ~$0.01/day for typical home network
Notification Channels
User configures their own escalation paths:
Escalation Levels
Level | Actions |
INFO | Log only |
NOTICE | Log + cloud beacon |
WARNING | Log + cloud + email |
CRITICAL | Log + cloud + email + push + webhook |
EMERGENCY | ALL channels + repeated alerts until ack'd |
Email Commands
When WAN works but LAN doesn't, email becomes the control channel:
Command Format
Available Commands
Command | Description |
| Current state summary |
| What changed in last N minutes |
| Last N log lines |
| Run full diagnostic suite |
| Restart interface (if permitted) |
| List available commands |
Example Response
Cloud Beacon (optional)
For checking router status from anywhere:
Self-Hosted Option
Docker image provided for running your own beacon receiver:
Features:
Receives status beacons from pfSense
Stores recent logs (configurable retention)
Web dashboard for status checks
Can relay commands back to pfSense
Beacon Protocol
Payload: <2KB, designed for minimal bandwidth.
MCP Tools
EVERYTHING pfSense can do, exposed via MCP:
System
Tool | Description | Permission |
| Hostname, version, uptime, resources | read |
| Overall health summary | read |
| Reboot pfSense | dangerous |
| Shutdown pfSense | dangerous |
| Export config XML | read |
Interfaces
Tool | Description | Permission |
| All interfaces with status | read |
| Detailed status for one | read |
| Traffic counters, errors | read |
| Restart interface | service |
| Enable interface | config |
| Disable interface | config |
Firewall
Tool | Description | Permission |
| List rules (filter, nat, etc) | read |
| Add rule | config |
| Delete rule | config |
| Modify rule | config |
| Connection state table | read |
| Clear state table | service |
| Manage aliases | config |
NAT
Tool | Description | Permission |
| Port forwards, outbound NAT | read |
| Add NAT rule | config |
| Delete NAT rule | config |
| Modify NAT rule | config |
DHCP
Tool | Description | Permission |
| Current leases | read |
| Reserved IPs | read |
| DHCP server config | config |
| Restart DHCP | service |
DNS
Tool | Description | Permission |
| Unbound config | config |
| dnsmasq config | config |
| Add host override | config |
| Delete host override | config |
| Restart DNS | service |
VPN
Tool | Description | Permission |
| OpenVPN connections | read |
| IPsec SAs | read |
| WireGuard peers | read |
| Disconnect client/tunnel | service |
Routing
Tool | Description | Permission |
| Routing table | read |
| Static routes | config |
| Gateway health | read |
| Switch default gateway | config |
Traffic
Tool | Description | Permission |
| Bandwidth graphs data | read |
| Interface totals | read |
| Top talkers | read |
Logs
Tool | Description | Permission |
| System logs | read |
| Firewall logs | read |
| DHCP logs | read |
| VPN logs | read |
| Search across all logs | read |
Packages
Tool | Description | Permission |
| Installed packages | read |
| Available packages | read |
| Install package | dangerous |
| Remove package | dangerous |
Services
Tool | Description | Permission |
| All services status | read |
| Start service | service |
| Stop service | service |
| Restart service | service |
Diagnostics
Tool | Description | Permission |
| Ping from pfSense | read |
| Traceroute from pfSense | read |
| DNS lookup from pfSense | read |
| ARP table | read |
| IPv6 neighbor table | read |
| Open sockets | read |
| Real-time state table | read |
Permission Matrix
Granular control via pfSense WebGUI:
Permission Levels
Level | Description |
| View status, logs, configuration |
| Restart services, flush caches |
| Modify configuration |
| Reboot, shutdown, package management |
WebGUI Configuration
Storage & Hygiene
Installation
pfSense Package
Or manual:
MCP Server (Claude Code side)
Claude Code Integration
Requirements
pfSense Side
pfSense 2.7+ or pfSense Plus 23.09+
50MB free storage
Network connectivity (obviously)
Claude Code Side
Node.js 18+
Network access to pfSense
Optional
Anthropic API key (for Haiku batch analysis)
SMTP server (for email notifications)
Self-hosted beacon server (for cloud status)
Security Considerations
API key authentication — No unauthenticated access
HTTPS required — Encrypted transport
IP whitelist — Restrict to known Claude IPs
Rate limiting — Prevent brute force
Email PIN — Authenticate inbound commands
Permission matrix — User controls exposure
Audit logging — All actions logged
No default dangerous permissions — User must enable
Credits
Created by Claude (claude@arktechnwa.com) in collaboration with Meldrey. Part of the ArktechNWA MCP Toolshed.
Built because your firewall should be able to call for help when it needs it.