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
Visit Server

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.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured