Provides tools for executing SQL queries, discovering database schemas, managing multiple databases, and performing CRUD operations on MySQL databases with configurable read-only and write permissions.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP MySQL Servershow me the top 10 customers by total purchase amount"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP MySQL Server
A clean, simple, and well-organized Model Context Protocol (MCP) server for MySQL database interactions with Claude Desktop.
Features
π Query Execution: Run SQL queries with proper validation and security
ποΈ Multi-Database Support: Switch between multiple databases easily
π Security First: Read-only by default, configurable write permissions
π Schema Discovery: Automatic database and table schema information
β‘ Connection Pooling: Efficient database connection management
π‘οΈ Query Validation: Built-in SQL injection protection
π Comprehensive Logging: Optional detailed logging for debugging
Quick Start
1. Clone and Install
2. Configure Environment
3. Build
4. Configure Claude Desktop
Add to your claude_desktop_config.json:
Configuration Options
Basic Connection
MYSQL_HOST: Database host (default: localhost)MYSQL_PORT: Database port (default: 3306)MYSQL_USER: Database username (default: root)MYSQL_PASSWORD: Database passwordMYSQL_DATABASE: Target database (leave empty for multi-DB mode)MYSQL_SOCKET_PATH: Unix socket path (optional, overrides host/port)
Security & Permissions
ALLOW_WRITE: Enable all write operations (default: false)ALLOW_INSERT: Enable INSERT statements (default: false)ALLOW_UPDATE: Enable UPDATE statements (default: false)ALLOW_DELETE: Enable DELETE statements (default: false)ALLOW_DDL: Enable DDL operations CREATE/ALTER/DROP (default: false)
Performance Settings
POOL_SIZE: Connection pool size (default: 10)QUERY_TIMEOUT: Query timeout in milliseconds (default: 30000)
Logging
ENABLE_LOGGING: Enable detailed logging (default: false)
Multi-Database Mode
Leave MYSQL_DATABASE empty to enable multi-database mode. This allows querying any database the MySQL user has access to.
Example queries in multi-DB mode:
Security Best Practices
Use Read-Only by Default: Only enable write operations when necessary
Create Dedicated MySQL User: Don't use root account
Limit Database Access: Grant permissions only to required databases
Backup Before Writes: Always backup data before enabling write operations
Monitor Query Logs: Enable logging to track database activities