An MCP server implementation that enables Claude AI to interact with MySQL databases.
Configuration
View docs{
"mcpServers": {
"burakdirin-mysqldb-mcp-server": {
"command": "uvx",
"args": [
"mysqldb-mcp-server"
],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_USER": "root",
"MYSQL_DATABASE": "[optional]",
"MYSQL_PASSWORD": "password",
"MYSQL_READONLY": "true"
}
}
}
}This MCP server lets you connect to a MySQL database and run SQL queries through a standardized MCP interface. It abstracts database interactions behind two core tools, enabling you to connect to a database and execute arbitrary SQL safely from any MCP client.
You interact with this server through an MCP client by invoking its two available tools. Use the first to establish a connection to a specific MySQL database, and then use the second to run one or more SQL queries. The server will return confirmations for successful connections and JSON-formatted query results for your requests. You can chain multiple queries in a single request by separating them with semicolons.
Prerequisites: ensure Python and/or the Python package manager are available on your system. You may also use the MCP runtime tool available in your environment.
Install the MCP server package using your preferred tool:
uv pip install mysqldb-mcp-serverAlternatively, install directly with Python’s package manager:
pip install mysqldb-mcp-serverEnvironment variables configure how the server connects to your MySQL instance. Set these in your runtime environment before starting the server.
Required environment variables and their purposes:
Run the server with the minimum necessary permissions and enable read-only mode if you only need data access without writes. For debugging, use the MCP Inspector to visualize runtime interactions and query flows.
Connects to a specific MySQL database with a given database name and returns a confirmation message on success.
Executes SQL query or queries and returns results in JSON format; multiple queries can be sent separated by semicolons.