execute_sqlLABSCO SUMMARY
The questions you ask when the database is slow.
Most MySQL servers stop at running a query. Lock analysis, index usage and a running-health check are what you actually reach for at two in the morning, and here they are calls rather than half-remembered SQL.
What it is
An MCP server for MySQL that goes past CRUD. Alongside SQL execution it reports database health, table locks and index usage, and it gates what can run through three roles — readonly, writer and admin.
What you get
- SQL executed under a role that decides which statement types are permitted
- Several statements in one call, separated by semicolons
- Table names and fields found from their Chinese table comments
- Table structure and index definitions read
- Table lock analysis
- Health checks for the running database and for index usage
- Chinese field names converted to pinyin initials
- STDIO, SSE and Streamable HTTP transports, with OAuth available for authentication
Requirements
A MySQL instance and a role setting: readonly permits SELECT, SHOW, DESCRIBE and EXPLAIN; writer adds INSERT, UPDATE and DELETE; admin adds CREATE, ALTER, DROP and TRUNCATE.
Setup effort
One command plus credentials — pip install mysql_mcp_server_pro, then supply credentials
USE CASES
Finding out why writes are hanging
Run the table lock analysis and see what is holding what.
Checking whether an index is earning its place
Ask for index usage across the database instead of reading EXPLAIN by hand.
Taking the database's temperature
One call reports the running health of the instance.
Working in a schema documented in Chinese
Find tables and fields by their Chinese comments, and get pinyin initials for new names.
Understanding a table before altering it
Read its structure and its indexes together.
Letting an assistant query production
Set the role to readonly so only SELECT, SHOW, DESCRIBE and EXPLAIN can run.
10 tools
Listed in project docs. Your client may show a different list.
get_chinese_initialsget_db_health_runningget_table_descget_table_indexget_table_lockget_table_nameget_db_health_index_usageoptimize_sqluse_prompt_queryTableDataBEFORE YOU INSTALL
What to know first
Tools you get
10 tools named in the project's documentation.
Requires
- uvx on PATH
- MYSQL_PASSWORD in your environment
- MYSQL_HOST in your environment
- MYSQL_PORT in your environment
- MYSQL_USER in your environment
- MYSQL_DATABASE in your environment
INSTALLATION
Connect your client
Server setup
pip install mysql_mcp_server_proMCP Clients
Any MCP client — uvx
{
"mcpServers": {
"mysql": {
"command": "uvx",
"args": [
"--from",
"mysql_mcp_server_pro",
"mysql_mcp_server_pro",
"--mode",
"stdio"
],
"env": {
"MYSQL_HOST": "<YOUR_MYSQL_HOST>",
"MYSQL_PORT": "3306",
"MYSQL_USER": "root",
"MYSQL_PASSWORD": "root",
"MYSQL_DATABASE": "a_llm",
"MYSQL_ROLE": "admin"
}
}
}
}Cursor — HTTP, Cline — HTTP
Create a .env file with your MySQL connection (MYSQL_HOST, MYSQL_PORT, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE, and optionally MYSQL_ROLE = readonly, writer or admin), then start the server from the package installed with pip install mysql_mcp_server_pro.
mysql_mcp_server_pro --envfile <YOUR_ENVFILE>Then add this block (Streamable HTTP is the default mode):
{
"mcpServers": {
"mysql_mcp_server_pro": {
"name": "mysql_mcp_server_pro",
"type": "streamableHttp",
"description": "",
"isActive": true,
"url": "http://localhost:3000/mcp/"
}
}
}Cursor — SSE
Create a .env file with your MySQL connection (MYSQL_HOST, MYSQL_PORT, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE, and optionally MYSQL_ROLE = readonly, writer or admin), then start the server from the package installed with pip install mysql_mcp_server_pro.
mysql_mcp_server_pro --mode sse --envfile <YOUR_ENVFILE>Then add this block:
{
"mcpServers": {
"mysql_mcp_server_pro": {
"name": "mysql_mcp_server_pro",
"description": "",
"isActive": true,
"url": "http://localhost:9000/sse"
}
}
}Cline — SSE
Create a .env file with your MySQL connection (MYSQL_HOST, MYSQL_PORT, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE, and optionally MYSQL_ROLE = readonly, writer or admin), then start the server from the package installed with pip install mysql_mcp_server_pro.
mysql_mcp_server_pro --mode sse --envfile <YOUR_ENVFILE>Then add this block:
{
"mcpServers": {
"mysql_mcp_server_pro": {
"type": "sse",
"name": "mysql_mcp_server_pro",
"description": "",
"isActive": true,
"url": "http://localhost:9000/sse"
}
}
}Cursor — local build, Cline — local build
git clone https://github.com/wenb1n-dev/mysql_mcp_server_pro
cd mysql_mcp_server_pro
uv syncThen add this block. /Volumes/mysql_mcp_server_pro/src/mysql_mcp_server_pro is the author's own path; yours is the src/mysql_mcp_server_pro folder inside your clone. The MYSQL_ values are your database's:
{
"mcpServers": {
"operateMysql": {
"isActive": true,
"name": "operateMysql",
"command": "uv",
"args": [
"--directory",
"/Volumes/mysql_mcp_server_pro/src/mysql_mcp_server_pro",
"run",
"-m",
"mysql_mcp_server_pro.server",
"--mode",
"stdio"
],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "root",
"MYSQL_PASSWORD": "123456",
"MYSQL_DATABASE": "a_llm",
"MYSQL_ROLE": "admin"
}
}
}
}Any MCP client — OAuth
Start the server with its built-in OAuth 2.0 service (the login username and password are set in the .env file):
mysql_mcp_server_pro --oauth trueOpen http://localhost:3000/login, sign in, and copy the token it gives you.
Add this block; TOKEN_VALUE is that token:
{
"mcpServers": {
"mysql_mcp_server_pro": {
"name": "mysql_mcp_server_pro",
"type": "streamableHttp",
"description": "",
"isActive": true,
"url": "http://localhost:3000/mcp/",
"headers": {
"authorization": "bearer <YOUR_TOKEN>"
}
}
}
}Clients spell the "type" value differently: Claude Code and VS Code use "http", Cline uses "streamableHttp", and Roo Code uses "streamable-http". Claude Desktop does not accept a URL entry in its config file.