MySQL (DBHub) MCP server
Connect an agent to a MySQL database with Bytebase's DBHub: run SQL and explore schema through one universal database MCP server.
DBHub is a universal database MCP server from Bytebase that connects an agent to MySQL (as well as PostgreSQL, MariaDB, SQL Server, and SQLite) using a single connection-string DSN. For MySQL you pass --dsn "mysql://user:password@host:3306/dbname" and the agent gains two focused tools: one to execute SQL with transaction support and safety controls, and one to search and explore the schema, walking databases, tables, columns, indexes, and procedures with progressive disclosure so it does not flood the context with an entire catalog at once. That keeps a single small toolset useful across every database DBHub supports.
It installs with npx (@bytebase/dbhub) and runs over stdio by default for desktop clients, or HTTP for networked use. Connections can be tunneled through SSH with the --ssh-* flags for databases that are not directly reachable. Read-only enforcement and custom, parameterized SQL tools are configured through an optional dbhub.toml file: define a [[tools]] entry with readonly = true to expose a safe, named query rather than open-ended SQL. Because the same binary speaks several dialects, DBHub is a pragmatic way to give an agent MySQL access without standing up a database-specific server.
Quick install
Copy-paste configs are provided for all 8 supported clients. Pick your client below.
Add to ~/.claude.json
{
"mcpServers": {
"mysql": {
"command": "npx",
"args": [
"-y",
"@bytebase/dbhub@latest",
"--transport",
"stdio",
"--dsn",
"mysql://user:password@localhost:3306/dbname"
]
}
}
}claude mcp add mysql -- npx -y @bytebase/dbhub@latest --transport stdio --dsn mysql://user:password@localhost:3306/dbnameAvailable tools
| Tool | Description |
|---|---|
| execute_sql | Executes SQL queries against the connected database with transaction support and safety controls. |
| search_objects | Searches and explores database schema (tables, columns, indexes, procedures) with progressive disclosure to avoid overwhelming the context. |
Required configuration
- DSNOptional
Database connection string, e.g. mysql://user:password@host:3306/dbname. Can be supplied via the --dsn flag instead of the environment.
What you can do with it
Ask questions of a MySQL database
Point DBHub at a MySQL DSN and let the agent explore the schema with search_objects, then run SELECTs through execute_sql to answer questions about the data.
One server for many databases
Use the same DBHub install to connect to MySQL today and PostgreSQL, SQL Server, MariaDB, or SQLite tomorrow by swapping only the DSN, keeping a consistent two-tool interface for the agent.
FAQ
- Is it free?
- Yes. DBHub is open source (MIT) and free to run via npx. You only need a reachable MySQL database to connect to.
- Does it support remote/OAuth?
- It runs locally over stdio (default) or serves HTTP for networked clients, and can tunnel through SSH. There is no OAuth flow; it authenticates with the database credentials embedded in the DSN. Read-only and custom named tools are configured through a dbhub.toml file.