Initial pfsense-mcp: REST API v2 based MCP server (72 tools)

This commit is contained in:
root
2026-06-12 18:59:15 +00:00
commit ee6c626a80
22 changed files with 1438 additions and 0 deletions

28
src/pfsense_mcp/config.py Normal file
View File

@@ -0,0 +1,28 @@
"""Configuration loaded from environment variables."""
from __future__ import annotations
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
model_config = SettingsConfigDict(env_prefix="PFSENSE_", extra="ignore")
url: str = "https://192.168.1.1"
# REST API v2 key (preferred). Generate in pfSense: System → REST API → Keys.
api_key: str = ""
# Fallback: local user basic auth (requires auth_methods to include BasicAuth).
username: str = ""
password: str = ""
verify_ssl: bool = False
timeout: float = 60.0
# Safety controls
allow_writes: bool = False
dry_run: bool = False
require_description_prefix: str = "mcp:"
block_wan_inbound_any: bool = True
audit_log_path: str = "/root/.hermes/logs/pfsense-mcp-audit.jsonl"
settings = Settings()