mysql-mcp-server
Verified Safeby duckduck93
Overview
Exposes MySQL database functionalities as tools via Model Context Protocol (MCP) over stdio.
Installation
docker run --rm -it -e MYSQL_HOST=host.docker.internal -e MYSQL_PORT=3306 -e MYSQL_USER=root -e MYSQL_PASSWORD=secret -e MYSQL_DATABASE=mydb mysql-mcp-serverEnvironment Variables
- MYSQL_HOST
- MYSQL_PORT
- MYSQL_USER
- MYSQL_PASSWORD
- MYSQL_DATABASE
Security Notes
The server utilizes parameterized queries via `mysql2/promise.execute` for `query` and `execute` tools, effectively mitigating SQL injection risks for user-provided SQL and parameters. Table names are also safely handled as parameters in `information_schema` queries (e.g., `describe_table`, `show_indexes`). It operates over stdio, meaning no network ports are exposed by the server itself, reducing direct network attack surface. Environment variables are used for all database credentials, preventing hardcoded secrets. Error logging to `process.stderr` includes input parameters for debugging, which is a minor consideration if sensitive data is passed directly in parameters and logged.
Similar Servers
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.
postgres-mysql-mcp-server
A Model Context Protocol (MCP) server that enables AI assistants to query PostgreSQL and MySQL databases for schema introspection and data retrieval.
mysql_mcp_server
This server provides a Model Context Protocol (MCP) interface to a MySQL database, enabling AI models to execute SQL queries and retrieve database schema information.
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.