mcp-firewall logo

mcp-firewall

Community
ressl

The open-source security gateway for AI agents. Policy enforcement, threat detection, and compliance-ready audit logging for MCP and any AI agent framework. πŸ›‘οΈ

Publisherressl
Repositorymcp-firewall
LanguagePython
Forks
8
Stars
14
Available tools
0
Transport typestdio
Categories
LicenseAGPL-3.0
Links
  • Connect tools to AI workflows

    mcp-firewall exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    14 stars and 8 forks from the linked repository.

πŸ›‘οΈ mcp-firewall

CI

The open-source security gateway for AI agents.

mcp-firewall sits between your MCP client and server, intercepting every tool call with enterprise-grade policy enforcement, real-time threat detection, and compliance-ready audit logging.

AI Agent ←→ mcp-firewall ←→ MCP Server
               ↕
         Policy Engine
         Audit Trail
         Threat Feed

Why

AI agents can now execute tools β€” read files, run commands, query databases, make HTTP requests. Without guardrails, a single prompt injection can exfiltrate your credentials, execute arbitrary code, and chain tools for privilege escalation.

mcp-firewall is the WAF for AI agents.

Quick Start

The reviewed integration is available as the v0.2.0a1 GitHub prerelease. Download and verify its wheel as described in release instructions; this prerelease is not published to PyPI. See the changelog for changes and experimental recovery limits.

bash
pip install mcp-firewall

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

# Generate a starter policy
mcp-firewall init

Features

πŸ”’ Defense-in-Depth Pipeline

Every tool call passes through 7 inbound security stages (plus optional human approval) and 2 outbound scanners:

Inbound (request screening):

  1. Kill Switch β€” Emergency deny-all
  2. Rate Limiter β€” Per-agent, per-tool, global
  3. Injection Detector β€” Pattern-based, sensitivity configurable (low/medium/high)
  4. Egress Control β€” Block SSRF, private IPs, cloud metadata
  5. Threat Feed β€” Known attack patterns (built-in community rules)
  6. Policy Engine β€” YAML policies + per-agent RBAC
  7. Chain Detector β€” Dangerous tool sequences

When a rule requires approval, an interactive prompt asks the user; non-interactive sessions fail closed (deny).

Outbound (response scanning):

  1. Secret Scanner β€” API keys, tokens, private keys
  2. PII Detector β€” Email, phone, SSN, IBAN, credit cards

πŸ“‹ Policy-as-Code

Simple YAML for common rules:

yaml
agents:
  claude-desktop:
    allow: [read_file, search]
    deny: [exec, shell, rm]
    rate_limit: 100/min

rules:
  - name: block-credentials
    match: { arguments: { path: "**/.ssh/**" } }
    action: deny

See Policy Reference for the full rule schema.

πŸ“Š Real-Time Dashboard

bash
mcp-firewall wrap --dashboard -- python my_server.py
# β†’ Dashboard at http://localhost:9090

Live event feed and statistics.

πŸ” Signed Audit Trail

Enable audit.sign: true to sign every event with Ed25519 in addition to the hash chain. Export to SIEM (CEF/LEEF), Syslog, CSV, or JSON.

bash
mcp-firewall audit    # Verify chain integrity
mcp-firewall audit export --format cef --output siem.log

πŸ“„ Compliance Reports

Auto-generated evidence for regulatory audits:

bash
mcp-firewall report dora     # EU Digital Operational Resilience Act
mcp-firewall report finma    # Swiss Financial Market Authority
mcp-firewall report soc2     # SOC 2 Type II evidence

🎯 Threat Feed

Community-maintained detection rules (like Sigma for SIEM):

bash
mcp-firewall feed list       # Show active rules

Rules detect known-bad patterns: webhook exfiltration, credential harvesting, cloud metadata SSRF, and more.

πŸ” Built-in Scanner

Pre-deployment security scanning (powered by mcpwn):

bash
mcp-firewall scan -- python my_server.py

Integration

Works with every MCP client β€” zero code changes:

json
{
  "mcpServers": {
    "filesystem": {
      "command": "mcp-firewall",
      "args": ["wrap", "--", "npx", "@modelcontextprotocol/server-filesystem", "/home"]
    }
  }
}

Compatible with: Claude Desktop, Claude Code, Cursor, VS Code, Windsurf, and any MCP client.

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  MCP Client │◄───►│          mcp-firewall            │◄───►│  MCP Server β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚                               β”‚     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    β”‚  Inbound ─► Policy ─► Outboundβ”‚
                    β”‚      β”‚         β”‚         β”‚     β”‚
                    β”‚      β–Ό         β–Ό         β–Ό     β”‚
                    β”‚  [Audit] [Alerts] [Metrics]    β”‚
                    β”‚      β”‚                         β”‚
                    β”‚      β–Ό                         β”‚
                    β”‚  [Dashboard]  [Reports]        β”‚
                    └──────────────────────────────--β”˜

Comparison

