execute_queryLABSCO SUMMARY
The blocked list is the feature.
GRANT, CREATE USER, SET GLOBAL, FLUSH, SHUTDOWN, replication control, LOAD DATA INFILE and SELECT INTO OUTFILE are refused by the filter under all circumstances, and stacked statements separated by a semicolon are refused too — so the furthest an injected instruction reaches is the data the connection's user can already touch. Destructive DDL is off by default and result sets are capped, which means the first surprise is usually a truncated result rather than a dropped table; add a LIMIT clause or raise MAX_ROWS when that happens.
What it is
A Node MCP server that hands an agent a MySQL connection. It runs SELECT, INSERT, UPDATE and DELETE with ? placeholders, executes multi-statement transactions atomically, manages schemas and databases, and screens every statement against a filter that cannot be bypassed.
What you get
- Parameterized statements, and multi-statement batches that roll back entirely if any statement fails —
execute_query,execute_transaction - Schema work: create and alter tables, list tables, describe a table, read detailed column information —
create_table,alter_table,show_tables,describe_table,show_columns - Database-level work with system databases excluded from listings —
list_databases,create_database,drop_database - Connection health and server facts: version, character set and collation —
ping,get_server_info - A database parameter on every tool, so one session can move between databases without reconfiguration
- Two guards with sensible defaults:
drop_tableanddrop_databaseerror out unlessALLOW_DESTRUCTIVE_DDL=true, and results are capped byMAX_ROWS, default 1000
Requirements
Node.js 20+, a reachable MySQL server, and credentials in MYSQL_HOST, MYSQL_PORT, MYSQL_USER and MYSQL_PASSWORD, with MYSQL_DATABASE and MYSQL_POOL_SIZE optional. Install is a clone plus npm install and npm run build, then pointing the client at dist/index.js — the README also covers a project-scoped .mcp.json and claude mcp add. The recommended posture is a dedicated MySQL user granted SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER and INDEX and nothing else — not SUPER, FILE, RELOAD or GRANT OPTION.
Setup effort
Build from source — git clone https://github.com/turkeryildirim/mysql-mcp
USE CASES
Answering a data question without opening a client
Ask in plain language and let the agent write the parameterized SELECT against the right database.
Making several writes that must all land
Send the statements as one batch so a failure anywhere rolls the whole thing back instead of leaving half-applied changes.
Sketching a schema while you design
Create a table, then add columns, rename them or add indexes as the design settles.
Exploring an unfamiliar database
List the databases, list their tables, and read the column structure before writing anything against them.
Working across several databases in one session
Pass the database on each call rather than reconfiguring the server between questions.
13 tools
Listed in project docs. Your client may show a different list.
execute_transactioncreate_tablealter_tabledrop_tableshow_tablesdescribe_tablelist_databasescreate_databasedrop_databasepingshow_columnsget_server_infoBEFORE YOU INSTALL
What to know first
Tools you get
13 tools named in the project's documentation.
Requires
- Node.js 20+
- MYSQL_USER and MYSQL_PASSWORD set in the client entry's env
Where it runs
All 3 documented setups run the server on your machine.
INSTALLATION
Connect your client
You clone and build this one yourself.
Server setup
git clone https://github.com/turkeryildirim/mysql-mcp
cd mysql-mcp
npm install
npm run buildMCP Clients
Claude Desktop
{
"mcpServers": {
"mysql": {
"command": "node",
"args": [
"<YOUR_PATH_TO_MYSQL_MCP>/dist/index.js"
],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "mcp_user",
"MYSQL_PASSWORD": "<YOUR_MYSQL_PASSWORD>",
"MYSQL_DATABASE": "",
"MAX_ROWS": "1000",
"ALLOW_DESTRUCTIVE_DDL": "false"
}
}
}
}Claude Code — project scope
{
"mcpServers": {
"mysql": {
"type": "stdio",
"command": "node",
"args": [
"<YOUR_PATH_TO_MYSQL_MCP>/dist/index.js"
],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "mcp_user",
"MYSQL_PASSWORD": "<YOUR_MYSQL_PASSWORD>",
"ALLOW_DESTRUCTIVE_DDL": "false"
}
}
}
}Claude Code — global scope
claude mcp add mysql -- node <YOUR_PATH_TO_MYSQL_MCP>/dist/index.js