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.2.tar.gz (86.0 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.2-py3-none-any.whl (108.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mcpsec-1.0.2.tar.gz
  • Upload date:
  • Size: 86.0 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.2.tar.gz
Algorithm Hash digest
SHA256 c206b847046c6a88e9ff1de3eb8e3410f905ab7f8916b03d284c562ffce40534
MD5 1beb3f627ca6d7ec6eb4dcea6dfb9cb9
BLAKE2b-256 e1afec03c17599f608d473fe551d539a4b1c038e180f686acb4c5a49f7c7ee7d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcpsec-1.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 13ce70ec52ada1de645a023aa366cfbfc41ae6e65a638b417aac7c93d137a609
MD5 2068a8fd94045ca7c57c41f58e14a042
BLAKE2b-256 a435e7b6dcfe00b5911fd9ad2e1bc5387d96a83d38959ebe4fe23d70c2a1a344

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