A Model Context Protocol (MCP) implementation that enables secure interaction with MySQL databases. This server component facilitates communication between AI applications (hosts/clients) and MySQL databases, making database exploration and analysis safer and more structured through a controlled interface. - List available MySQL tables as resources - Read table contents - Execute SQL queries with
Add this skill
npx mdskills install designcomputer/mysql-mcp-serverWell-documented MySQL MCP server with clear setup instructions and security guidance
123[](https://smithery.ai/server/mysql-mcp-server)4[](https://mseep.ai/app/designcomputer-mysql-mcp-server)5# MySQL MCP Server6A Model Context Protocol (MCP) implementation that enables secure interaction with MySQL databases. This server component facilitates communication between AI applications (hosts/clients) and MySQL databases, making database exploration and analysis safer and more structured through a controlled interface.78> **Note**: MySQL MCP Server is not designed to be used as a standalone server, but rather as a communication protocol implementation between AI applications and MySQL databases.910## Features11- List available MySQL tables as resources12- Read table contents13- Execute SQL queries with proper error handling14- Secure database access through environment variables15- Comprehensive logging1617## Installation18### Manual Installation19```bash20pip install mysql-mcp-server21```2223### Installing via Smithery24To install MySQL MCP Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/mysql-mcp-server):25```bash26npx -y @smithery/cli install mysql-mcp-server --client claude27```2829## Configuration30Set the following environment variables:31```bash32MYSQL_HOST=localhost # Database host33MYSQL_PORT=3306 # Optional: Database port (defaults to 3306 if not specified)34MYSQL_USER=your_username35MYSQL_PASSWORD=your_password36MYSQL_DATABASE=your_database37```3839## Usage40### With Claude Desktop41Add this to your `claude_desktop_config.json`:42```json43{44 "mcpServers": {45 "mysql": {46 "command": "uv",47 "args": [48 "--directory",49 "path/to/mysql_mcp_server",50 "run",51 "mysql_mcp_server"52 ],53 "env": {54 "MYSQL_HOST": "localhost",55 "MYSQL_PORT": "3306",56 "MYSQL_USER": "your_username",57 "MYSQL_PASSWORD": "your_password",58 "MYSQL_DATABASE": "your_database"59 }60 }61 }62}63```6465### With Visual Studio Code66Add this to your `mcp.json`:67```json68{69 "servers": {70 "mysql": {71 "type": "stdio",72 "command": "uvx",73 "args": [74 "--from",75 "mysql-mcp-server",76 "mysql_mcp_server"77 ],78 "env": {79 "MYSQL_HOST": "localhost",80 "MYSQL_PORT": "3306",81 "MYSQL_USER": "your_username",82 "MYSQL_PASSWORD": "your_password",83 "MYSQL_DATABASE": "your_database"84 }85 }86 }87}88```89Note: Will need to install uv for this to work9091### Debugging with MCP Inspector92While MySQL MCP Server isn't intended to be run standalone or directly from the command line with Python, you can use the MCP Inspector to debug it.9394The MCP Inspector provides a convenient way to test and debug your MCP implementation:9596```bash97# Install dependencies98pip install -r requirements.txt99# Use the MCP Inspector for debugging (do not run directly with Python)100```101102The MySQL MCP Server is designed to be integrated with AI applications like Claude Desktop and should not be run directly as a standalone Python program.103104## Development105```bash106# Clone the repository107git clone https://github.com/designcomputer/mysql_mcp_server.git108cd mysql_mcp_server109# Create virtual environment110python -m venv venv111source venv/bin/activate # or `venv\Scripts\activate` on Windows112# Install development dependencies113pip install -r requirements-dev.txt114# Run tests115pytest116```117118## Security Considerations119- Never commit environment variables or credentials120- Use a database user with minimal required permissions121- Consider implementing query whitelisting for production use122- Monitor and log all database operations123124## Security Best Practices125This MCP implementation requires database access to function. For security:1261. **Create a dedicated MySQL user** with minimal permissions1272. **Never use root credentials** or administrative accounts1283. **Restrict database access** to only necessary operations1294. **Enable logging** for audit purposes1305. **Regular security reviews** of database access131132See [MySQL Security Configuration Guide](https://github.com/designcomputer/mysql_mcp_server/blob/main/SECURITY.md) for detailed instructions on:133- Creating a restricted MySQL user134- Setting appropriate permissions135- Monitoring database access136- Security best practices137138⚠️ IMPORTANT: Always follow the principle of least privilege when configuring database access.139140## License141MIT License - see LICENSE file for details.142143## Contributing1441. Fork the repository1452. Create your feature branch (`git checkout -b feature/amazing-feature`)1463. Commit your changes (`git commit -m 'Add some amazing feature'`)1474. Push to the branch (`git push origin feature/amazing-feature`)1485. Open a Pull Request149
Full transparency — inspect the skill content before installing.