MCP Shield is a static security scanner and MCP server for scanning Model Context Protocol servers, tools, prompts, and AI agent projects.
Purpose MCP gives agents access to tools, and MCP servers often expose powerful capabilities such as filesystem access, shell commands, network calls, credentials, browser automation, databases, and internal tools. These capabilities are exactly where small mistakes tend to be costly: tool descriptions may encourage unsafe behavior; test keys may turn into real leaked tokens; agents may invoke shell commands with user-controlled input; prompts or resources may contain injected text; CI may lack security gates for MCP-specific risks. MCP Shield is intended to serve as a simple first line of defense, helping to catch these obviously dangerous parts through fast static checks, useful output, and a non-zero exit code when risk exceeds a threshold.
Key capabilities
- Runs as both a CLI and an MCP server
- Built on the official MCP Python SDK
- Provides CI-friendly severity gates
- Supports text, JSON, Markdown, and SARIF output
- Supports inline suppression using rule IDs
- Supports ignoring test fixtures and intentional demos via a .mcp-scan-ignore file
- Provides MCP SDK-aware Python and TypeScript server parsing
- Provides a safer default ruleset for enterprise MCP servers
- Provides prompt/resource-specific injection checks
Usage It can be run from a local checkout, or run without installation. MCP Shield can run as a stdio MCP server. Available MCP tools include: scan_path_tool (scans a local MCP server or agent project) and list_rules (lists rule IDs and descriptions). An example Claude Desktop-style command can be used for configuration. For output formats: text is for humans to read, json is for automation, markdown is for PR comments and reports, and sarif is for GitHub code scanning. For severity gates: --fail-on high exits with exit code 1 when any high or critical findings are present.
Ignoring and suppression A .mcp-scan-ignore file can be created inthe scanned directory for intentional test fixtures and demos. It should not be used to hide production risks. Reviewed findings can be suppressed on the same line, using all only for test fixtures.
Use cases Suitable for developers who need to check the security of MCP servers and AI agent tools, especially in scenarios involving integrating security gates in CI pipelines, scanning local MCP servers or agent projects, and reviewing tool descriptions and prompt injection risks.
Limitations MCP Shield is a static heuristic scanner. It catches common risks early, but it is not a complete security audit. The MCP security field is evolving rapidly, and the currently most useful contributions include real-world unsafe MCP examples, low-noise detection rules, and CI integration.
Additional information The project plans to release a PyPI version to support pipx install mcp-shield. Repository topics suggest adding relevant GitHub topics for discoverability. If MCP Shield catches something useful, you can star the repository so more MCP builders can find it.