# read-only-local-mysql-mcp-server

Lets Claude Code query a MySQL database in natural language while keeping access read-only. Use it to inspect schemas and retrieve data from an agent.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 7
- Author: hovecapital
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/hovecapital/read-only-local-mysql-mcp-server
- Updated: 2026-10-21
- HTML: https://affpapa.org/en/nevibecode/mcp/read-only-local-mysql-mcp-server

## What it does

read-only-local-mysql-mcp-server connects Claude Code to MySQL through MCP. It turns natural-language requests into database queries and returns JSON results. Connection details come from `DB_HOST`, `DB_PORT`, `DB_DATABASE`, `DB_USERNAME`, and `DB_PASSWORD`.

You need Node.js 16 or newer and a MySQL server before starting. Claude Code can add the server with `npx`; configure the environment variables afterward and restart the client. Query validation allows `SELECT`, `WITH`, `SHOW`, `DESCRIBE`, and `EXPLAIN`, with one statement and no comments.

The server cannot write to the database because it also uses a server-side read-only transaction. Requests containing `INSERT`, `UPDATE`, or `DELETE` will not work, so this MCP server is for inspection and reporting rather than data changes.

## Requirements
- Needs: Node.js (commands run via npx)

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add read-only-local-mysql-mcp-server -- npx -y @hovecapital/read-only-mysql-mcp-server
```

### Codex

**Platform CLI**
```bash
codex mcp add read-only-local-mysql-mcp-server -- npx -y @hovecapital/read-only-mysql-mcp-server
```

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "read-only-local-mysql-mcp-server": {
            "command": "npx",
            "args": [
                "-y",
                "@hovecapital/read-only-mysql-mcp-server"
            ]
        }
    }
}
```

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "read-only-local-mysql-mcp-server": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "@hovecapital/read-only-mysql-mcp-server"
            ]
        }
    }
}
```

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add read-only-local-mysql-mcp-server npx -y @hovecapital/read-only-mysql-mcp-server
```

## When to use it
- list tables in a MySQL database
- inspect a table’s columns
- search records with a condition
- summarize data from a query
- run a read-only SQL statement

## Example prompts
- Show me the tables and columns in this MySQL database.
- Find last month’s orders and return them as a table.
- Explain the execution plan for this query with `EXPLAIN`.

## Similar
- [mysql](https://affpapa.org/en/nevibecode/skills/sanjay3290-mysql.md) — skill · 420 installs
- [mysql-patterns](https://affpapa.org/en/nevibecode/skills/mysql-patterns.md) — skill · 4700 installs
- [mysql-best-practices](https://affpapa.org/en/nevibecode/skills/mysql-best-practices.md) — skill · 2700 installs
- [mysql-mcp](https://affpapa.org/en/nevibecode/mcp/mysql-mcp.md) — MCP server · ★ 11
- [azure-resource-manager-mysql-dotnet](https://affpapa.org/en/nevibecode/skills/azure-resource-manager-mysql-dotnet.md) — skill · 1 install
- [OpenVibeCoding Read-only MCP](https://affpapa.org/en/nevibecode/mcp/openvibecoding-read-only-mcp.md) — MCP server · ★ 207

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
