mcp-vulnerable -demo
MCP server from kenhuangus/mcp-vulnerable-server-demo
claude mcp add --transport stdio kenhuangus-mcp-vulnerable-server-demo python vuln-mcp.py \ --env Description="Environment variable placeholders if needed by the server (e.g., DB connection strings)."
How to use
This MCP server implements an intentionally vulnerable MCP backend for educational purposes. It exposes tools such as insert_record, query_records, execute_sql, and get_env_variable to demonstrate common security pitfalls like SQL injection, unprotected data access, and environment variable leakage. To use it, first start the server with Python, then connect using the provided good client for normal interactions or the attack client to observe how vulnerabilities can be exploited. The good client interactively inserts and queries records, while the attack client automatically attempts SQL injection, executes arbitrary queries, and reads environment variables to illustrate potential data exposure and control risks.
How to install
Prerequisites: Python 3.x and internet access. Optional: virtual environments. Steps:
- Ensure Python is installed: python --version
- Install dependencies: pip install -r requirements.txt
- Start the vulnerable MCP server: python vuln-mcp.py
- In a separate terminal, run the good client to interact normally: python good-mcp-client.py vuln-mcp.py
- In another terminal, run the attack client to demonstrate vulnerabilities: python attack-mcp-client.py vuln-mcp.py
Additional notes
Tips and caveats:
- This project is for educational demonstration only. Do not deploy in production.
- The server intentionally exposes dangerous tools (execute_sql, get_env_variable) to illustrate security risks; in real environments, remove or tightly restrict these tools.
- Use parameterized queries to prevent SQL injection (example in the repository's mitigation notes).
- Consider implementing authentication and authorization, input validation, and access controls before exposing database or system commands.
- If environment variables contain sensitive data, limit exposure and sanitize results returned by get_env_variable.
Related MCP Servers
mcp-vegalite
MCP server from isaacwasserman/mcp-vegalite-server
github-chat
A Model Context Protocol (MCP) for analyzing and querying GitHub repositories using the GitHub Chat API.
nautex
MCP server for guiding Coding Agents via end-to-end requirements to implementation plan pipeline
pagerduty
PagerDuty's official local MCP (Model Context Protocol) server which provides tools to interact with your PagerDuty account directly from your MCP-enabled client.
futu-stock
mcp server for futuniuniu stock
mcp -boilerplate
Boilerplate using one of the 'better' ways to build MCP Servers. Written using FastMCP