mcp-server-mysql

MCP.Pizza Chef: benborla

Ask how many orders came in last week and get the answer without writing a line of SQL yourself. Your assistant can look at what tables exist, what each column holds, and run read-only lookups against them. Nothing can be changed unless you deliberately switch writing on. It handles remote databases over a secure tunnel, can hide sensitive fields like email addresses from results, and works across several databases at once. Setup is a short settings block with your database address and login.

Data

Use This MCP server To

Ask how many orders came in last month See which tables exist without opening a database tool Check a customer's record without writing SQL Pull a quick sales summary for a meeting Query a remote database over a secure tunnel

README

MCP Server for MySQL

MCP Toplist

Trust Score

Sponsor — Bloome

Bloome

Using mcp-server-mysql to let your AI query MySQL? Bloome brings that to your whole team — an AI-agent IM platform where AI agents are members of the chat. Connect your MCP tools and have agents inspect schemas, run queries, and answer data questions for everyone in one thread. Zero local setup, runs in the cloud, on web and mobile.


MCP server that gives Claude and other LLMs access to MySQL — inspect schemas, run queries, and optionally write data, all through the Model Context Protocol.

Key Features

  • Read-only by default — write operations opt-in via env flags
  • Claude Code integration — optimized for Anthropic's Claude Code CLI
  • SSH tunnel support — built-in support for remote databases
  • Multi-DB mode — query across multiple databases without reconnecting
  • Schema-specific permissions — per-database read/write control
  • PII redaction — automatic masking of sensitive data in results
  • Remote mode — HTTP transport with bearer token auth
  • SSL/TLS support — encrypted connections with mTLS option

Requirements

  • Node.js v20+
  • MySQL 5.7+ (8.0+ recommended)
  • MySQL user with appropriate privileges

Quick Install

Claude Code (simplest):

claude mcp add mcp_server_mysql \
  -e MYSQL_HOST="127.0.0.1" \
  -e MYSQL_PORT="3306" \
  -e MYSQL_USER="root" \
  -e MYSQL_PASS="your_password" \
  -e MYSQL_DB="your_database" \
  -- npx @benborla29/mcp-server-mysql

Claude Desktop / other clients:

{
  "mcpServers": {
    "mcp_server_mysql": {
      "command": "npx",
      "args": ["-y", "@benborla29/mcp-server-mysql"],
      "env": {
        "MYSQL_HOST": "127.0.0.1",
        "MYSQL_PORT": "3306",
        "MYSQL_USER": "root",
        "MYSQL_PASS": "your_password",
        "MYSQL_DB": "your_database"
      }
    }
  }
}

All write operations are disabled by default. Enable with ALLOW_INSERT_OPERATION=true, ALLOW_UPDATE_OPERATION=true, ALLOW_DELETE_OPERATION=true.

Documentation

  • Installation Guide — Smithery, Cursor, Codex, Claude Code, local repo, remote mode
  • Configuration & Environment Variables — all env vars, advanced config
  • Multi-DB Mode — querying multiple databases
  • PII Redaction — automatic data masking
  • Testing — test setup and running
  • Troubleshooting — common issues and fixes
  • Changelog

Tools & Resources

Tool: mysql_query Execute SQL queries. Read-only by default. Write operations enabled per flag.

Resources: mysql://tables Lists all tables and column metadata for the connected database.

Contributing

PRs welcome at github.com/benborla/mcp-server-mysql.

git clone https://github.com/benborla/mcp-server-mysql.git
pnpm install
pnpm run build
pnpm test

Contributors

License

MIT — see LICENSE for details.

mcp-server-mysql FAQ

Can it delete or change my data?
No, not unless you turn writing on yourself; everything is read-only out of the box.
Can I use this to answer questions about my sales data?
Yes — ask in plain English and it looks the numbers up for you.
Does it need a paid key?
No, but it does need your database address, username, and password.
Which apps does it work in?
Claude Code, Claude Desktop, Cursor, and other apps that accept a settings block.
What do I need installed?
Node version 20 or newer, and a MySQL database at version 5.7 or above.
Can it hide personal details?
Yes — it can mask sensitive fields so they never reach the assistant.