mcp_mysql_server
About
Model Context Protocol (MCP) server that supports secure interaction with MySQL databases and has anomaly analysis capabilities.更加牛逼!更加好用!不仅止于mysql的增删改查功能; 还包含了数据库异常分析能力;且便于开发者们进行个性化的工具扩展
Details
- Author
- xwb602625136
- GitHub stars
- 245
- Downloads
- 575
- Categories
- Database
Jump to
- Supports all MCP transfer modes (STDIO, SSE, Streamable Http)
- Includes SQL execution, health analysis, lock detection, and index usage tools
- Provides permission control with readonly, writer, and admin roles
- Supports OAuth2.0 authentication for secure access
- Allows custom tool extension by adding new handler classes
- Converts Chinese field names to pinyin initials
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
mcp_mysql_serverCommand (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
Install via pip (pip install mysql_mcp_server_pro), configure a .env file with MySQL credentials (host, port, user, password, database, optional role). Run the service using mysql_mcp_server_pro --mode sse --envfile /path/to/.env for SSE mode, or use the default Streamable Http mode. For client integration, configure MCP JSON with command uvx --from mysql_mcp_server_pro mysql_mcp_server_pro --mode stdio and set environment variables.
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"mcp_mysql_server": {
"mysql": {
"command": "uvx",
"args": [
"--from",
"mysql_mcp_server_pro",
"mysql_mcp_server_pro",
"--mode",
"stdio"
],
"env": {
"MYSQL_HOST": "",
"MYSQL_PORT": "",
"MYSQL_USER": "",
"MYSQL_PASSWORD": "",
"MYSQL_DATABASE": "",
"MYSQL_ROLE": ""
}
}
}
}
}
McpServers
{
"mysql": {
"command": "uvx",
"args": [
"--from",
"mysql_mcp_server_pro",
"mysql_mcp_server_pro",
"--mode",
"stdio"
],
"env": {
"MYSQL_HOST": "",
"MYSQL_PORT": "",
"MYSQL_USER": "",
"MYSQL_PASSWORD": "",
"MYSQL_DATABASE": "",
"MYSQL_ROLE": ""
}
}
}
mcp_mysql_server_pro
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 all Model Context Protocol (MCP) transfer modes (STDIO, SSE, Streamable Http)
- Supports OAuth2.0
- 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 permissions
- Supports prompt template invocation
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 | | optimize_sql | Professional SQL performance optimization tool, providing expert optimization suggestions based on MySQL execution plans, table structure information, table data volume, and table indexes. | | use_prompt_queryTableData | Use built-in prompts to let the model construct a chain call of tools in mcp (not a commonly used fixed tool, you need to modify the code to enable it, see this class for details) |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
Installation and Configuration
1. Install Packagepip install mysql_mcp_server_pro
2. Configure Environment Variables
Create a .env file with the following content:
```bash
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.



