add_connectionLABSCO SUMMARY
Database access without putting the password in the prompt.
Header-based configuration is what separates it from the usual connection-string approach: the server holds the credentials and the model gets tools. Several databases can be live at once, so production and test are a switch rather than a reconfiguration.
What it is
A MySQL server over the Streamable HTTP transport, in which connection details travel as X-MySQL-* request headers. That keeps host, user and password out of the model's view while it still runs SQL. Several databases can be pre-configured at once through numbered header sets and switched between, or a connection can be added at runtime by tool call.
What you get
- Connections added at runtime, listed, switched between and removed
- Any SQL executed — SELECT, INSERT, UPDATE, DELETE
- Databases and tables listed, and a table's structure described
- Several databases connected at once, with one selected as active
- Credentials pre-configured in headers, so they are not exposed to the model
Requirements
Node.js 18+, a MySQL server, and a client that supports the streamableHttp transport. The repository is cloned, built with npm run build and started with npm start; the client points at its local /mcp endpoint. Credentials go in X-MySQL-Host, X-MySQL-Port, X-MySQL-User, X-MySQL-Password and X-MySQL-Database, numbered per connection when there is more than one. Writes go through the same query tool as reads, so scope the database user to what the agent should be allowed to do.
Setup effort
Build from source — git clone https://github.com/guangxiangdebizi/MySQL_MCP.git
USE CASES
Exploring a database you don't know
List the databases, then the tables, then a table's structure, before writing any SQL against it.
Answering a question with a query
Run the SELECT in the conversation where the question came up and read the rows back.
Working across environments
Keep production and test connected at once and switch the active one, rather than editing config between questions.
Connecting to something new mid-session
Add the connection by tool call when it was not pre-configured in the headers.
Tidying up afterwards
Remove a connection you no longer need, so it is not one switch away from becoming the active database.
8 tools
Listed in project docs. Your client may show a different list.
list_connectionsselect_databaseremove_connectionexecute_queryshow_tablesdescribe_tableshow_databasesBEFORE YOU INSTALL
What to know first
Tools you get
8 tools named in the project's documentation.
Requires
- npm on PATH
- Node.js 18+
- MySQL 5.7+
Where it runs
Both documented setups run the server on your machine.
INSTALLATION
Connect your client
This one is built from source rather than installed with a single command.
Server setup
git clone https://github.com/guangxiangdebizi/MySQL_MCP.git
cd MySQL_MCP
npm install
npm run build
npm startMCP Clients
Any MCP client
{
"mcpServers": {
"mysql-mcp": {
"type": "streamableHttp",
"url": "http://localhost:3001/mcp",
"timeout": 600,
"headers": {
"X-MySQL-Host": "localhost",
"X-MySQL-Port": "3306",
"X-MySQL-User": "root",
"X-MySQL-Password": "<YOUR_MY_SQL_PASSWORD>",
"X-MySQL-Database": "<YOUR_MY_SQL_DATABASE>"
}
}
}
}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.
Any MCP client — Without Preset Credentials
{
"mcpServers": {
"mysql-mcp": {
"type": "streamableHttp",
"url": "http://localhost:3001/mcp",
"timeout": 600
}
}
}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.