Sophos Firewall MCP Server

Sophos Firewall MCP Server

An asynchronous MCP server for Sophos Firewall, enabling AI assistants to manage, audit, and troubleshoot network security infrastructure.

Category
访问服务器

README

Sophos Firewall MCP Server (sophos-firewall-mcp)

Docker Image License Python Version TDQS Score

An asynchronous Model Context Protocol (MCP) server for Sophos Firewall (SFOS), enabling AI assistants (such as Antigravity IDE, Claude Desktop, VS Code, and Cursor) to manage, audit, and troubleshoot Sophos Firewall network security infrastructure.


🌟 Key Features

  • Async XML API Integration: Built on httpx.AsyncClient for high-throughput, non-blocking IO with Sophos SFOS XML API endpoints (/webconsole/APIController).
  • 7 Comprehensive Tool Domains (28 Tools):
    • System & Status: System version, serial number, uptime, service operational state, and network interface configurations.
    • Firewall Rules: Security policies listing, creation, status toggling, and rule deletion.
    • Host & Network Objects: IP host definitions, network subnets, IP host groups, and FQDN objects.
    • Services: Custom TCP/UDP service objects, port ranges, and service groups.
    • NAT Rules: SNAT and DNAT port-forwarding rule inspection.
    • User Management: Local user account configuration and live user session monitoring.
    • VPN Management: IPsec site-to-site tunnels and SSL VPN remote access policies.
  • FastMCP Resources: Read-only system state via URIs (sophos://system/info, sophos://interfaces, sophos://services/status).
  • Guided Prompts: Contextual security audits (audit_firewall_rules) and traffic troubleshooting (troubleshoot_connectivity).
  • Semantic Tool Router: FastEmbed text embedding router for intelligent tool selection (USE_ROUTER=true).
  • Tier A+ Quality Score: 100% parameter descriptions, full ToolAnnotations safety metadata, and 100% test coverage.

🏆 Tool Definition Quality Score (TDQS)

This server is audited against the Tool Definition Quality Score (TDQS) framework to guarantee optimal function calling, type safety, and runtime safety for LLMs.

---------------- SCORECARD METRICS ----------------
Tools Evaluated              : 39
Behavioral Annotations      : 39 / 39 (100.0%)
100% Parameter Descriptions : 39 / 39 (100.0%)
Usage Guidelines (Docstrings): 39 / 39 (100.0%)
Overall TDQS Score           : 5.00 / 5.00
TDQS Quality Tier            : Tier A+
========================================================
  • Behavioral Annotations (ToolAnnotations): 100% of tools specify readOnlyHint, destructiveHint, and idempotentHint metadata.
  • Parameter Descriptions (Annotated[..., Field(...)]): Every parameter includes explicit typing and human-readable descriptions.
  • Usage Guidelines: Standardized docstrings detailing exact trigger conditions ("Use when...").

⚙️ Sophos Firewall API Prerequisites

Before connecting sophos-firewall-mcp to your Sophos Firewall (SFOS) appliance, ensure the XML API is enabled and your client IP is whitelisted:

  1. Log in to Web Admin Console: Open https://<SOPHOS_HOST>:4444 in your browser.
  2. Enable API Access:
    • Navigate to System > Administration > API Access (or API Configuration).
    • Check the API Configuration toggle/checkbox to enable the API service.
  3. Whitelist Client IP Address:
    • Under Allowed IP Addresses, click Add and specify the IP address of the machine or container host running sophos-firewall-mcp.
    • Note: Sophos Firewall rejects API requests from any IP address not explicitly added to this whitelist.
  4. Administrator Account:
    • Ensure the configured user account (SOPHOS_USERNAME) has active administrator privileges.

🔧 Environment Variables

Variable Description Default
SOPHOS_HOST Sophos Firewall IP address or FQDN 172.16.16.16
SOPHOS_PORT Web Console API port 4444
SOPHOS_USERNAME API Administrator Username admin
SOPHOS_PASSWORD API Administrator Password (Required)
SOPHOS_API_VERSION Sophos XML API Version (e.g., 2200.1 for SFOS v22) 2200.1
SOPHOS_VERIFY_SSL Verify SSL/TLS certificates (set false for self-signed certs) false
SOPHOS_TIMEOUT API request timeout in seconds 30.0
USE_ROUTER Set true to enable FastEmbed semantic tool routing false

🛠 Client Integration

Add the configuration snippet matching your environment to your MCP settings file (e.g. .vscode/mcp.json or mcp_config.json in Antigravity IDE, Claude Desktop, or VS Code).

Option 1: Docker / Podman Drop-in Container Deployment

Podman is fully supported as a rootless drop-in replacement for Docker on Fedora/RHEL/Linux:

{
  "mcpServers": {
    "sophos-firewall": {
      "command": "podman",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e", "SOPHOS_HOST",
        "-e", "SOPHOS_PORT",
        "-e", "SOPHOS_USERNAME",
        "-e", "SOPHOS_PASSWORD",
        "-e", "SOPHOS_API_VERSION",
        "-e", "SOPHOS_VERIFY_SSL",
        "-e", "USE_ROUTER",
        "ghcr.io/jelmervdm/sophos-firewall-mcp:latest"
      ],
      "env": {
        "SOPHOS_HOST": "172.16.16.16",
        "SOPHOS_PORT": "4444",
        "SOPHOS_USERNAME": "admin",
        "SOPHOS_PASSWORD": "your_secure_password_here",
        "SOPHOS_API_VERSION": "2200.1",
        "SOPHOS_VERIFY_SSL": "false",
        "USE_ROUTER": "false"
      }
    }
  }
}

