Labsco
MCP SERVER

MySQL MCP Server

by guangxiangdebizi

Query MySQL from the client, with the credentials in headers instead of in the conversation.

Relational SQL Databases
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

One command plus a key — npm install -g @xingyuchen/mysql-mcp-server@latest, then supply credentials