Skip to main content
Glama

mcp-shield ๐Ÿ›ก๏ธ

npm version License: MIT

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 windsurf

To revert back at any time:

npx mcp-shield unwrap all

Related MCP server: mcp_Shield

๐Ÿš€ Why mcp-shield Outperforms Alternative Tools

Capability

Static Config Scanners

Standard Proxies

mcp-shield ๐Ÿ›ก๏ธ

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

โœ… (rm -rf, DROP TABLE, mkfs)

Sensitive Path Shield

โŒ

Partial

โœ… (.env, id_rsa, ~/.aws)

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:

  1. Outbound to LLM: Replaces raw API keys, JWTs, and passwords with synthetic placeholders ([[MCP_SHIELD_REF_8f91]]). The LLM never sees your real credentials.

  2. Inbound from LLM: When the LLM calls a downstream tool with the placeholder, mcp-shield securely 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/dir

Options

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.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Policy-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 npm
    41
    Apache 2.0
  • A
    license
    Not graded
    quality
    D
    maintenance
    A drop-in proxy that guards MCP servers with policy enforcement, secret redaction, prompt-injection screening, rug-pull detection, rate limiting, and audit logging.
    9 npm
    Apache 2.0
  • A
    license
    Not graded
    quality
    B
    maintenance
    A 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.
    2
    Apache 2.0