Toxy Insecure MCP Lab
An intentionally vulnerable MCP server for security education, demonstrating flaws like missing auth, SSRF, SQLi, and file system abuse.
README
<p align="center"> <strong>Toxy Insecure MCP Lab</strong><br> <sub>Break things on purpose. Learn MCP security by doing.</sub> </p>
<p align="center"> <a href="https://www.python.org/"><img alt="Python 3.11+" src="https://img.shields.io/badge/Python-3.11%2B-3776AB?logo=python&logoColor=white"></a> <a href="https://modelcontextprotocol.io/"><img alt="MCP" src="https://img.shields.io/badge/Protocol-MCP-00C853"></a> <a href="https://docs.docker.com/compose/"><img alt="Docker" src="https://img.shields.io/badge/Deploy-Docker-2496ED?logo=docker&logoColor=white"></a> <a href="https://github.com/toxicaj/vuln_mcp_server"><img alt="Repo" src="https://img.shields.io/badge/GitHub-vuln__mcp__server-181717?logo=github"></a> </p>
⚠️ Read this first
| Rule | Detail |
|---|---|
| Purpose | Offline classrooms, CTF prep, and authorized security research |
| Forbidden | Production, staging, shared hosting, or any internet-facing deployment |
| Expectation | Every weakness here is intentional — do not treat this as a template |
Overview
Modern AI agents call external MCP tools the same way apps call APIs. When those tools skip authentication, trust user input, or run with too much power, attackers inherit that access.
Toxy Insecure MCP Lab models those failures in a single Python service you can drive from any MCP client, curl, or the MCP Inspector.
flowchart LR
A[MCP Client] -->|STDIO / SSE / HTTP| B[Toxy Lab]
B --> C[Open Tools]
B --> D[Weak Auth Tools]
B --> E[File Tools]
B --> F[SSRF Tools]
B --> G[SQLi Tools]
C --> H[(Mock Data)]
D --> H
E --> I[Container FS]
F --> J[Outbound HTTP]
G --> K[(SQLite DB)]
Lab snapshot
| Item | Value |
|---|---|
| Repository | https://github.com/toxicaj/vuln_mcp_server |
| HTTP endpoint | http://localhost:8000/mcp |
| Default creds | admin:admin (Basic Auth on two tools) |
| Database file | /data/toxy_vulnerable_mcp.sqlite |
| Python package | toxy_vulnerable_mcp |
| Maintainer | @toxicaj |
Requirements
- Python 3.11+ or Docker with Compose v2
- An MCP client, MCP Inspector, or
curl - An isolated network (VM, WSL, or local machine — not a shared server)
Installation paths
<details open> <summary><strong>Path A — Docker (recommended)</strong></summary>
git clone https://github.com/toxicaj/vuln_mcp_server.git
cd vuln_mcp_server
docker compose up --build
The service listens on port 8000. Connect your client to http://localhost:8000/mcp.
</details>
<details> <summary><strong>Path B — Local virtualenv</strong></summary>
git clone https://github.com/toxicaj/vuln_mcp_server.git
cd vuln_mcp_server
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
Pick a transport:
| Mode | Command |
|---|---|
| STDIO | python -m toxy_vulnerable_mcp.server --transport stdio |
| SSE | python -m toxy_vulnerable_mcp.server --transport sse |
| HTTP | uvicorn toxy_vulnerable_mcp.http_app:app --host 0.0.0.0 --port 8000 |
Note: Local HTTP/SSE runs need a writable database path. Example:
DATABASE_PATH=/tmp/toxy_vulnerable_mcp.sqlite
</details>
Attack surface
Five independent modules. Each one teaches a different mistake teams make when shipping MCP integrations.
Module 01 — Identity not required
File: toxy_vulnerable_mcp/tools/unauth_tools.py
| Tool | What it leaks |
|---|---|
read_notes |
Internal memos |
list_users |
Employee roster (admin, nina, marcus) |
system_info |
Host paths, env vars, runtime fingerprint |
Try it
{ "name": "system_info", "arguments": {} }
Lesson: If a tool returns sensitive data without a session, every connected agent becomes an insider threat.
Module 02 — Password everyone knows
File: toxy_vulnerable_mcp/tools/auth_tools.py
| Tool | Gate |
|---|---|
get_sensitive_logs |
Basic Auth |
admin_panel |
Basic Auth |
Credentials are hardcoded: admin:admin
Try it (HTTP)
curl http://localhost:8000/mcp \
-u admin:admin \
-H 'Content-Type: application/json' \
-H 'Mcp-Method: tools/call' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_sensitive_logs","arguments":{}}}'
Lesson: Default passwords turn a thin auth layer into theater.
Module 03 — Filesystem god mode
File: toxy_vulnerable_mcp/tools/file_tools.py
| Tool | Capability |
|---|---|
read_file |
Read any path the container can open |
write_file |
Create or overwrite files |
list_directory |
Map directory contents |
Writable mounts: /lab-data · /app/secrets · /data
Try it
{
"name": "write_file",
"arguments": {
"path": "/lab-data/proof.txt",
"content": "MCP tool wrote this with root privileges"
}
}
Lesson: File tools without jails hand agents the keys to the kingdom.
Module 04 — Server-side fetching
File: toxy_vulnerable_mcp/tools/ssrf_tools.py
| Tool | Behavior |
|---|---|
fetch_url |
GET any URL, follow redirects |
import_feed |
Same engine, RSS disguise |
check_webhook |
Blind callback testing |
Try it
{ "name": "fetch_url", "arguments": { "url": "http://127.0.0.1:8000/mcp" } }
{ "name": "fetch_url", "arguments": { "url": "http://169.254.169.254/latest/meta-data/" } }
Lesson: Unrestricted egress lets callers scan localhost and cloud metadata from inside your network.
Module 05 — String-built SQL
File: toxy_vulnerable_mcp/tools/sqli_tools.py
| Tool | Injection point |
|---|---|
search_user |
username in LIKE clause |
login_user |
username + password in WHERE |
get_order |
order_id in numeric context |
Try it — auth bypass
{
"name": "login_user",
"arguments": { "username": "admin' --", "password": "x" }
}
Try it — UNION extraction
{
"name": "get_order",
"arguments": {
"order_id": "1 UNION SELECT id, record_type, secret_value, 0, 'leak' FROM admin_records"
}
}
Lesson: Concatenating user input into SQL is an open invitation to dump tables you never meant to expose.
HTTP cheat sheet
Three calls cover most manual testing:
1. Initialize
curl -i http://localhost:8000/mcp \
-H 'Content-Type: application/json' \
-H 'Mcp-Method: initialize' \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"lab","version":"1.0"}}}'
2. List tools
curl http://localhost:8000/mcp \
-H 'Content-Type: application/json' \
-H 'Mcp-Method: tools/list' \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}'
3. Call a tool
curl http://localhost:8000/mcp \
-H 'Content-Type: application/json' \
-H 'Mcp-Method: tools/call' \
-d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"list_users","arguments":{}}}'
Directory map
vuln_mcp_server/
│
├─ docker-compose.yml # One-command lab spin-up
├─ Dockerfile # Root-user image (intentional)
├─ lab-data/ # Writable practice files
├─ secrets/ # Fake credentials for file-read labs
│
└─ toxy_vulnerable_mcp/
├─ server.py # MCP entry + transport launcher
├─ http_app.py # HTTP wrapper + Basic Auth middleware
├─ auth.py # admin:admin validator
├─ database.py # SQLite seed data
├─ data.py # Mock notes, users, logs
└─ tools/
├─ unauth_tools.py
├─ auth_tools.py
├─ file_tools.py
├─ ssrf_tools.py
└─ sqli_tools.py
Logging & debugging
Everything runs at DEBUG by default. Watch for:
Open * invocation— unauthenticated tool hitsBasic Auth gate triggered— credential checks on protected toolsOutbound request issued to— SSRF attemptsRunning unsafe SQL statement— full query text before executionread_file/write_file/list_directory— filesystem operations
docker compose logs -f
FAQ
Q: Can I rename the repo folder after cloning?
A: Yes. The folder name does not affect runtime behavior.
Q: Why does local setup fail on /data?
A: The default DB path targets the Docker layout. Set DATABASE_PATH=/tmp/toxy_vulnerable_mcp.sqlite when running natively.
Q: Do I need to wipe Docker volumes between runs?
A: Only if you changed the database filename or seed schema. docker compose down -v resets state.
Q: Are the employee names and API keys real?
A: No. All records are synthetic classroom material.
Hardening checklist
Use this after completing each module:
- [ ] Require authentication before any data-bearing tool executes
- [ ] Eliminate default credentials; integrate a real identity provider
- [ ] Remove open-ended file primitives or jail them to a single directory
- [ ] Block private IP ranges and metadata hosts on outbound fetches
- [ ] Parameterize every SQL statement; hash passwords at rest
- [ ] Run containers as non-root with read-only root filesystems
- [ ] Log security events without printing secrets or full queries in production
Legal & ethics
Deploy only on systems you own or have explicit written permission to test. The maintainer provides this software as-is for education — misuse against third parties is your responsibility.
<p align="center"> <strong>Built by <a href="https://github.com/toxicaj">toxicaj</a></strong><br> <sub>Teaching MCP attack surface, one broken tool at a time.</sub> </p>
<p align="center"> <code>mcp</code> · <code>security</code> · <code>vulnerable</code> · <code>education</code> · <code>ssrf</code> · <code>sqli</code> · <code>ai-security</code> </p>
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。