🛡️

mcp-firewall

The open-source security firewall for AI agents

pip install mcp-firewall
AGPL-3.0 114 Tests 4800+ LOC Python 3.11+

The Problem

AI agents (Claude Desktop, Cursor, VS Code Copilot) now have direct access to your filesystem, databases, APIs, and shell via MCP. A single prompt injection can exfiltrate your SSH keys, credentials, or production data. There's no firewall for this.

How It Works

AI Agent (Claude, Cursor, ...)
            │
            ▼
    ┌────────────────┐
    │  mcp-firewall  │ ← Policy + Audit
    └────────────────┘
            │
            ▼
     MCP Server (Tools)

Features

🔍

Injection Detection

50+ patterns catch prompt injection attempts in tool arguments before they reach the server.

🚫

SSRF Protection

Blocks access to cloud metadata endpoints (169.254.169.254), private IPs, and dangerous URL schemes.

🔑

Secret Scanning

18 patterns detect and redact AWS keys, GitHub tokens, private keys, DB URLs, JWTs in tool responses.

👤

PII Detection

7 patterns redact emails, phone numbers, credit cards, IBANs, Swiss AHV numbers from responses.

📋

Policy Engine

YAML policies with per-agent RBAC. Define who can use which tools with what arguments.

⛓️

Chain Detection

Detects dangerous tool chains (read_file + http_post = exfiltration) across multiple calls.

✍️

Signed Audit Trail

Ed25519 signed entries with hash chain integrity. Tamper-evident, compliance-ready.

📊

Real-Time Dashboard

FastAPI + HTMX dashboard on :9090. See blocked attacks, policies, and audit events live.

🏛️

Compliance Reports

Generate DORA Art. 9+11, FINMA, and SOC 2 Type II (CC6/CC7/CC8) reports from audit data.

🚨

Alerting

Webhook, Slack (Block Kit), and Syslog/CEF alerting. Integrate with any SIEM.

🐍

Python SDK

Use the pipeline from any Python app. Works with OpenClaw, LangChain, CrewAI, AutoGen.

🛑

Kill Switch

Emergency shutdown. Block all tool calls instantly via file trigger or API.

Quick Start

# Install
pip install mcp-firewall

# Wrap any MCP server
mcp-firewall wrap -- npx @modelcontextprotocol/server-filesystem /tmp

# With dashboard
mcp-firewall wrap --dashboard -- npx @modelcontextprotocol/server-filesystem /tmp

# Claude Desktop (claude_desktop_config.json)
{
  "mcpServers": {
    "filesystem": {
      "command": "mcp-firewall",
      "args": ["wrap", "--", "npx", "@modelcontextprotocol/server-filesystem", "/tmp"]
    }
  }
}

🔍 Companion: mcpwn

Pre-deployment security scanner for MCP servers. 10 vulnerability checks.
Scan with mcpwn, protect with mcp-firewall.


Learn more pip install mcpwn
⭐ GitHub 📦 PyPI