使用说明
⛨ MCPShield
MCP供应链安全扫描器 --在MCP服务器配置到达生产环境之前,检测其中的漏洞、拼写错误和配置错误。
想想“MCP服务器的Snyk”
它的作用
MCPShield扫描您的MCP配置文件(Claude Desktop、Cursor、VS Code等),并检测:
- 百草枯包装 --Levenshtein对40多个已知合法MCP包以及已确认的恶意包数据库进行距离分析
- 已知CVE --检查每个服务器是否存在披露的MCP安全问题的漏洞数据库(CVE-2025-68145等)
- 硬编码凭证 -配置文件中嵌入的API密钥、数据库URL、令牌、私钥
- 危险权限 --系统目录访问、禁用沙盒、不受限制的文件访问
- 未经验证的出版商 --标记不在受信任范围内的包(@anthropic/、@modelcontextprotocol/等)
- 运输安全 --HTTP端点,缺少SSE连接的身份验证
快速开始
# Scan a specific config file
node src/index.js scan --config path/to/claude_desktop_config.json
# Auto-discover and scan all MCP configs on your system
node src/index.js scan
# Output JSON for CI/CD pipelines
node src/index.js scan --config mcp.json --json
# Save report to file
node src/index.js scan --config mcp.json --json --output report.json
全局安装(可选)
npm link
mcpshield scan
CI/CD集成
MCPShield使用出口代码进行管道集成:
| 退出代码 | 含义 |
|---|---|
| 0 | 无高/关键发现——可以安全继续 |
| 1 | 检测到高度严重的发现 |
| 2 | 关键发现(拼写错误、RCE、证书暴露) |
GitHub操作示例
- name: MCP Security Scan
run: |
npx mcpshield scan --config .cursor/mcp.json --json --output mcpshield-report.json
continue-on-error: false
- name: Upload Security Report
if: always()
uses: actions/upload-artifact@v4
with:
name: mcpshield-report
path: mcpshield-report.json
配置文件位置
MCPShield自动发现来自以下位置的配置:
| 客户 | 位置 |
|---|---|
| 克劳德桌面(macOS) | ~/Library/Application Support/Claude/claude_desktop_config.json |
| 克劳德桌面(Windows) | %APPDATA%/Claude/claude_desktop_config.json |
| 克劳德桌面(Linux) | ~/.config/claude/claude_desktop_config.json |
| 光标 | ~/.cursor/mcp.json 或 .cursor/mcp.json |
| 风帆冲浪 | ~/.windsurf/mcp.json |
| VS代码 | .vscode/mcp.json |
| 继续 | ~/.continue/config.json |
示例输出
╔═══════════════════════════════════════════╗
║ ║
║ ⛨ MCPShield v0.1.0 ║
║ MCP Supply Chain Security Scanner ║
║ ║
╚═══════════════════════════════════════════╝
─── SCANNING: User-specified ──────────────────────────
📦 github (mcp-servr-github)
🛑 MALICIOUS PACKAGE DETECTED
Typosquat — contains credential-harvesting payload
Impersonates: mcp-server-github (distance: 1)
↳ REMOVE THIS SERVER IMMEDIATELY
1. CRITICAL MALICIOUS: Typosquat — contains credential-harvesting payload
Confidence: confirmed | Distance: 1 | Method: single character difference
↳ Remove this server and replace with the legitimate package.
─── SCAN SUMMARY ──────────────────────────────────────
Servers scanned: 8
Total findings: 18
CRITICAL 7 findings
HIGH 6 findings
MEDIUM 5 findings
⛨ 1 typosquat(s) detected — immediate action required
⚠ 3 server(s) from unverified publishers
试试看
使用包含的易受攻击配置进行测试:
node src/index.js scan --config examples/vulnerable-config.json
使用干净的配置进行测试:
node src/index.js scan --config examples/clean-config.json
建筑
mcpshield-cli/
├── src/
│ ├── index.js # CLI entry point & orchestrator
│ ├── config.js # Config discovery & parsing
│ ├── typosquat.js # Typosquat detection (Levenshtein + known malicious DB)
│ ├── credentials.js # Credential & permission scanning
│ ├── cvecheck.js # CVE database matching
│ └── output.js # Terminal formatting & report generation
├── data/
│ └── vulndb.js # Vulnerability database, known packages, credential patterns
├── examples/
│ ├── vulnerable-config.json # Test config with intentional issues
│ └── clean-config.json # Clean config for comparison
└── package.json
路线图
- []npm注册表实时查找(验证包是否存在,检查下载计数)
- []实时CVE提要集成(NVD、GitHub咨询数据库)
- []MCP服务器运行时行为分析
- []配置文件监视器(连续监视)
- []VS代码扩展名
- []用于PR检查的GitHub应用程序
- []策略作为代码引擎(OPA/Rego)
许可证
麻省理工学院