Demonstrates vulnerabilities in insecure MCP servers including SQL injection, data exposure, and lacks access control.
This project serves as an illustrative sandbox environment designed to highlight potential security vulnerabilities within Model Context Protocol (MCP) infrastructure. Specifically, it demonstrates a flawed MCP server that exposes several insecure tools and clients with varying levels of complexity for educational purposes. The setup includes both "good" and "attack" clients, enabling users to explore the protocol's capabilities and the risks inherent in its unsecured implementation.
This demonstration project offers a unique glimpse into the core features and potential vulnerabilities of an MCP server. By providing direct access to a range of functionalities such as data insertion, querying, SQL command execution, and environmental variable retrieval, this setup exposes critical points for security improvements. The inclusion of both benign ("good") and malicious ("attack") clients showcases different ways in which these endpoints can be exploited, facilitating comprehensive educational resources on secure protocol design.
The architecture of the Insecure MCP Demo Server is designed to mimic a real-world scenario where an AI application connects to a data source or tool via the Model Context Protocol. This server implements various tools that illustrate potential risks, such as unsanitized input, lack of authentication, and unrestricted access to sensitive information. The protocol flow diagram below outlines how these vulnerabilities might manifest in actual implementations.
graph TD
A[AI Application] -->|MCP Client| B[MCP Protocol]
B --> C[MCP Server]
C --> D[Data Source/Tool]
style A fill:#e1f5fe
style C fill:#f3e5f5
style D fill:#e8f5e8
To set up and run this Insecure MCP Demo Server, follow these steps:
pip install -r requirements.txt
In one terminal window:
python good-mcp-client.py vuln-mcp.py
This will guide you through an interactive session where you can insert and query records using a basic client.
Open another terminal window:
python attack-mcp-client.py vuln-mcp.py
The attack client will automatically execute a series of tests to demonstrate potential security breaches, including SQL injection attempts and environment variable access.
While this setup is intentionally insecure, its configuration offers valuable insights into how different AI applications might be affected under real-world conditions. For instance:
The Insecure MCP Demo Server is compatible with several popular MCP clients:
MCP Client | Resources | Tools | Prompts | Status |
---|---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ | Full Support |
Continue | ✅ | ✅ | ✅ | Full Support |
Cursor | ❌ | ✅ | ❌ | Tools Only |
For full compatibility, ensure that the respective clients support the features exposed by this server.
The performance and compatibility of the Insecure MCP Demo Server depend on the specific tools and functionalities enabled. For detailed metrics and testing results, refer to the project's codebase and documentation.
To mitigate the risks highlighted in this demo project:
execute_sql
and get_env_variable
.Can I use this server in a live environment?
How do I secure the execute_sql
tool?
What are some common tools that should be restricted?
get_env_variable
, execute_sql
, and unrestricted record queries pose significant risks and should be carefully vetted.How can I monitor the server's performance?
Why is environment variable access a security concern?
Contributions are welcome! To contribute:
For technical inquiries or contributions, please reach out to the project maintainer via the GitHub issue tracker.
Explore more resources within the broader MCP ecosystem:
By addressing these vulnerabilities and adhering to best practices, developers can ensure that their AI applications interact securely through the Model Context Protocol.
Learn to connect to MCP servers over HTTP with Python SDK using SSE for efficient protocol communication
Next-generation MCP server enhances documentation analysis with AI-powered neural processing and multi-language support
Build a local personal knowledge base with Markdown files for seamless AI conversations and organized information.
Integrate AI with GitHub using MCP Server for profiles repos and issue creation
Python MCP client for testing servers avoid message limits and customize with API key
Explore MCP servers for weather data and DigitalOcean management with easy setup and API tools