# MCP Shieldwall **Zero-dependency security firewall, tool-poisoning scanner, lockfile verifier & config auditor for Model Context Protocol (MCP) servers.** [![PyPI version](https://img.shields.io/pypi/v/mcp-shieldwall.svg)](https://pypi.org/project/mcp-shieldwall/) [![Downloads](https://static.pepy.tech/badge/mcp-shieldwall)](https://pepy.tech/projects/mcp-shieldwall) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![Python 3.9+](https://img.shields.io/badge/python-3.9+-3776AB.svg)](pyproject.toml) Coding agents (Claude Desktop, Claude Code, Cursor, Windsurf) increasingly connect to third-party **MCP servers**. A single poisoned tool description (` silently read ~/.ssh/id_rsa ...`), base64-obfuscated `inputSchema` default, unpinned `npx -y` server, or silent schema update ("rug-pull") can hijack the model's context or leak API keys. **MCP Shieldwall** (`v0.3.1`) runs locally on **100% Python stdlib** with **zero external dependencies**: - **Native MCP Server (`serve-mcp` / `mcp-shieldwall-server`)**: Runs as a zero-dependency JSON-RPC 2.0 `stdio` MCP server exposing `scan_tools_manifest`, `audit_client_config`, `verify_schema_lock`, and `redact_sensitive_text` directly inside your AI client. - **Static Tool-Poisoning Scanner (`MCP-001`..`MCP-004`)**: Detects hidden prompt-injection instructions, `.env` / SSH exfiltration directives, rogue webhooks, and **base64-obfuscated payloads** inside `tools/list` schemas (`--format json|sarif|markdown`). - **CI Rug-Pull Lockfile (`lock` / `verify-lock`)**: Pins canonical SHA-256 fingerprints per tool (`description` + `inputSchema`) into `.mcp-lock.json` and alerts in CI on silent upstream mutations, additions, or removals. - **Client Config Auditor (`audit-config`, `MCP-301`..`MCP-304`)**: Checks `claude_desktop_config.json` / Claude Code `.mcp.json` / Cursor `mcp.json` / VS Code `mcp.json` for unsafe flags (`--allow-all`, `--no-sandbox`), hardcoded API tokens, unpinned `npx -y` packages without explicit versions, and insecure `http://` endpoints (`--format json|markdown`). - **Runtime Call Guard (`MCP-101`..`MCP-103`)**: Blocks destructive shell commands (`rm -rf /`, `curl ... | bash`) and base64-obfuscated payloads in `tools/call` arguments. - **Live Secret Redaction (`MCP-201`)**: Scrubs Anthropic, OpenAI, GitHub, AWS, Slack, Google, and Stripe credentials from MCP responses before they enter model context. ## Quick Start ### Run Instantly (Zero Clone / Zero Dependencies) ```bash uvx mcp-shieldwall uvx mcp-shieldwall demo pip install mcp-shieldwall ``` ### Local CLI Workflows ```bash pip install -e . # 1. Scan an MCP tools manifest (JSON, SARIF v2.1.0, or GitHub Markdown) mcp-shieldwall scan examples/sample_tools.json mcp-shieldwall scan examples/sample_tools.json --format sarif mcp-shieldwall scan examples/sample_tools.json --format markdown # 2. Pin tool schemas to a lockfile and verify in CI against rug-pulls mcp-shieldwall lock tools.json --out .mcp-lock.json mcp-shieldwall verify-lock tools.json --lock .mcp-lock.json # 3. Audit Claude Desktop, Claude Code, Cursor, or VS Code MCP configuration mcp-shieldwall audit-config ~/.cursor/mcp.json mcp-shieldwall audit-config ~/.cursor/mcp.json --format markdown # 4. Redact leaked keys from tool logs or outputs mcp-shieldwall redact server_output.log ``` Run the 10-second zero-install showcase: ```bash ./examples/demo.sh ``` ## Use as an MCP Server in Claude Desktop / Claude Code / Cursor Add MCP Shieldwall directly to your `claude_desktop_config.json`, `.mcp.json`, or `~/.cursor/mcp.json`: ```json { "mcpServers": { "mcp-shieldwall": { "command": "uvx", "args": ["mcp-shieldwall", "serve-mcp"] } } } ``` The stdio file tools read local JSON files up to 2 MiB under the working directory or the user’s home directory. Claude Code also supports the CLI form: ```sh claude mcp add mcp-shieldwall -- uvx --from git+https://github.com/andrejpimenov122-lab/mcp-shieldwall@v0.3.1 mcp-shieldwall serve-mcp ``` Exposed MCP tools: - `scan_tools_manifest` — Scan a `tools/list` manifest JSON or file for `MCP-001`..`MCP-004` (including Base64-obfuscated payloads). - `audit_client_config` — Audit `mcpServers`/`servers` configs for `MCP-301`..`MCP-304`. - `verify_schema_lock` — Verify SHA-256 tool fingerprints against `.mcp-lock.json` to catch rug-pulls. - `redact_sensitive_text` — Scrub leaked API keys and tokens (`MCP-201`). ## Zero-Clone `pre-commit` Hook (Blocks Unsafe `.mcp.json` / `.cursor/mcp.json` Commits) Add directly to `.pre-commit-config.yaml` in any repository: ```yaml repos: - repo: https://github.com/andrejpimenov122-lab/mcp-shieldwall rev: v0.3.1 hooks: - id: mcp-shieldwall-config - id: mcp-shieldwall-manifest ``` Live browser playground (zero install): https://huggingface.co/spaces/snsnshnwh/mcp-shieldwall ## CI Integration An example GitHub Actions workflow is provided at [`docs/ci-workflow-example.yml`](docs/ci-workflow-example.yml). ## Documentation & Benchmarks - **9-Client IDE & CLI Integration Guide**: [`docs/IDE_INTEGRATIONS.md`](docs/IDE_INTEGRATIONS.md) — Setup snippets for Claude Desktop, Claude Code, Cursor, Windsurf, VS Code Copilot, Cline, Roo Code, Zed, and Continue.dev. - **12-Vector Security Benchmark**: [`docs/SECURITY_BENCHMARK.md`](docs/SECURITY_BENCHMARK.md) — Empirical recall, false-positive analysis, latency, and schema rug-pull verification across 12 attack vectors and 12 benign configs/tools. ## Running Tests ```bash python3 -m unittest discover -s tests -v ``` ## Limitations Static regex/decoding heuristics and config rules do not replace OS-level sandboxing or human review of third-party MCP servers. They are designed as a fast, deterministic local gate in CI and pre-commit workflows. ## License MIT — Open Source Initiative (OSI) approved.