MCP Shield

io.github.sophiacave由 GitHub 账号 sophiacave 发布v1.0.7更新于 Oct 24, 2026

Security scanner for MCP servers. SSRF, path traversal, injection, auth, secrets. Grade A-F.

已验证STDIO仅桌面开发者工具安全与监控

概览

AI 生成的概览

一个本地 MCP 服务器,用于扫描 MCP 服务器源码中的 SSRF、路径穿越、注入、缺少鉴权和硬编码密钥等安全问题,并给出 A–F 评级。

可以做什么
扫描单个源码文件,返回规则编号、严重级别、位置、CWE 引用、修复建议和 A–F 评级。扫描整个项目目录,输出同类结果。扫描直接粘贴的代码片段,无需磁盘文件。检查范围涵盖 SSRF、路径穿越、注入、鉴权、配置和日志六类规则。
适用场景
适合在部署 MCP 服务器前审查或审计其代码,也适合在助手会话中快速做一次安全状况检查并获得具体修复提示。
运行要求
作为本地进程运行,需用 python3 启动项目中的 MCP 服务器脚本;README 称其为纯 Python、无需 pip 安装。仅限桌面端,无网页版。
安装前请注意
它会读取你指定的源码文件或代码,避免扫描含真实密钥且不希望出现在输出中的文件。结果基于规则匹配,并不保证安全,A–F 评级不应视为安全认证。

安装

在 SourceWeft 中

  1. 打开 控制台中的 MCP Shield,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

MCP Shield

[CI]

[License: MIT] [Python 3.10+] [Tests: 28 passing] [MCP Compatible]

Open-source security scanner for MCP servers. 20 rules across 6 categories. Scan any server in seconds. Get a grade from A to F.

36.7% of MCP servers are SSRF-vulnerable (BlueRock, 2026). 82% have path traversal flaws. Only 17% are production-ready. MCP Shield finds the vulnerabilities before attackers do.

Quick Start

bash
git clone https://github.com/sophiacave/mcp-shieldcd mcp-shield
# Scan a filepython3 src/cli.py scan path/to/mcp_server.py
# Scan a projectpython3 src/cli.py scan path/to/mcp-project/

What It Checks (20 Rules)

RuleSeverityWhat It Detects
SSRF-01CriticalUser input in HTTP request URLs
SSRF-02MediumDynamic URLs without validation
SSRF-03MediumDNS rebinding (URL validated but no IP pinning)
PATH-01HighUser input in file paths
PATH-02MediumNo path traversal protection
PATH-03MediumSymlink following without check
INJ-01Criticaleval/exec on user input
INJ-02CriticalSQL string interpolation
INJ-03Highsubprocess with shell=True
INJ-04HighTemplate injection via .format()
INJ-05CriticalUnsafe deserialization (pickle/yaml)
AUTH-01MediumNo auth on tool handlers
AUTH-02CriticalHardcoded secrets/API keys (OpenAI, Stripe, GitHub, AWS)
AUTH-03LowNo rate limiting on tool endpoints
SEC-01HighSSL verification disabled
SEC-02MediumWildcard CORS
SEC-03MediumStack traces/error details exposed to client
SEC-04LowNo input length validation (DoS risk)
LOG-01LowNo logging/audit trail on tool invocations

Testing

bash
python3 tests/test_integration.py# 28 tests, 0 failures

MCP Server Integration

Add to ~/.claude/mcp.json:

json
{  "mcpServers": {    "mcp-shield": {      "command": "python3",      "args": ["/path/to/mcp-shield/src/mcp_server.py"]    }  }}

Claude Code tools: shield_scan_file, shield_scan_directory, shield_scan_code

Example Output

MCP Shield: my-server/ — 3 finding(s)
  [CRIT] SSRF-01: Potential SSRF: Dynamic URL from user input    requests call with dynamic URL that may include user input    Location: server.py:45    Fix: Validate URL against allowlist. Block internal IPs.    CWE: CWE-918
  [HIGH] INJ-03: Command injection: subprocess with shell=True    subprocess called with shell=True. User input in args = RCE.    Location: tools.py:112    Fix: Use subprocess with shell=False and pass args as list.    CWE: CWE-78
  [MED] AUTH-01: No authentication detected on tool handlers    MCP tool handlers found but no auth logic detected    Fix: Add authentication middleware.    CWE: CWE-306
Grade: F | 1 critical, 1 high, 1 medium

Features

  • Zero dependencies — Pure Python, no pip installs required
  • 20 security rules across SSRF, path traversal, injection, auth, config, and logging
  • CWE references — Every finding maps to a Common Weakness Enumeration ID
  • Actionable fixes — Each finding includes specific remediation steps
  • A-F grading — Instant security posture assessment
  • Dual mode — Run as CLI or as an MCP server inside Claude Code
  • Fast — Scans a typical MCP server in under 1 second

Why This Exists

The MCP ecosystem has 9,400+ servers and 97M monthly SDK downloads. Security tooling hasn't kept up. We built MCP Shield because every MCP server deployed without a security scan is a liability.

Built by Like One, a 501(c)(3) nonprofit. Security tooling should be free.

License

MIT — Like One

来源:README.md,提交 7064e61

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v1.0.7最新Sep 16, 2026

评分

已满足适用检查项的 40%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。