Tip for Docker vs Podman: Replace "command": "podman" with "command": "docker" if using standard Docker. Ensure -i is retained and never use -t (TTY mode), as TTY mode injects carriage returns (\r\n) that disrupt stdio JSON-RPC protocol parsing.


Option 2: Local Python Execution (without PyPI)

Via uv (Local Workspace Directory):

{
  "mcpServers": {
    "sophos-firewall": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/sophos-firewall-mcp",
        "run",
        "sophos-firewall-mcp-server"
      ],
      "env": {
        "SOPHOS_HOST": "172.16.16.16",
        "SOPHOS_PORT": "4444",
        "SOPHOS_USERNAME": "admin",
        "SOPHOS_PASSWORD": "your_secure_password_here",
        "SOPHOS_VERIFY_SSL": "false"
      }
    }
  }
}

Via python (Editable Install pip install -e .):

{
  "mcpServers": {
    "sophos-firewall": {
      "command": "python",
      "args": ["-m", "sophos_firewall_mcp.server"],
      "env": {
        "SOPHOS_HOST": "172.16.16.16",
        "SOPHOS_PORT": "4444",
        "SOPHOS_USERNAME": "admin",
        "SOPHOS_PASSWORD": "your_secure_password_here",
        "SOPHOS_VERIFY_SSL": "false"
      }
    }
  }
}

Via uvx directly from GitHub Repository:

{
  "mcpServers": {
    "sophos-firewall": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/jelmervdm/sophos-firewall-mcp.git",
        "sophos-firewall-mcp-server"
      ],
      "env": {
        "SOPHOS_HOST": "172.16.16.16",
        "SOPHOS_PORT": "4444",
        "SOPHOS_USERNAME": "admin",
        "SOPHOS_PASSWORD": "your_secure_password_here",
        "SOPHOS_VERIFY_SSL": "false"
      }
    }
  }
}

🧠 Semantic Tool Routing

When connecting sophos-firewall-mcp to AI models with constrained context windows, set USE_ROUTER=true (or TOOL_ROUTING=true).

When enabled:

  1. The server exposes only 2 meta-tools: route_tools and call_routed_tool.
  2. route_tools uses local CPU embeddings (fastembed with BAAI/bge-small-en-v1.5) to search for matching firewall tools in 5-10ms.
  3. call_routed_tool dynamically invokes the matching tool with parameters.

Note on Router Dependencies: Semantic routing requires optional dependencies (fastembed and numpy).

  • Container (Docker/Podman): Included automatically in official images (ghcr.io/jelmervdm/sophos-firewall-mcp:latest).
  • Local Python (pip): Install with extras: pip install -e ".[router]" or pip install "sophos-firewall-mcp-server[router]".
  • uv Workspace: Run uv sync --extra router.
  • uvx directly from Git: Pass --with "fastembed>=0.4.0" --with "numpy>=1.26.0". If USE_ROUTER=true is set without installing fastembed, the server will log a warning and gracefully fall back to standard tool mode instead of failing initialization.

🧪 Testing & Quality Assurance

Run the comprehensive test suite, linting, mypy type checks, and TDQS audit:

# Evaluate Tool Definition Quality Score (TDQS)
uv run python scripts/check_tdqs.py

# Run pytest unit test suite (39 tests)
uv run pytest -v

# Code style and syntax linting
uv run flake8 src tests scripts

# Static type verification
uv run mypy src

📄 License

Distributed under the Apache 2.0 License. See LICENSE for details.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选