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 分

    請在儲存庫或註冊中心條目中宣告授權條款。