A local firewall for MCP tool calls.
mcp-guard sits between your AI client and your MCP servers. It logs every tool call, flags poisoned tool descriptions, and — when you turn enforce mode on — blocks calls that break the rules. Audit mode by default: nothing changes for you except you get a log.
What is FAULTLINE mcp-guard?
FAULTLINE mcp-guard is a local integrity monitor for stdio Model Context Protocol (MCP) servers. It sits between an AI client and its servers, records tool-call structure without argument values, detects changed or suspicious tool definitions, and can reject calls that violate its rules. The open-source package and command are named mcp-integrity; install it with pip install mcp-integrity.
It is for teams securing local MCP tools in clients such as Claude Desktop and Cursor. Audit mode logs findings by default. Enforce mode blocks unknown tools, extra arguments, and changed tool definitions; it also quarantines high-confidence poisoned tool descriptions. This release has been tested on macOS and Linux; Windows has not been validated. See the source and current limitations.
For a worked explanation of tool poisoning, audit mode, enforcement, and the measured limits, read A local firewall for MCP tool calls.
30-SECOND INSTALL
pip install mcp-integrity
mcp-integrity init
# restart Claude Desktop / Cursor, then:
mcp-integrity statusmode: audit (nothing is blocked; run 'mcp-integrity enforce' to block)
servers: filesystem, github, postgres
last 24h: 142 calls, 0 would-block, 1 suspicious description, 0 changed tools
would block:
github delete_repo unknown_tool x3
suspicious:
filesystem read_file hidden_instruction
changed tools: none01 / WHAT IT CHECKS
| Rule | What it catches | Blocks in enforce? |
|---|---|---|
no_manifest | A call arrives before tools/list, or after the server announces that its tool list changed | Yes |
unknown_tool | Client calls a tool not declared in the server's tools/list manifest | Yes |
extra_argument | Client sends arguments not defined in the tool's inputSchema | Yes |
tool_changed | Server silently altered a tool's schema or description after first run (rug-pull) | Yes |
suspicious_description | Tool description contains prompt injection heuristics (finding labels: hidden_instructionexfiltration_targetsensitive_pathinvisible_unicodecross_tool_reference) | Warns; high-confidence findings quarantine the tool in enforce mode |
quarantined | A high-confidence poisoned tool description is removed from tools/list in enforce mode | Yes |
02 / AUDIT VS ENFORCE
AUDIT
Nothing is blocked. Every call is logged to ~/.mcp-integrity/audit.jsonl with argument names only, never values.
ENFORCE
Rule violations are answered with an MCP error response; high-confidence poisoned tools are removed from tools/list. Use mcp-integrity enforce to switch on and mcp-integrity audit to switch back. Restart the client after changing modes.
stdio servers wrapped in place; a .mcp-integrity.bak is written next to each client config; mcp-integrity uninstall restores everything.
03 / COMMANDS
mcp-integrity init- Finds client configs and wraps stdio MCP servers in audit mode.
mcp-integrity status- Displays protection mode, configured servers, 24h call counts, would-blocks, and warnings.
mcp-integrity log- Displays audit log entries in <time> <server> <tool> <rule> format; supports --tail N and --follow.
mcp-integrity enforce- Switches all wrapped servers to enforce mode.
mcp-integrity audit- Switches all wrapped servers to audit mode.
mcp-integrity pin --list / --accept / --trust- Lists pins, accepts legitimate changes, or trusts a clean tool that was quarantined.
mcp-integrity uninstall- Restores all wrapped client configs to their original unwrapped commands.
mcp-integrity run- Wraps a single server by hand (mcp-integrity run -- <server_command>).
04 / WHAT IT DOES NOT DO
- Does not see your chat messages, so it cannot check whether a tool call's arguments match what you asked (that check exists in the underlying research but needs the user turn — coming as a library API for people who run their own agent loop).
- Does not inspect tool RESULTS.
- Does not protect remote (HTTP/SSE) servers yet.
- The heuristic scanner can miss poisoned tools and can quarantine clean ones in enforce mode. Review findings and use pin --trust when a clean tool was removed.
05 / WHY
Built from FAULTLINE's P08 study on the MCPTox benchmark, where a client-side provenance contract cut pooled attack success from 30.32% to 7.41% across six models. mcp-guard implements the subset of that contract that does not need the user's message.
| RUNG | MODEL | ASR A → B |
|---|---|---|
| R1 | qwen/qwen3.7-flash | 32.94% → 8.26% |
| R2 | z-ai/glm-5.3-flash | 17.23% → 4.11% |
| R3 | qwen/qwen3.8-flash | 41.84% → 9.76% |
| R4 | openai/gpt-5.6-luna | 40.81% → 5.26% |
| R5 | google/gemini-3.7-flash | 3.01% → 1.68% |
| R6 | deepseek/deepseek-v4-pro | 47.64% → 15.46% |
| POOLED | all six | 30.32% → 7.41% |
VALID-ONLY ASR, %. 1,800 PAIRED EVALUATION RUNS.