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 with Custom Headers
mcpsec fuzz --http http://localhost:8080/mcp -H "Authorization: Bearer <token>"

# 🎭 Launch a Rogue Server to test your client (Cursor/Claude)
mcpsec rogue-server --port 9999 --attack all

# 🧠 Run AI-Powered Fuzzing
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 (v1.0.3)

mcpsec v1.0.2 introduces the Rogue MCP Server, a powerful framework for testing client-side vulnerabilities, along with support for custom HTTP headers to audit authenticated servers.

  • 🎭 Rogue MCP Server: Launch a malicious server with --attack vectors targeting Claude Desktop, Cursor, and VS Code. (Memory bombs, XSS, Proto Pollution, etc.)
  • 🔐 Custom Headers: Pass any token or cookie via --header / -H. Essential for protected Supabase, Slack, or GitHub deployments.
  • 500+ Security Test Cases: Exhaustive coverage for malformed JSON, protocol violations, and memory exhaustion.
  • AI-Powered Payloads: Context-aware adversarial payloads tailored to your server's specific tool schemas.
  • Improved Compatibility: Optimized for Windows (Proactor loop fixes) and strict protocol clients (Claude Desktop handshake).
  • 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.3.tar.gz (92.2 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.3-py3-none-any.whl (116.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mcpsec-1.0.3.tar.gz
  • Upload date:
  • Size: 92.2 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.3.tar.gz
Algorithm Hash digest
SHA256 3de2b06f0544c96859ff9a4413ca9d0b53651012ea8774608a3ad97a1b826a65
MD5 7846125587df8b9a9de1480a61bff253
BLAKE2b-256 02275ce3ca7aa267e74fa43cc47e2bbbb1ae4bf3e4481797d2cbe83e505bdf16

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcpsec-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 116.5 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 461d450a05055afb68211ead037c0c74494b637567fe7aa6e91bedfda21f1149
MD5 a4bfadf5beeeb982b74d936e2d580247
BLAKE2b-256 5e537923e37fef4e290f8ab615991eb579e131964c76279ba6830469267f7dfe

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