run_sql_queryLABSCO SUMMARY
A database an assistant can change, not only read.
The tool set is small - a SELECT-only query tool, one tool each for CREATE TABLE, INSERT, UPDATE and DELETE, and execute_sql for any other statement, ALTER and DROP included - and most of it writes. That makes it useful for scaffolding a schema while prototyping, and it makes the privileges on the connecting user the thing worth deciding first.
What it is
A MySQL server with a small surface: read with SELECT, create tables, insert, update and delete rows, and run any other statement. Results come back as JSON, and each transaction is logged under its own ID.
What you get
- A SELECT run against the database, with the rows back as JSON
- A table created from a CREATE TABLE statement
- Rows inserted, updated and deleted, and any other statement, ALTER and DROP included, run through execute_sql
- Results returned as JSON, with transaction logging on each call
Requirements
A reachable MySQL server and its connection settings - host, port, user, password and database name - as environment variables. It writes as well as reads, so the grants on the MySQL user are what bound it.
Setup effort
Build from source — git clone https://github.com/michael7736/mysql-mcp-server
USE CASES
Answering a question from the data
Run the SELECT where the question was asked, and read the rows back as JSON in the same thread.
Scaffolding a schema while prototyping
Create the tables from the design you just agreed on, without switching to a client to type them out.
Loading sample rows to test against
Insert the fixtures and query them straight back, so the test data and the check on it happen in one place.
Correcting a row without opening a client
Run the UPDATE or DELETE through update_data or delete_data, and the transaction is logged with an ID.
6 tools
Listed in project code.
create_tableinsert_dataupdate_datadelete_dataexecute_sqlBEFORE YOU INSTALL
What to know first
Tools you get
6 tools registered in the project's code. run_sql_query accepts only SELECT; create_table, insert_data, update_data and delete_data each accept only their own statement type, and execute_sql runs any other statement, ALTER and DROP included.
Requires
- Node.js
- MYSQL_PASSWORD in your environment
- MYSQL_USER in your environment
Where it runs
Both documented clients run the server on your machine.
INSTALLATION
Connect your client
You clone and build this one yourself.
Server setup
git clone https://github.com/michael7736/mysql-mcp-server
cd mysql-mcp-server
npm install
npm run buildCreate a MySQL database: CREATE DATABASE mcpdb;
Create a MySQL user with access to the database
Add the MySQL MCP server to your MCP settings file
MCP Clients
Cline, Claude Desktop
{
"mcpServers": {
"mysql-mcp-server": {
"autoApprove": [],
"disabled": false,
"timeout": 60,
"command": "node",
"args": [
"<YOUR_PATH_TO_MYSQL_MCP_SERVER>/build/index.js"
],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "mcp101",
"MYSQL_PASSWORD": "123qwe",
"MYSQL_DATABASE": "mcpdb"
},
"transportType": "stdio"
}
}
}<YOUR_PATH_TO_MYSQL_MCP_SERVER> is the full path of your clone. mcp101, 123qwe and mcpdb are the README's sample user, password and database (from its CREATE USER 'mcp101'@'localhost' IDENTIFIED BY '123qwe' example). Put in the MySQL user, password and database you created.