A Model Context Protocol (MCP) server that enables secure interaction with MySQL databases. This server allows AI assistants to list tables, read data, and execute SQL queries through a controlled interface, making database exploration and analysis safer and more structured.
pip install mysql-mcp-server
Set the following environment variables:
MYSQL_HOST=localhost # Database host
MYSQL_PORT=3306 # Optional: Database port (defaults to 3306 if not specified)
MYSQL_USER=your_username
MYSQL_PASSWORD=your_password
MYSQL_DATABASE=your_database
Add this 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"
}
}
}
}
This MCP server requires database access to function. For security:
See MySQL Security Configuration Guide for detailed instructions on:
⚠️ IMPORTANT: Always follow the principle of least privilege when configuring database access.
MIT License - see LICENSE file for details.
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)