There is no single "official" MySQL MCP server, but the cleanest route in 2026 is a universal database server — DBHub — that speaks MySQL, MariaDB, Postgres, SQL Server and SQLite through one DSN. Here is the setup for Claude Desktop and Cursor.
Configure the client
DBHub takes a database DSN and a transport. Run it in read-only mode:
{
"mcpServers": {
"mysql": {
"command": "npx",
"args": [
"-y",
"@bytebase/dbhub",
"--transport", "stdio",
"--readonly",
"--dsn", "mysql://user:password@localhost:3306/mydb"
]
}
}
}
For MariaDB, use the same mysql:// scheme. Restart the client; see MCP config file location if needed.
Why read-only
--readonly blocks INSERT, UPDATE, DELETE and DDL, so the AI can explore and query but not mutate data. Keep it on by default — especially against any shared or production database. More in MCP security best practices.
Verify
Ask: "List the tables and describe the orders table." Real schema back confirms the connection.
Common problems
Access denied for user— wrong credentials or the user lacks privileges on that database.ECONNREFUSED 3306— MySQL is not running or is on a different host/port.- Cannot connect from Docker/WSL —
localhostmay not resolve to the host; use the host IP orhost.docker.internal. - No tools in client — Node 18+ required; see Cursor MCP not working.
Going further
A universal DB server is handy when you touch several engines. Browse the databases category, compare options in best MCP server for a database, or grab the backend developer stack.