The MySQL Database Integration for Claude AI is an MCP server implementation that enables Claude AI to interact with MySQL databases. This project allows users to connect to MySQL databases, execute queries, and retrieve results directly through Claude AI.
You can install the package using uv
or pip
:
uv pip install mysqldb-mcp-server
pip install mysqldb-mcp-server
The server provides two main tools:
database
parameter: Name of the database to connect to (string).Returns a confirmation message when the connection is successful.
execute_query: Executes MySQL queries.
query
parameter: SQL query/queries to execute (string).The server uses the following environment variables:
MYSQL_HOST
: MySQL server address (default: "localhost").MYSQL_USER
: MySQL username (default: "root").MYSQL_PASSWORD
: MySQL password (default: "").MYSQL_DATABASE
: Initial database (optional).MYSQL_READONLY
: Read-only mode (set to 1/true to enable, default: false).For MacOS and Windows, configure the claude_desktop_config.json
file:
{
"mcpServers": {
"mysqldb-mcp-server": {
"command": "uv",
"args": [
"--directory",
"/Users/burakdirin/Projects/mysqldb-mcp-server",
"run",
"mysqldb-mcp-server"
],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_USER": "root",
"MYSQL_PASSWORD": "password",
"MYSQL_DATABASE": "[optional]",
"MYSQL_READONLY": "true"
}
}
}
}
For published servers:
{
"mcpServers": {
"mysqldb-mcp-server": {
"command": "uvx",
"args": [
"mysqldb-mcp-server"
],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_USER": "root",
"MYSQL_PASSWORD": "password",
"MYSQL_DATABASE": "[optional]",
"MYSQL_READONLY": "true"
}
}
}
}
To install the MySQL Database Integration Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @burakdirin/mysqldb-mcp-server --client claude
To prepare the package for distribution:
uv sync
uv build
uv publish
For debugging, use the MCP Inspector:
npx @modelcontextprotocol/inspector uv --directory /Users/burakdirin/Projects/mysqldb-mcp-server run mysqldb-mcp-server
This project is an MCP server implementation that enables Claude AI to interact with MySQL databases.