Skip to main content

Security scanner and protocol fuzzer for MCP (Model Context Protocol) servers. Found and reported vulnerabilities in official Anthropic and GitHub MCP implementations.

Project description

⚡ mcpsec

License: MIT Python 3.11+ PyPI Found Bugs Servers Tested Fuzz Cases

Security scanner for MCP (Model Context Protocol) server implementations.

MCP is the universal protocol connecting AI agents (Claude, ChatGPT, Gemini, Cursor) to external tools and data sources. It's adopted by every major AI company — Anthropic, OpenAI, Google, Microsoft. Its security is broken. mcpsec finds the vulnerabilities.

  ███╗   ███╗ ██████╗██████╗ ███████╗███████╗ ██████╗
  ████╗ ████║██╔════╝██╔══██╗██╔════╝██╔════╝██╔════╝
  ██╔████╔██║██║     ██████╔╝███████╗█████╗  ██║     
  ██║╚██╔╝██║██║     ██╔═══╝ ╚════██║██╔══╝  ██║     
  ██║ ╚═╝ ██║╚██████╗██║     ███████║███████╗╚██████╗
  ╚═╝     ╚═╝ ╚═════╝╚═╝     ╚══════╝╚══════╝ ╚═════╝

Why?

  • 82% of MCP implementations have path traversal vulnerabilities (Endor Labs)
  • 67% are vulnerable to code injection
  • ~2,000 internet-exposed MCP servers found with zero authentication (Knostic)
  • Anthropic's own Git MCP server had 3 critical RCE vulnerabilities (CVE-2025-68143/44/45)
  • Nobody built an open-source scanner for this. Until now.

Proven Results

mcpsec has been used to discover and responsibly report multiple vulnerabilities across official MCP implementations by major technology companies. Findings include transport-layer crashes, unhandled exception panics, and protocol-level denial of service issues affecting the Python SDK, TypeScript SDK, and Go SDK ecosystems.

  • 5 bugs reported across Anthropic and GitHub MCP implementations
  • 3 SDK ecosystems affected (Python, TypeScript, Go)
  • Fixes submitted within hours of initial reports
  • Reproduced known CVEs: CVE-2025-53967 (Figma MCP), CVE-2025-53818 (Kanban MCP)
  • SQL injection confirmed in community MCP servers via static analysis

Details will be published following responsible disclosure timelines.

Install

pip install mcpsec

Quick Start

# Scan an MCP server running via stdio
mcpsec scan --stdio "npx @modelcontextprotocol/server-filesystem /tmp"

# 💥 Run Mega Fuzzer (500+ security test cases)
mcpsec fuzz --stdio "python my_server.py" --intensity high

# 🧠 Run AI-Powered Fuzzing (Context-aware adversarial payloads)
# Requires OPENAI_API_KEY
mcpsec fuzz --stdio "python my_server.py" --ai

# Enumerate attack surface
mcpsec info --stdio "python my_server.py"

# Static Audit (Source Code Analysis)
mcpsec audit --path . --ai

# List available scanners
mcpsec list-scanners

Mega Fuzzer (New in v1.0.1)

mcpsec v1.0.1 introduces a significantly expanded fuzzing engine designed to find edge cases in MCP protocol handlers and tool implementations, along with critical fixes for OS-level buffer deadlocks preventing deep scanning of huge target stacks like the Kubernetes server.

  • 500+ Security Test Cases: Exhaustive coverage for malformed JSON, protocol violations, type confusion, boundary values, and encoding attacks.
  • AI-Powered Payloads: Use --ai to leverage LLMs to generate context-aware adversarial payloads based on your server's specific tool schemas.
  • Enhanced Reliability: Completely resolved a major "Fuzzer State Desync" bug that caused pipe deadlocks when target servers crashed under intense payloads.
  • Custom Timeouts: Use --timeout (default 5.0s) to accommodate slower target servers like Puppeteer without triggering premature hang detections.
  • Refined Intensity Tiers:
    • low: Core protocol smoke tests (~65 cases)
    • medium: Standard security baseline (~150 cases)
    • high: Full regression suite (500+ cases)
    • insane: Includes resource exhaustion and DoS patterns
    • ai: High intensity + AI-generated payloads

Scanners

Scanner Type What It Detects
prompt-injection Static Hidden instructions, base64-encoded payloads, cross-tool manipulation, data exfiltration indicators in tool descriptions
auth-audit Static Missing authentication, over-permissioned tools, dangerous tool combinations, misleading annotations
path-traversal Dynamic File path traversal via ../../ payloads — proves exploitation with actual file contents
command-injection Dynamic OS command injection via shell escape characters — proves exploitation with command output
ssrf Dynamic Server-Side Request Forgery targeting cloud metadata endpoints and internal services
protocol-fuzzer Dynamic (500+ Cases) Malformed JSON-RPC, boundary testing, state-machine violations, type confusion to find crashes
ai-payloads Dynamic (New) Context-aware payloads generated by LLMs (SQLi, Logic bugs, Edge cases)

How It Works

┌─────────┐     MCP Protocol      ┌────────────┐
│ mcpsec  │ ◄──── JSON-RPC ────►  │ Target MCP │
│ client  │    (stdio or HTTP)    │   Server   │
└────┬────┘                       └────────────┘
     │
     ├── 1. Connect (stdio subprocess or HTTP)
     ├── 2. Enumerate tools, resources, prompts  
     ├── 3. Run static scanners (analyze descriptions)
     ├── 4. Generate & Run dynamic payloads (Fuzzing + AI)
     └── 5. Report findings with evidence + remediation

Features

  • ✅ Prompt injection scanner
  • ✅ Authentication & authorization audit
  • ✅ Path traversal scanner (dynamic proof-of-exploitation)
  • ✅ Command injection scanner (dynamic proof-of-exploitation)
  • ✅ SSRF scanner
  • ✅ JSON report output
  • ✅ Static source code analysis with Semgrep rules
  • ✅ Protocol Fuzzer (500+ adversarial test cases)
  • ✅ AI-Powered Fuzzing (LLM-generated payloads per tool schema)
  • ✅ Custom timeouts for slow targets (--timeout)

Contributing

Contributions welcome! See CONTRIBUTING.md for details on how to set up your environment and add new scanners.

Disclaimer

This tool is intended for authorized security testing only. Only scan MCP servers you own or have explicit permission to test. The authors are not responsible for misuse.

License

MIT


Built by Manthan — because your AI agents deserve a pentest too.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcpsec-1.0.1.tar.gz (85.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcpsec-1.0.1-py3-none-any.whl (108.7 kB view details)

Uploaded Python 3

File details

Details for the file mcpsec-1.0.1.tar.gz.

File metadata

  • Download URL: mcpsec-1.0.1.tar.gz
  • Upload date:
  • Size: 85.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for mcpsec-1.0.1.tar.gz
Algorithm Hash digest
SHA256 5b474f39fd92a258b50741b223c296d989e4d93b0a71d1d93d29f90fcfc653e7
MD5 5bc9d2220e33f1769a6b9227dd913b50
BLAKE2b-256 3cbcc8dab468511a8c3845168d1a536de4b02a7ed72ae46fe40355c4a3b033ad

See more details on using hashes here.

File details

Details for the file mcpsec-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: mcpsec-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 108.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for mcpsec-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3f8c3bb0ff2b6146da62b3c53a7abf5f7034279fcd0d0d7bd6efc0173138700a
MD5 b8109251760b0c1704a56b2c33a3a1b5
BLAKE2b-256 14a30733c3172876ae7f9e775faa449e6d7975f0b98ba973d76ddc9ecbdab3a0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page