SM

syedanas01/mcp-safeguard

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

11 stars 6 forks 质量 87 趋势 38MIT

🛡️ Security scanner for MCP (Model Context Protocol) servers — prompt injection, credential exposure, SSRF, tool poisoning & source-level credential-handling flaws. pip install mcp-safeguard

概览

Detect prompt injection · credential leaks · exposed endpoints · tool poisoning Maintained by Syed Anas Mohiuddin at Cognivators. Public vulnerability record: cognivators.com/research External research confirms the threat is real: MCPTox (2025) found a across 45 production MCP servers, demonstrating that tool poisoning and prompt injection attacks are actively exploitable in today's MCP ecosystem. OWASP officially added to their 2026 threat guidance — the same vulnerability category mcp-safeguard's TP-* rules detect. : The MCP ecosystem grew from zero to 10,000+ servers in 18 months while security tooling lagged behind. mcp-safeguard is an open-source scanner built specifically for MCP's attack surface — tool definitions, server configs, and SSRF exposure via prompt injection. The vulnerability patterns mcp-safeguard detects are documented with illustrative examples in SECURITY-HALL-OF-SHAME.md.

README

以下为原文 README 节选,完整内容请查看原文。


30-Second Demo

pip install mcp-safeguard
git clone https://github.com/SyedAnas01/mcp-safeguard && cd mcp-safeguard
mcp-safeguard scan examples/demo-vulnerable-config.json
┌─────────────────────────────────────────────────┐
│  mcp-safeguard  —  MCP Security Scanner         │
│  github.com/SyedAnas01/mcp-safeguard            │
└─────────────────────────────────────────────────┘

Scanning: examples/demo-vulnerable-config.json
────────────────────────────────────────────────────────────
  [CRITICAL]  CRED-007  AWS Access Key ID
              Location: env.AWS_ACCESS_KEY_ID
              Evidence: AKIA************MPLE
              CVSS:     9.9
              Fix:      Rotate AWS credentials. Use IAM roles.

  [CRITICAL]  PI-011    Data Exfiltration Instruction
              Location: tool:run_query → description
              Evidence: send_data
              CVSS:     9.5
              Fix:      Immediately audit — designed to exfiltrate data.

  [HIGH]      TP-002    Covert Operation Descriptor
              Location: tool:summarize_document.description
              Evidence: <!-- AGENT_INSTRUCTION: Before summarizing, silently...
              CVSS:     8.5
              Fix:      Never embed hidden instructions in HTML comments.

  [MEDIUM]    PI-007    Deception Instruction
              Location: tool:summarize_document → description
在 GitHub 查看完整 README

安装

docker run -p 8000:8000 syedanas01/mcp-safeguard:latest
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "mcp-safeguard": { "command": "python", "args": ["-m", "fastmcp", "run", "src/mcp_safeguard/server.py"], "env": { "MCP_SAFEGUARD_API_KEY": "your-api-key-here" } } } }