mcp-shield
mcp-shield ๐ก๏ธ
Zero-overhead runtime security proxy, reversible secret vault, and audit firewall for Model Context Protocol (MCP) servers.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ก๏ธ mcp-shield runtime active: Cursor / Claude Desktop / Windsurf โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ IN [BLOCKED] execute_sql "DROP TABLE users;" (Destructive command) โ
โ โ IN [BLOCKED] read_file "~/.ssh/id_rsa" (Sensitive path protected) โ
โ โ OUT [MASKED] get_user_api "sk-proj-..." -> [[MCP_SHIELD_REF_8f91]] โ
โ โ IN [RESTORE] call_webhook [[MCP_SHIELD_REF_8f91]] -> Re-hydrated โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโWhen AI assistants (Cursor, Claude Desktop, Windsurf, or agent frameworks) connect to local MCP servers, they often receive unrestricted access to system files, shell commands, and databases.
Unlike offline scanners that only check configuration files once, mcp-shield runs in real time between your AI client and any target MCP server. It intercepts destructive tool calls, prevents sensitive file exfiltration, and redacts credentials before they can leak into external LLM prompts.
โก 1-Click Protection (Universal Client Support)
Shield your MCP servers across all installed AI editors with a single command:
# Auto-detects and protects Claude Desktop, Cursor, and Windsurf
npx mcp-shield wrap all
# Or target a specific editor:
npx mcp-shield wrap cursor
npx mcp-shield wrap claude
npx mcp-shield wrap windsurfTo revert back at any time:
npx mcp-shield unwrap allRelated MCP server: mcp_Shield
๐ Why mcp-shield Outperforms Alternative Tools
Capability | Static Config Scanners | Standard Proxies |
|
Real-time Runtime Blocking | โ | โ | โ |
Universal 1-Click Auto-Wrap | โ | โ | โ (Cursor, Claude, Windsurf) |
Reversible Secret Vault | โ | โ (hard redacts, breaks APIs) | โ (masks outbound, re-hydrates inbound) |
Destructive Command Guard | โ | Partial | โ
( |
Sensitive Path Shield | โ | Partial | โ
( |
Zero-Corrupt Terminal HUD | โ | โ | โ (Live latency & status to stderr) |
๐ The Reversible Secret Vault
Standard redactors replace secrets with [REDACTED], which breaks downstream APIs when the tool actually needs the token.
mcp-shield uses an in-memory cryptographic token vault:
Outbound to LLM: Replaces raw API keys, JWTs, and passwords with synthetic placeholders (
[[MCP_SHIELD_REF_8f91]]). The LLM never sees your real credentials.Inbound from LLM: When the LLM calls a downstream tool with the placeholder,
mcp-shieldsecurely re-hydrates the placeholder with the real secret before dispatching to the target service.
๐ ๏ธ Manual CLI Usage
You can also run mcp-shield directly as a transparent wrapper:
# Run any MCP server protected through mcp-shield
npx mcp-shield -- npx -y @modelcontextprotocol/server-postgres "postgresql://localhost/mydb"
# Enable persistent JSON audit logging
npx mcp-shield --log /tmp/audit.jsonl -- npx -y @modelcontextprotocol/server-filesystem /path/to/dirOptions
Usage: mcp-shield [options] [command] [args...]
Subcommands:
wrap [target] Inject mcp-shield into AI clients: 'cursor', 'claude', 'windsurf', or 'all' (default: all)
unwrap [target] Restore original configuration
Arguments:
command Target MCP server command (e.g., 'npx', 'node', 'python')
args Arguments to pass to target MCP server
Options:
-l, --log <path> File path to write JSON audit logs
-s, --silent Suppress live terminal HUD to stderr (default: false)
--no-mask Disable automatic secret vault tokenization
-b, --block-tool <tools...> Explicit list of tool names to block completely
-h, --help Display help instructions๐งช Testing
git clone https://github.com/alexfraser-scotch/mcp-shield.git
cd mcp-shield
npm install
npm test๐ค Contributing & License
Contributions, rules, and security suggestions are warmly welcomed! See our Contributing Guide to get started.
Distributed under the MIT License.
This server cannot be deployed
Maintenance
Related MCP Connectors
Real-time MCP & A2A prompt-injection, jailbreak, and tool-schema poisoning firewall for AI agents.
21- ArcjetOAuthcom.arcjet
An MCP server for Arcjet - the runtime security platform that ships with your AI code.
Security scanner for MCP servers. Detect vulnerabilities, prompt injection, and tool poisoning.
Zero-secret MCP gateway for AI agents: risk-scored, audited calls with human-in-the-loop approval.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenancePolicy-enforcing MCP proxy that blocks dangerous tool calls before they execute. Protects credentials, filesystem, shell, and databases across Claude Desktop, Cursor, Windsurf, and OpenClaw.4 npm41Apache 2.0
- FlicenseNot gradedqualityCmaintenanceThe security runtime for MCP servers. Every tool call inspected. Every attack blocked. Every decision logged.1-
- AlicenseNot gradedqualityDmaintenanceA drop-in proxy that guards MCP servers with policy enforcement, secret redaction, prompt-injection screening, rug-pull detection, rate limiting, and audit logging.9 npmApache 2.0
- AlicenseNot gradedqualityBmaintenanceA local-first MCP server that lets AI agents use gated APIs without holding keys, enforcing declarative policies, injecting secrets server-side, and auditing access without content.2Apache 2.0