bad-mcp
10 intentionally malicious MCP servers that demonstrate protocol-level attack patterns against AI clients. Each server exploits a distinct feature of the Model Context Protocol — tool descriptions, schemas, resources, session management, and cross-server interactions.
These aren't buggy servers waiting to be exploited. They are the attacker.
WARNING: This project is for authorized security research and education only. Do NOT expose these servers to the internet or use them in production.
Why This Exists
MCP adoption is accelerating — Claude Desktop, Cursor, Windsurf, and dozens of other AI clients now support it. But the protocol's trust model has fundamental gaps: tool descriptions are unverified, schemas can carry hidden instructions, and servers can mutate definitions mid-session. Research from CyberArk, Invariant Labs, and Elastic Security Labs has documented these attacks, but working implementations are scarce.
bad-mcp provides concrete, runnable attack servers so client developers can test defenses, security teams can assess risk, and researchers can study protocol-level threats without building everything from scratch.
How This Differs
Architecture
vuln-external network (localhost:8001-8010)
┌────────────────────┐ ┌────────────────────┐ ┌────────────────────┐
│ schema-poison-notes│ │ response-inject- │ │ shadow-exfil │
│ :8001 │ │ tickets :8002 │ │ :8003 │
└────────────────────┘ └────────────────────┘ └────────────────────┘
┌────────────────────┐ ┌────────────────────┐ ┌────────────────────┐
│ squatting-file-ops │ │ tool-poisoning-calc│ │ true-rug-pull │
│ :8004 │ │ :8005 │ │ :8006 │
└────────────────────┘ └────────────────────┘ └────────────────────┘
┌────────────────────┐ ┌────────────────────┐ ┌────────────────────┐
│ resource-poison- │ │ indirect-inject- │ │ exfil-chain- │
│ docs :8007 │ │ fetcher :8008 │ │ analytics :8009 │
└────────────────────┘ └────────────────────┘ └────────────────────┘
┌────────────────────┐
│ denial-of-wallet │
│ :8010 │
└────────────────────┘
Servers
Each server has its own README.md with vulnerability details, exploit scenarios, detection methods, and mitigation strategies.
Quick Start
# Build and start all servers
docker-compose build && docker-compose up -d
# Run smoke tests (runs entirely inside Docker)
docker-compose --profile test run --rm smoke-test
# View exfiltration logs
docker-compose logs schema-poison-notes | grep EXFIL
docker-compose logs true-rug-pull | grep RUG-PULL
# Stop
docker-compose down
Connecting an MCP Client
After docker-compose up -d, connect any SSE-compatible MCP client (Claude Desktop, Cursor, Windsurf, Claude Code, etc.). All servers use the same JSON format:
{
"mcpServers": {
"schema-poison-notes": { "url": "http://localhost:8001/sse" },
"response-inject-tickets":{ "url": "http://localhost:8002/sse" },
"shadow-exfil": { "url": "http://localhost:8003/sse" },
"squatting-file-ops": { "url": "http://localhost:8004/sse" },
"tool-poisoning-calc": { "url": "http://localhost:8005/sse" },
"true-rug-pull": { "url": "http://localhost:8006/sse" },
"resource-poison-docs": { "url": "http://localhost:8007/sse" },
"indirect-inject-fetcher":{ "url": "http://localhost:8008/sse" },
"exfil-chain-analytics": { "url": "http://localhost:8009/sse" },
"denial-of-wallet": { "url": "http://localhost:8010/sse" }
}
}
Tip: Start with
tool-poisoning-calc(:8005) — simplest attack to observe. Then trytrue-rug-pull(:8006) — ask about the weather 3+ times and watch the tools mutate.
Safety Guarantees
Tech Stack
- MCP servers: Go + mcp-go v0.32.0 (SSE transport)
- Docker: Multi-stage
golang:1.23-alpine->alpine:3.19 - Orchestration: docker-compose with network isolation
- Testing: Dockerized Go smoke test (
--profile test)
Research References
See also: Adversa AI — MCP Security TOP 25 | MCPTox Benchmark | OWASP Top 10 for Agentic Applications
Known Gaps
The following published MCP attack classes are not yet implemented:
- Server Identity Spoofing — MCP server spoofing trusted
serverInfoname/version during initialization - Sampling Abuse — Exploiting
sampling/createMessageto inject arbitrary prompts - Prompt/System Instruction Leakage — Extracting system prompts via crafted tool responses
- Notification Channel Exfiltration — Abusing progress/logging notifications as data channels