mcp-guard
An HTTP proxy that secures MCP servers by intercepting tool calls and blocking requests based on configurable keyword patterns. It provides a simple way to prevent destructive operations on upstream servers like databases through a JSON-based gate system.
README
<img width="1224" height="618" alt="CleanShot 2026-02-27 at 13 39 30@2x" src="https://github.com/user-attachments/assets/8607026a-854c-4884-9ec6-19705a1232c3" />
mcp-guard
A simple HTTP proxy that gates MCP servers with block rules.
No SDKs. No dashboards. Just a JSON config and a toggle command.
Client (Claude, Cursor, etc.)
↕ http
mcp-guard (localhost proxy)
↕ http
Upstream MCP server (supabase, postgres, etc.)
Quick Start
1. Install
npm install -g @alramalho/mcp-guard
Or from source:
git clone https://github.com/alramalho/mcp-guard
cd mcp-guard
pnpm install && pnpm build && npm link --force
2. Create .mcp-guard.json
In your project root (or ~/.mcp-guard.json globally). Config is auto-discovered by walking up from cwd.
{
"port": 6427,
"servers": {
"supabase_production": {
"url": "https://mcp.supabase.com/mcp?project_ref=xxx&read_only=true",
"block": ["DELETE", "UPDATE", "DROP", "TRUNCATE", "ALTER", "INSERT"],
"blockMessage": "Destructive SQL operations are not allowed in production"
}
}
}
3. Update your mcp.json
Replace the direct upstream URL with the mcp-guard proxy:
{
"mcpServers": {
"supabase_production": {
"type": "http",
"url": "http://localhost:6427/supabase_production"
}
}
}
4. Toggle on/off
$ mcp-guard
MCP Guard on → http://localhost:6427
$ mcp-guard
MCP Guard off
Debug mode
Run in foreground to see all tool calls and block decisions live:
$ mcp-guard -d
Config
.mcp-guard.json (auto-discovered from cwd up, or ~/.mcp-guard.json, or --config <path>):
| Field | Type | Default | Description |
|---|---|---|---|
port |
number |
6427 |
Port for the local HTTP proxy |
servers |
object |
— | Map of gate name → server config |
Each server:
| Field | Type | Description |
|---|---|---|
url |
string |
Upstream MCP server URL |
enabled |
boolean |
Set to false to passthrough without blocking |
block |
string[] |
Patterns to block (case-insensitive substring match) |
blockMessage |
string |
Error message returned when blocked |
How It Works
mcp-guardstarts a local HTTP server- When a client connects to
http://localhost:PORT/<gate_name>, it connects to the upstream MCP server - It discovers all upstream tools and re-exposes them
- On each tool call, all argument values are checked against block patterns
- If any pattern matches → error returned, call never reaches upstream
- If no match → call is forwarded to upstream as-is
License
MIT
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.