The mysql_mcp_server allows interaction with MySQL databases, providing the following capabilities:
SQL Execution: Run various SQL commands (SELECT, INSERT, UPDATE) with role-based permission control (readonly, writer, admin)
Schema Management: Retrieve table structures and indexes, supporting multi-table queries
Chinese Language Support: Convert Chinese field names to pinyin initials and search tables by Chinese comments/descriptions
Database Analysis: Analyze database health (connections, transactions, running status), table locks, SQL execution plans, and index usage (redundant, poorly performing, or unused indexes)
Operational Modes: Supports both STDIO and Server-Sent Events (SSE) modes
Extensibility: Allows custom tool extensions and prompt template invocation for specific tasks
Enables configuration of MySQL database connection settings (host, port, user, password, database) through environment variables stored in .env files.
Allows executing SQL queries against MySQL databases, supporting multiple SQL statements, table name/field querying based on comments, SQL execution plan analysis, and Chinese to pinyin field conversion.
mcp_mysql_server
Introduction
mcp_mysql_server_pro is not just about MySQL CRUD operations, but also includes database anomaly analysis capabilities and makes it easy for developers to extend with custom tools.
Supports both STDIO and SSE modes
Supports multiple SQL execution, separated by ";"
Supports querying database table names and fields based on table comments
Supports SQL execution plan analysis
Supports Chinese field to pinyin conversion
Supports table lock analysis
Supports database health status analysis
Supports permission control with three roles: readonly, writer, and admin
"readonly": ["SELECT", "SHOW", "DESCRIBE", "EXPLAIN"], # Read-only permissions "writer": ["SELECT", "SHOW", "DESCRIBE", "EXPLAIN", "INSERT", "UPDATE", "DELETE"], # Read-write permissions "admin": ["SELECT", "SHOW", "DESCRIBE", "EXPLAIN", "INSERT", "UPDATE", "DELETE", "CREATE", "ALTER", "DROP", "TRUNCATE"] # Administrator permissionsSupports prompt template invocation
Related MCP server: SQL Server Express MCP Server
Tool List
Tool Name | Description |
execute_sql | SQL execution tool that can execute ["SELECT", "SHOW", "DESCRIBE", "EXPLAIN", "INSERT", "UPDATE", "DELETE", "CREATE", "ALTER", "DROP", "TRUNCATE"] commands based on permission configuration |
get_chinese_initials | Convert Chinese field names to pinyin initials |
get_db_health_running | Analyze MySQL health status (connection status, transaction status, running status, lock status detection) |
get_table_desc | Search for table structures in the database based on table names, supporting multi-table queries |
get_table_index | Search for table indexes in the database based on table names, supporting multi-table queries |
get_table_lock | Check if there are row-level locks or table-level locks in the current MySQL server |
get_table_name | Search for table names in the database based on table comments and descriptions |
get_db_health_index_usage | Get the index usage of the currently connected mysql database, including redundant index situations, poorly performing index situations, and the top 5 unused index situations with query times greater than 30 seconds |
Prompt List
Prompt Name | Description |
analyzing-mysql-prompt | This is a prompt for analyzing MySQL-related issues |
query-table-data-prompt | This is a prompt for querying table data using tools. If description is empty, it will be initialized as a MySQL database query assistant |
Usage Instructions
SSE Mode
Use uv to start the service
Add the following content to your mcp client tools, such as cursor, cline, etc.
mcp json as follows:
Modify the .env file content to update the database connection information with your database details:
Start commands:
STDIO Mode
Add the following content to your mcp client tools, such as cursor, cline, etc.
mcp json as follows:
Custom Tool Extensions
Add a new tool class in the handles package, inherit from BaseHandler, and implement get_tool_description and run_tool methods
Import the new tool in init.py to make it available in the server
Examples
Create a new table and insert data, prompt format as follows:
Query data based on table comments, prompt as follows:
Analyze slow SQL, prompt as follows:
Analyze SQL deadlock issues, prompt as follows:
Analyze the health status prompt as follows
Appeared in Searches
- Developing and redeveloping web frontend and Python backend projects, including frontend-backend integration and debugging
- Using Laravel Helper Functions and Resolving MySQL Table Query Errors
- A platform for managing code repositories and DevOps workflows
- Frontend Development Tool for Detecting Errors
- Searching for Reddit discussions about server-sent events (SSE)