Data as of

MCP Server for MySQL for Claude Code: Setup & Config

Claude Code: MCP Server for MySQL lets Claude and other AI clients inspect schemas and execute SQL.

What you can do with MCP Server for MySQL in Claude Code

Use it for SQL and schema access with read-only defaults and explicit controls for database writes.

  • Inspect table and column metadata from an AI client.
  • Query multiple databases or reach a remote database through SSH.

Before you start: MCP Server for MySQL in Claude Code

  • Node.js 20 or newer
  • MySQL 5.7 or newer; 8.0 or newer recommended
  • A MySQL account with suitable privileges
  • An MCP-compatible client

The local quick-start remains read-only unless write flags are enabled. ALLOW_INSERT_OPERATION, ALLOW_UPDATE_OPERATION, and ALLOW_DELETE_OPERATION opt into the corresponding writes. HTTP remote mode is listed but its setup is delegated to other documentation.

MCP Server for MySQL Claude Code configuration

  1. Choose Claude Code configuration scope

    For MCP Server for MySQL, open Project scope: .mcp.json at the repository root. Project JSON: merge into mcpServers; user scope: use the CLI.

  2. Add MCP Server for MySQL to Claude Code

    Use the mcp-server-mysql entry below in mcpServers. Keep MCP Server for MySQL's documented stdio connection fields and your other Claude Code entries.

  3. Check MCP Server for MySQL in Claude Code

    MCP Server for MySQL: Inspect claude mcp list and /mcp status.

Config file · Project scope: .mcp.json at the repository root

JSON
{
  "mcpServers": {
    "mcp-server-mysql": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@benborla29/mcp-server-mysql"
      ],
      "env": {
        "MYSQL_HOST": "<MySQL server hostname or address>",
        "MYSQL_PORT": "<MySQL server port>",
        "MYSQL_USER": "<MySQL username with appropriate privileges>",
        "MYSQL_PASS": "<MySQL user password>",
        "MYSQL_DB": "<Target database name>"
      }
    }
  }
}

CLI (POSIX shell)
claude mcp add-json --scope project 'mcp-server-mysql' '{"type":"stdio","command":"npx","args":["-y","@benborla29/mcp-server-mysql"],"env":{"MYSQL_HOST":"<MySQL server hostname or address>","MYSQL_PORT":"<MySQL server port>","MYSQL_USER":"<MySQL username with appropriate privileges>","MYSQL_PASS":"<MySQL user password>","MYSQL_DB":"<Target database name>"}}'

MCP Server for MySQL tools available to Claude Code

MCP Server for MySQL's stored tool list documents 1 tool; compare it with Claude Code's connected tool list, because the stored list is not a live check.

mysql_query

For MCP Server for MySQL's mysql_query, review the permission request and arguments in Claude Code before approval.

Execute SQL with read-only defaults and individually enabled write operations.

MCP Server for MySQL: full stored tool descriptions

Troubleshooting MCP Server for MySQL in Claude Code

  • If MCP Server for MySQL fails to start, check npx @benborla29/mcp-server-mysql (Node.js/npm), the working directory, and Claude Code's selected scope; inspect claude mcp list and /mcp.
  • MCP Server for MySQL: check MYSQL_DB, MYSQL_HOST, MYSQL_PASS, MYSQL_PORT, MYSQL_USER; keep credentials out of shared .mcp.json.
  • MCP Server for MySQL uses stdio here: Claude Code must keep the configured process running; protocol output belongs on stdout and diagnostics on stderr.
  • Known limitation: Requires Node.js 20 or newer and MySQL 5.7 or newer.
  • Known limitation: Advanced remote-mode and redaction configuration are delegated to separate documentation.
  • General Claude Code troubleshooting lives in the /clients/claude-code guide.

MCP Server for MySQL — details. Claude Code guide

Frequently asked questions

Register MCP Server for MySQL with the displayed claude mcp add-json --scope project command, or merge the JSON into .mcp.json at the repository root.

Claude Code's mcp-server-mysql example uses stdio.

MCP Server for MySQL's Claude Code configuration invokes npx @benborla29/mcp-server-mysql (Node.js/npm).

Claude Code's MCP Server for MySQL example references MYSQL_DB, MYSQL_HOST, MYSQL_PASS, MYSQL_PORT, MYSQL_USER. Check these names if startup or authentication fails; the example alone does not distinguish required from optional values.

MCP Server for MySQL's stored list contains 1 tool, including mysql_query. Compare those names with Claude Code's connected tool list; the stored list is not a live check.

No. Insert, update, and delete operations are disabled unless their respective environment flags are enabled.

The README requires MySQL 5.7 or higher and recommends 8.0 or higher, alongside Node.js 20 or higher.