Featuremcp-firewallAgent-WallLlamaFirewallMintMCP
MCP-native proxyβœ…βœ…βŒβœ… (SaaS)
Open sourceβœ…βœ…βœ…βŒ
Agent RBACβœ…βŒβŒβŒ
Signed audit trailβœ…βŒβŒβŒ
Compliance reportsβœ…βŒβŒSOC2 only
Threat feedβœ…βŒβŒβŒ
Alertingβœ…βŒβŒβŒ
Dashboardβœ…BasicβŒβœ…
Cost trackingβœ…βŒβŒβŒ
Built-in scannerβœ…βŒβŒβŒ

Use Cases

  • Developers: Protect your machine when trying new MCP servers
  • Security Teams: Enforce tool usage policies across the organization
  • Compliance Officers: Generate audit evidence for DORA, FINMA, SOC 2
  • CISOs: Visibility and control over AI agent behavior
  • Red Teamers: Test AI agent security posture

SDK Mode (any AI agent framework)

mcp-firewall works as a Python library, not just an MCP proxy. Use it with OpenClaw, LangChain, CrewAI, or any custom agent:

python
from mcp_firewall.sdk import Gateway

with Gateway(config_path="mcp-firewall.yaml") as gw:
    decision = gw.check("read_file", {"path": "/tmp/example.txt"}, agent="my-agent")
    if decision.blocked:
        print(f"Blocked: {decision.reason}")
    else:
        # Illustrative output: the SDK itself never executes the tool.
        output = "AWS_KEY=<REDACTED>"
        result = gw.scan_response(output, context=decision.context)
        print(result.content)  # "AWS_KEY=[REDACTED by mcp-firewall]"

See examples/openclaw_integration.py for a full example.

SDK approval requests now fail closed by default, and configured audit logging is respected. See the SDK migration guide for changed defaults, async methods, structured responses, and resource cleanup.

Desktop approvals

Use mcp-firewall wrap --dashboard-approvals -- <server> for authenticated, single-call approval in the local dashboard. Set MCP_FIREWALL_DASHBOARD_TOKEN and connect the controller first. Missing approval, timeout or controller loss denies the call; global restrictions still apply. See setup and limits.

A native AgentReins adapter adds the same approval controls and correlated protocol evidence to a pinned AgentReins development build.

Integration events

Export versioned lifecycle events to a local desktop companion or another HTTP receiver. Events correlate admission and response decisions using session and call IDs, with bounded background delivery and sanitized metadata. Audit entries and the dashboard use the same event model. Export never grants permission or proves that a tool executed.

See the integration contract, JSON schema, and example receiver.

See Also

mcpwn β€” Security scanner for MCP servers. While mcp-firewall protects at runtime, mcpwn finds vulnerabilities before deployment.

ToolWhenWhat
mcpwnPre-deploymentFind vulnerabilities in MCP servers
mcp-firewallRuntimeBlock attacks, enforce policies, audit logging

Scan first, then protect:

bash
# Step 1: Scan for vulnerabilities
mcp-firewall scan -- python my_server.py

# Step 2: Protect at runtime
mcp-firewall wrap -- python my_server.py

Scoped workspace recovery

Opt in to before/after file snapshots with wrap --dashboard-approvals --snapshot-workspace /absolute/project. The native adapter can display diffs and restore a selected file while rejecting stale edits. Snapshots are bounded and last for the proxy process lifetime; pause external writers before restore. See workspace rollback for setup and limits.

Documentation

Contributing

See CONTRIBUTING.md for guidelines.

Security issues: see SECURITY.md.

License

AGPL-3.0 β€” see LICENSE.

Commercial licensing available for organizations that cannot use AGPL. Contact rr@canus.ch.

About

Built by Robert Ressl β€” Associate Director Offensive Security at Kyndryl. CISSP, OSEP, OSCP, CRTO. After 100+ penetration tests and red team engagements across banking, insurance, and critical infrastructure, I saw the gap: AI agents are the new attack surface, and MCP is the protocol everyone uses but nobody secures.

mcp-firewall is the firewall that MCP needs.

Installation

TypingMind
{
  "mcpServers": {
    "mcp-firewall": {
      "command": "mcp-firewall",
      "args": []
    }
  }
}

Use mcp-firewall MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once mcp-firewall is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add mcp-firewall as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the mcp-firewall MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "mcp-firewall": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the mcp-firewall MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the mcp-firewall MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use mcp-firewall to help me with this task?
mcp-firewall
Sure. I read it.
Here is what I found using mcp-firewall.

Frequently asked questions

What is the mcp-firewall MCP server used for?

mcp-firewall is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use mcp-firewall MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use mcp-firewall with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use mcp-firewall MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With mcp-firewall connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect mcp-firewall MCP to TypingMind?

mcp-firewall runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does mcp-firewall MCP provide in TypingMind?

mcp-firewall exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use mcp-firewall MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If mcp-firewall requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter πŸ‘‡