Skip to content
MCP server

Mysql

Read-only MySQL access for AI clients: schema inspection, query plans and performance

Runs locallyStatus and history
Install
Pricing
Open source
Platforms
API, CLI, vscode
Runs
Locally
Version
1.0.7
Listing updated
today

Similar MCP servers

About Mysql

Mysql is an open-source MCP server for databases. It runs locally on your machine and is started by your AI client.

The README describes this server as a way for LLM clients to look at MySQL databases without changing them. Queries run inside a READ ONLY transaction, so the assistant can inspect schemas, explain execution plans and pull table statistics but is not meant to write data.

The server exposes four tools and a schema resource for each table. Connection details can come from MYSQL_USER and MYSQL_PASSWORD environment variables or from a mysql-connect tool called at runtime, and a connection string can be passed at startup. A separate mysql-awr tool produces an Oracle AWR-style performance report, which draws on performance_schema when it is enabled.

The README covers setup for Claude Desktop, VS Code and Antigravity, using either npx or a Docker image. It is aimed at developers and database administrators who want an assistant to help with query tuning and schema review.

Install

Run in a terminal

claude mcp add mysql --env MYSQL_PASSWORD='<MYSQL_PASSWORD>' -- npx -y @marcelo-ochoa/server-mysql

Add to claude_desktop_config.json

{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": [
        "-y",
        "@marcelo-ochoa/server-mysql"
      ],
      "env": {
        "MYSQL_PASSWORD": "<MYSQL_PASSWORD>"
      }
    }
  }
}

Add to ~/.cursor/mcp.json

{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": [
        "-y",
        "@marcelo-ochoa/server-mysql"
      ],
      "env": {
        "MYSQL_PASSWORD": "<MYSQL_PASSWORD>"
      }
    }
  }
}

Add to .vscode/mcp.json

{
  "servers": {
    "mysql": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@marcelo-ochoa/server-mysql"
      ],
      "env": {
        "MYSQL_PASSWORD": "<MYSQL_PASSWORD>"
      }
    }
  }
}

Add to ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": [
        "-y",
        "@marcelo-ochoa/server-mysql"
      ],
      "env": {
        "MYSQL_PASSWORD": "<MYSQL_PASSWORD>"
      }
    }
  }
}

Add to your client's MCP settings (most use this shape)

{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": [
        "-y",
        "@marcelo-ochoa/server-mysql"
      ],
      "env": {
        "MYSQL_PASSWORD": "<MYSQL_PASSWORD>"
      }
    }
  }
}

Using several servers? Build one config file with the MCP config generator.

Configuration

  • MYSQL_USERMySQL username
  • MYSQL_PASSWORDMySQL password

Tools this server provides (5)

Taken from the project documentation; the running server may differ.

mysql-query
Execute read-only SQL queries against the connected MySQL database
mysql-explain
Explain plan SQL queries against the connected MySQL database
mysql-stats
Get statistics for a given table in the current connected database
mysql-connect
Reconnect using new credentials
mysql-awr
Generate a MySQL performance report similar to Oracle AWR

What it does

Read-only query execution
Runs SQL inside a READ ONLY transaction so queries cannot modify data.
Query plan explanation
Returns the execution plan for a SQL statement in JSON form.
Table statistics
Reports table, index and column statistics for a named table.
Performance report
Generates an AWR-style report with InnoDB metrics and top queries, using performance_schema when available.
Schema resources
Exposes column names and data types for each table as JSON resources.
Runtime reconnection
Lets the client reconnect with new credentials through a mysql-connect tool.

Good for

  • Asking an assistant to review a slow query and its execution plan
  • Inspecting table structure and column types before writing SQL
  • Gathering index and table statistics for a database under investigation
  • Generating a performance report and asking for tuning suggestions

Pricing

Open source

Open source; licensed under Apache 2.0 for new contributions and MIT for existing code.

More servers for the same service

Mysql FAQ

Can this server modify data in MySQL?

The README says the query tool runs all queries within a READ ONLY transaction and describes the server as providing read-only access.

How are database credentials supplied?

Through the MYSQL_USER and MYSQL_PASSWORD environment variables, or by calling the mysql-connect tool with a connection string, username and password.

Does the performance report require anything in MySQL?

The README says top query statistics need performance_schema to be enabled; without it the report still generates with fewer query-level details.

Is Mysql free?

Yes. Mysql is open source, so you can use and self-host it for free.

How do I add Mysql to Claude Code?

Run this command in your terminal: claude mcp add mysql --env MYSQL_PASSWORD='<MYSQL_PASSWORD>' -- npx -y @marcelo-ochoa/server-mysql

What are the best alternatives to Mysql?

The closest alternatives to Mysql are AI2SQL, MCP Local WP, SaturnSQL, AdoMcp and PostgreSQL MCP Server.

Where this comes from

  • Description: written from the project's README and its MCP Registry entry.
  • Install steps: from the official MCP Registry entry.

How AIPoweredBot checks servers