Provides tools to connect to MySQL databases and execute SQL queries, with support for multiple queries, returning results in JSON format. Configurable for different MySQL environments and includes optional read-only mode.
mysqldb-mcp-server MCP server
A MySQL database MCP server project.
Installation
You can install the package using uv
:
Or using pip
:
Components
Tools
The server provides two tools:
connect_database
: Connects to a specific MySQL databasedatabase
parameter: Name of the database to connect to (string)- Returns a confirmation message when connection is successful
execute_query
: Executes MySQL queriesquery
parameter: SQL query/queries to execute (string)- Returns query results in JSON format
- Multiple queries can be sent separated by semicolons
Configuration
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)
Quickstart
Installation
Claude Desktop
MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
Installing via Smithery
To install MySQL Database Integration Server for Claude Desktop automatically via Smithery:
Development
Building and Publishing
To prepare the package for distribution:
- Sync dependencies and update lockfile:
- Build package distributions:
This will create source and wheel distributions in the dist/
directory.
- Publish to PyPI:
Note: You'll need to set PyPI credentials via environment variables or command flags:
- Token:
--token
orUV_PUBLISH_TOKEN
- Or username/password:
--username
/UV_PUBLISH_USERNAME
and--password
/UV_PUBLISH_PASSWORD
Debugging
Since MCP servers run over stdio, debugging can be challenging. For the best debugging experience, we strongly recommend using the MCP Inspector.
You can launch the MCP Inspector via npm
with this command:
Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
An MCP server that enables MySQL database integration with Claude. You can execute SQL queries and manage database connections.
Related Resources
Related MCP Servers
- -securityAlicense-qualityAn MCP server that allows accessing and managing ledger files through Claude by providing account listing, balance checking, and transaction register viewing capabilities.Last updated -3PythonGPL 3.0
- -securityAlicense-qualityAn MCP server implementation that enables Claude to execute read-only queries against MariaDB databases and explore database schemas through natural language.Last updated -18PythonMIT License
- AsecurityFlicenseAqualityMCP server that allows Claude AI to interact directly with MySQL databases, enabling query execution and table information retrieval through natural language.Last updated -114JavaScript
- -securityFlicense-qualityAn MCP server that allows working with MySQL databases by providing tools for executing read-only SQL queries, getting table schemas, and listing database tables.Last updated -4362JavaScript