MySQL database integration with configurable access controls, schema inspection, and comprehensive security guidelines
The MySQL MCP Server is a powerful tool designed to bridge the gap between Large Language Model (LLM) applications and MySQL databases, enabling secure and structured data exploration and analysis. Built upon the Model Context Protocol (MCP), this server acts as a crucial intermediary, facilitating communication between AI clients and your database.
Install the server using pip:
pip install mysql-mcp-server
For seamless integration with Claude Desktop, use Smithery:
npx -y @smithery/cli install mysql-mcp-server --client claude
Configure the server by setting the following environment variables:
MYSQL_HOST=localhost MYSQL_PORT=3306 # Optional: Defaults to 3306 MYSQL_USER=your_username MYSQL_PASSWORD=your_password MYSQL_DATABASE=your_database
Add the following configuration to your claude_desktop_config.json
:
{ "mcpServers": { "mysql": { "command": "uv", "args": [ "--directory", "path/to/mysql_mcp_server", "run", "mysql_mcp_server" ], "env": { "MYSQL_HOST": "localhost", "MYSQL_PORT": "3306", "MYSQL_USER": "your_username", "MYSQL_PASSWORD": "your_password", "MYSQL_DATABASE": "your_database" } } } }
Configure the server in your mcp.json
file:
{ "servers": { "mysql": { "type": "stdio", "command": "uvx", "args": [ "--from", "mysql-mcp-server", "mysql_mcp_server" ], "env": { "MYSQL_HOST": "localhost", "MYSQL_PORT": "3306", "MYSQL_USER": "your_username", "MYSQL_PASSWORD": "your_password", "MYSQL_DATABASE": "your_database" } } }
Note: Ensure you have uv
installed for this to work.
While the MySQL MCP Server is designed for integration with AI applications, you can use the MCP Inspector for debugging purposes:
# Install dependencies pip install -r requirements.txt # Use the MCP Inspector for debugging (do not run directly with Python)
Contribute to the project by following these steps:
# Clone the repository git clone https://github.com/yourusername/mysql_mcp_server.git cd mysql_mcp_server # Create virtual environment python -m venv venv source venv/bin/activate # or `venv\Scripts\activate` on Windows # Install development dependencies pip install -r requirements-dev.txt # Run tests pytest
Refer to the MySQL Security Configuration Guide for detailed instructions on securing your MySQL database.
โ ๏ธ Important: Always adhere to the principle of least privilege when configuring database access.
git checkout -b feature/amazing-feature
).git commit -m 'Add some amazing feature'
).git push origin feature/amazing-feature
).๐ โ๏ธ Biomedical research server providing access to PubMed, ClinicalTrials.gov, and MyVariant.info.
๐ MCP server that provides SQL analysis, linting, and dialect conversion using [SQLGlot](https://github.com/tobymao/sqlglot)
๐ ๐ All-in-one MCP server for Postgres development and operations, with tools for performance analysis, tuning, and health checks
Supabase MCP Server with support for SQL query execution and database exploration tools