Mcpwn

Automated security scanner for Model Context Protocol servers that detects RCE, path traversal, prompt injection, and protocol vulnerabilities.

LLM Mart 1 views 71 listing impressions

If this project helps your work, support ongoing maintenance and new features.

ETH Donation Wallet
0x11282eE5726B3370c8B480e321b3B2aA13686582

Ethereum donation QR code

Scan the QR code or copy the wallet address above.

Mcpwn — MCP Security Testing Framework

Python License MCP Tests Coverage

Mcpwn is an automated security scanner for Model Context Protocol servers. It speaks MCP over stdio and Streamable HTTP, exercises tool arguments, resources, metadata, protocol state and authorization boundaries, and reports only evidence-backed findings.

One vulnerable tool can mean full host compromise for the agent.

Safety first

Active tests that can flood, exhaust or delay a target are disabled by default. Enable them deliberately:

python3 mcpwn.py --allow-destructive ...   # resource exhaustion, floods, timing
python3 mcpwn.py --safe-mode ...           # skip destructive and fuzzing suites

All probes are bounded by --max-requests, --max-concurrency, --max-payload-bytes and --flood-count. See THREAT_MODEL.md.

Quick start

git clone https://github.com/Teycir/Mcpwn.git
cd Mcpwn

# Non-destructive scan of the bundled vulnerable demo server
python3 mcpwn.py --safe-mode --output-json report.json \
    python3 test_data/dvmcp_server.py

# Fast RCE-only scan
python3 mcpwn.py --quick --rce-only python3 test_data/dvmcp_server.py

# Streamable HTTP endpoint
python3 mcpwn.py --target http://127.0.0.1:8080/mcp \
    --header "Authorization: Bearer $MCP_TOKEN" \
    --output-json report.json

Python 3.9+ is required. The scanner uses only the standard library; the development tools (pytest, flake8, bandit) live in requirements-dev.txt.

GitHub-hosted MCP servers

Mcpwn can discover MCP repositories through the GitHub API and assess them without executing code. Put a token in the local, gitignored .env:

cp .env.example .env
# edit .env: Github_Token=github_pat_...
# Discover and profile repositories (metadata + bounded source inspection)
python3 mcpwn.py --github-search "topic:mcp-server language:python" \
    --github-limit 5 --github-json github-report.json \
    --github-markdown github-report.md

# Profile one repository
python3 mcpwn.py --github-repo modelcontextprotocol/servers \
    --github-json github-report.json

# Inspect the Docker command without running the repository
python3 mcpwn.py --github-repo owner/repo --github-run --github-dry-run \
    --allow-remote-code

# Run a launch recipe in the sandbox (requires Docker)
python3 mcpwn.py --github-repo owner/repo --github-run \
    --allow-remote-code --github-network --github-json github-report.json

Static mode reports review indicators (install scripts, unpinned dependencies, dangerous process/network surfaces) and launch candidates. Runtime mode is opt-in: --github-run requires --allow-remote-code and executes only inside a Docker container with a read-only root, dropped capabilities, no-new-privileges and network disabled by default. The token is never passed to the sandbox or written to a report. See GITHUB_TESTING.md.

What it checks

From the project's README.

Related servers

Read and write RAGE Package Format archives

23 views

See how ChatGPT, Claude, Gemini and Perplexity read any website. Scored out of 100.

19 views

MCP server for Geargrafx PC Engine / TurboGrafx-16 emulator

19 views

Governance runtime for compliance: verified, human-approved writes to a tamper-evident record.

15 views