mcp_server_mysql
by jasbir125
Overview
Exposes MySQL database operations as tools for AI assistants via the Model Context Protocol (MCP).
Installation
python mcp_server_mysql.pyEnvironment Variables
- MYSQL_HOST
- MYSQL_USER
- MYSQL_PASSWORD
- MYSQL_DB
- MYSQL_PORT
Security Notes
The `run_query` function directly executes arbitrary SQL passed as a string from the AI assistant. This presents a critical SQL injection vulnerability if the AI's output is not perfectly controlled and sanitized, or if a prompt injection attack occurs. While other functions use parameterized queries, `run_query` lacks any input validation or sanitization, making it highly susceptible to malicious or accidental database modifications and data exfiltration.
Similar Servers
mcp
Provides a Model Context Protocol (MCP) interface for managing and querying MariaDB databases, supporting standard SQL operations and advanced vector/embedding-based search for AI assistants.
mcp-mysql-server
Provides an MCP-compliant interface for AI models to securely interact with a MySQL database for CRUD operations, schema inspection, and performance analysis.
mysql-mcp
Provides an MCP (Model Context Protocol) server for MySQL, enabling AI agents to programmatically interact with and manage MySQL databases.
mcp_sql_demo
Provides secure, multi-database access for LLMs to inspect MySQL schemas and execute SQL queries, supporting both read and configurable write operations with fine-grained schema-specific permissions.