MCP-Firewall

MCP-Firewall

A policy and audit layer for Model Context Protocol (MCP). MCP Firewall sits transparently between any MCP client (Claude Desktop, Cursor, VS Code, etc.) and an upstream MCP server, allowing you to inspect, allow, block, or audit requests before they reach the server.

Category
访问服务器

README

MCP Firewall

A policy and audit layer for Model Context Protocol (MCP).

MCP Firewall sits transparently between any MCP client (Claude Desktop, Cursor, VS Code, etc.) and an upstream MCP server, allowing you to inspect, allow, block, or audit requests before they reach the server.

No changes are required to your client or your MCP server.


Status

MCP Firewall is an early open-source project.

The core stdio proxy, policy engine, audit logging, and enforcement pipeline are implemented and tested against the official MCP reference servers.

Feedback, bug reports, and contributions are welcome.


Why?

MCP servers can expose powerful capabilities such as:

  • Reading files
  • Writing files
  • Executing shell commands
  • Accessing databases
  • Calling internal APIs

Once an AI agent has access to those tools, there is normally no policy layer deciding what should or shouldn't be allowed.

MCP Firewall adds that missing layer.

Instead of talking directly to an MCP server, the client talks to MCP Firewall. Every request is evaluated against your policy, recorded in the audit log, and either forwarded or blocked before reaching the upstream server.


How it works

Without MCP Firewall

Claude Desktop
      │
      ▼
Filesystem MCP Server
      │
      ▼
delete_file()
      │
      ▼
File deleted

With MCP Firewall

Claude Desktop
      │
      ▼
MCP Firewall
      │
      ├── Policy Evaluation
      ├── Audit Logging
      └── Read-only Checks
      │
      ▼
BLOCK delete_file()
      │
      ▼
JSON-RPC Error returned to the client

(The upstream server never receives the request.)

Features

Current release includes:

  • Transparent stdio proxy
  • Tool allow lists
  • Tool deny lists
  • Parameter-aware policy rules (match_params)
  • Read-only mode
  • Structured JSON audit logging
  • Audit-only mode
  • JSON-RPC compliant error responses
  • Single Go binary
  • No changes required to existing MCP clients or servers

Installation

Option 1: Download Pre-built Binary (Recommended)

Download the latest ready-to-run binary for Windows from the GitHub Releases page.

  1. Download mcp-firewall.exe.
  2. Place it in your project directory or system PATH.
  3. Run mcp-firewall.exe init to generate a default configuration file.

Option 2: Build from Source (Requires Go 1.22+)

Requirements

  • Go 1.22+
  • Node.js (only if using official Node-based MCP reference servers)

Clone the repository:

git clone https://github.com/venu1222g/mcp-firewall.git
cd mcp-firewall

Build:

```bash
make build

or

go build -o mcp-firewall ./cmd/firewall

Quick Start

Generate a configuration:

./mcp-firewall init

Start the firewall:

./mcp-firewall run --config mcp-firewall.yaml

Then point your MCP client at the firewall instead of the upstream server.

Example (Claude Desktop):

{
  "mcpServers": {
    "filesystem": {
      "command": "/path/to/mcp-firewall",
      "args": [
        "run",
        "--config",
        "/path/to/mcp-firewall.yaml"
      ]
    }
  }
}

Restart your MCP client.

Every request now passes through MCP Firewall before reaching the upstream server.


Configuration Examples

Block a tool

policy:
  default_action: allow
  tools:
    deny:
      - delete_file

Allow only selected tools

policy:
  default_action: block
  tools:
    allow:
      - read_file
      - list_directory

Protect a specific file

policy:
  default_action: allow
  rules:
    - id: protect-secrets
      method: tools/call
      action: block
      match_params:
        path: /etc/secrets.env

Audit a policy before enforcing it

server:
  mode: audit-only

Requests continue to reach the upstream server, but every policy decision is evaluated and recorded.

When you're satisfied with the policy, switch to:

server:
  mode: enforce

Enable read-only mode

read_only:
  enabled: true

Read-only mode blocks supported write/delete operations while continuing to allow read operations.


CLI

Generate a default configuration:

mcp-firewall init

Run the proxy:

mcp-firewall run --config mcp-firewall.yaml

Validate configuration and environment:

mcp-firewall doctor

Show version information:

mcp-firewall version

Tested Against

This release has been verified against:

  • Official @modelcontextprotocol/server-filesystem
  • Official @modelcontextprotocol/server-everything
  • JSON-RPC 2.0 stdio transport
  • Windows

Known Limitations

MCP Firewall is currently at v0.1.x.

The following limitations are known:

  • Tool allow/deny policies perform exact tool-name matching.
  • match_params currently matches scalar values only. Array-valued parameters are not matched.
  • Read-only mode protects a built-in list of supported write/delete tools using exact tool names.
  • Dynamic MCP capability annotations (readOnlyHint / destructiveHint) are not yet used.
  • action: redact is reserved for a future release and currently behaves as a block.

Roadmap

Planned improvements include:

  • Regex and glob matching
  • Dynamic capability discovery
  • Parameter redaction
  • HTTP/SSE transport support
  • Web dashboard

Contributing

Contributions are welcome.

make fmt
make test

Please open an issue before making large architectural changes or adding new features.


License

Apache License 2.0.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选