Data as of
MySQL MCP Server for Claude Code: Setup & Config
Claude Code: Expose MySQL schema inspection, data samples, and SQL execution to MCP assistants.
What you can do with MySQL in Claude Code
Choose it for focused MySQL exploration with schemas, bounded samples, and explicit SQL access.
- Explore an unfamiliar database's tables and column types.
- Reach a MySQL instance through a configured SSH tunnel.
Before you start: MySQL in Claude Code
- uv for the documented uvx launch
- An accessible MySQL instance
- MySQL credentials with the required permissions
- An MCP-compatible client
This is the README's VS Code stdio launch. Put database values in the client's env block rather than assuming the project's .env will be discovered. Network SSE deployments require an authentication proxy outside localhost.
MySQL Claude Code configuration
Choose Claude Code configuration scope
For MySQL MCP Server, open Project scope: .mcp.json at the repository root. Project JSON: merge into mcpServers; user scope: use the CLI.
Add MySQL MCP Server to Claude Code
Use the mysql_mcp_server entry below in mcpServers. Keep MySQL MCP Server's documented stdio connection fields and your other Claude Code entries.
Check MySQL MCP Server in Claude Code
MySQL MCP Server: Inspect claude mcp list and /mcp status.
Config file · Project scope: .mcp.json at the repository root
{
"mcpServers": {
"mysql_mcp_server": {
"type": "stdio",
"command": "uvx",
"args": [
"--from",
"mysql-mcp-server",
"mysql_mcp_server"
],
"env": {
"MYSQL_HOST": "<MySQL hostname>",
"MYSQL_PORT": "<MySQL port, default 3306>",
"MYSQL_USER": "<dedicated least-privilege MySQL username>",
"MYSQL_PASSWORD": "<MySQL account password>",
"MYSQL_DATABASE": "<optional default database; omit for multi-database mode>"
}
}
}
}claude mcp add-json --scope project 'mysql_mcp_server' '{"type":"stdio","command":"uvx","args":["--from","mysql-mcp-server","mysql_mcp_server"],"env":{"MYSQL_HOST":"<MySQL hostname>","MYSQL_PORT":"<MySQL port, default 3306>","MYSQL_USER":"<dedicated least-privilege MySQL username>","MYSQL_PASSWORD":"<MySQL account password>","MYSQL_DATABASE":"<optional default database; omit for multi-database mode>"}}'MySQL tools available to Claude Code
MySQL's stored tool list documents 3 tools; compare it with Claude Code's connected tool list, because the stored list is not a live check.
- execute_sql
For MySQL's execute_sql, review the permission request and arguments in Claude Code before approval.
Run one SQL statement, including reads and permitted data-modification operations.
- get_schema_info
For MySQL's get_schema_info, review the permission request and arguments in Claude Code before approval.
- get_table_sample
For MySQL's get_table_sample, review the permission request and arguments in Claude Code before approval.
Read a table sample capped at 20 rows, including cross-database targets.
Troubleshooting MySQL in Claude Code
- If MySQL MCP Server fails to start, check uvx --from (from uv, for Python tools), the working directory, and Claude Code's selected scope; inspect claude mcp list and /mcp.
- MySQL MCP Server: check MYSQL_DATABASE, MYSQL_HOST, MYSQL_PASSWORD, MYSQL_PORT, MYSQL_USER; keep credentials out of shared .mcp.json.
- MySQL MCP Server uses stdio here: Claude Code must keep the configured process running; protocol output belongs on stdout and diagnostics on stderr.
- Known limitation: SQL execution includes writes when database permissions allow them.
- Known limitation: Only single-statement SQL calls are supported.
- Known limitation: SSE mode needs external authentication when exposed beyond localhost.
- General Claude Code troubleshooting lives in the /clients/claude-code guide.
MySQL MCP Server — details. Claude Code guide