MCP ConfigsMay 12, 2026·2 min read

mcp-server-mysql — Read-Only MySQL MCP for Claude Code

mcp-server-mysql is an MCP server for Claude Code that connects to MySQL (optionally via SSH tunnels) so agents can inspect schemas and run read-only SQL.

Agent ready

Safe staging for this asset

This asset is staged first. The copied prompt tells the agent to inspect the staged files and ask before activating scripts, MCP config, or global config.

Stage only · 17/100Policy: stage
Agent surface
Any MCP/CLI agent
Kind
Mcp Config
Install
Stage only
Trust
Trust: Established
Entrypoint
Asset
Safe staging command
npx -y tokrepo@latest install 2c4d8def-3374-5876-87e9-73d83580f5f8 --target codex

Stages files first; activation requires review of the staged README and plan.

Intro

Connect Claude Code to a MySQL database with explicit read-only guards and optional SSH tunnel automation, so queries are auditable and repeatable.

Best for: Database exploration, troubleshooting, and schema QA where you want an agent to run SQL without write access

Works with: Claude Code (or any MCP client); MySQL; optional SSH tunnels for remote DBs

Setup time: 5–10 minutes

Key facts (verified)

  • README shows a Claude Code config with ALLOW_*_OPERATION=false toggles for read-only safety.
  • Supports SSH tunnel workflows and auto start/stop hooks (per README).
  • Uses npx @benborla29/mcp-server-mysql as the standard stdio entrypoint for Claude Code (per README).
  • GitHub: 1,638 stars · 206 forks; pushed 2026-03-10 (GitHub API verified).

Main

A safe pattern for “agent queries” is:

  1. Keep the MCP server read-only (leave ALLOW_INSERT_OPERATION, ALLOW_UPDATE_OPERATION, ALLOW_DELETE_OPERATION set to false).
  2. Ask the agent to describe intent before executing (e.g., “I will run a SELECT ... LIMIT 50 to validate hypothesis X”).
  3. Use the agent for schema discovery first (tables, columns, indexes) before any large query.
  4. When connecting to a remote DB, use the README’s SSH tunnel support and keep credentials out of version control (prefer env prompts / local secret stores).

If you later need writes (migrations, backfills), flip write flags only for a time-bounded session and keep a human in the loop.

FAQ

Q: Is it read-only? A: By default, yes. The README config shows write operations gated by ALLOW_*_OPERATION env flags.

Q: Can it connect to a remote DB? A: Yes. The README highlights SSH tunnel support for remote MySQL.

Q: How do I verify it’s working in Claude Code? A: Use claude mcp list and then try a small schema query (e.g., list tables) before larger SQL.

🙏

Source & Thanks

Source: https://github.com/benborla/mcp-server-mysql > License: MIT > GitHub stars: 1,638 · forks: 206

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets