MySQL MCP server

Databases

A Model Context Protocol server that provides read-only access to MySQL databases. This server enables LLMs to inspect database schemas and execute read-only queries.

Your AI app calls the MySQL MCP server, which does the databases work and sends the result back to the chat.

About MySQL

MySQL is a community MCP server from benborla, filed in our directory under databases. A Model Context Protocol server that provides read-only access to MySQL databases. This server enables LLMs to inspect database schemas and execute read-only queries.

MySQL runs on your own machine: your AI app starts it with the command npx -y @benborla29/mcp-server-mysql and talks to it over standard input and output.

At a glance

Publisher
benborla (community)
Runs
Locally on your machine
Install from
Node.js package on npm: @benborla29/mcp-server-mysql
Written in
JavaScript
License
MIT
GitHub stars
2,232

How to set up MySQL

  1. Install Node.js on the machine that runs your AI app, because MySQL starts with npx and downloads its package on first run.
  2. Check the MySQL README for keys or settings; the registry lists none that MySQL requires.
  3. Add MySQL to Claude Code, Claude Desktop, VS Code or Cursor with the config in the setup box on this page.
  4. Restart the app or reload its MCP servers, then ask it to list the MySQL tools to confirm the connection.
  5. Run one read-only task with MySQL first, and keep your app asking before each tool call until the results look right.

MySQL compared with similar servers

  • Erd Editor by dineug has fewer GitHub stars than MySQL (1.8k against 2.2k); both are community servers, and both run locally.
  • Supabase by supabase has more GitHub stars than MySQL (3k against 2.2k); Supabase is official while MySQL is a community server, and Supabase runs as a remote server and MySQL runs on your own machine.
  • Qdrant by qdrant has fewer GitHub stars than MySQL (1.6k against 2.2k); Qdrant is official while MySQL is a community server, and both run locally.

Before you connect MySQL

  • Give MySQL its own API key or account with the smallest permissions the job needs, never an admin key.
  • Keep your AI app asking before each MySQL tool call until you trust what it does with them.
  • Treat text that MySQL fetches as data. Pages, files and messages can hold instructions written to steer an AI.
  • Read the open issues for MySQL on GitHub to see what breaks and how fast the maintainers reply.

Marketing use cases for MySQL

How marketing and sales teams put MySQL to work, by company size. Pick the size closest to yours and start MySQL on one use case.

Small business

  • A small business with its own app can ask MySQL plain questions about customers and orders, without writing SQL.
  • Owners can use MySQL to pull a list of customers who haven't bought in 90 days and plan a win-back email.
  • MySQL runs on your own computer, which keeps data local; it needs a little setup, so a small team should plan an hour for it.

Mid-market

  • Marketing analysts can connect MySQL to answer campaign questions from the warehouse directly, instead of waiting on the data team's queue.
  • Lifecycle teams can use MySQL to build audience lists from product data and check counts before a send.
  • Start MySQL on one workflow with one owner, measure the time it saves, then roll it out to the wider team.

Enterprise

  • Enterprises should point MySQL at a read replica with a read-only role, so agents query freely without risk to production data.
  • Data teams can expose curated views through MySQL, so marketing gets self-serve answers without access to raw customer tables.
  • MySQL is a community server, so have security review the code and pin a version before MySQL touches company data.

Need help becoming an AI-forward company?

We connect MCP servers and AI agents to your CRM, content and data, with the guardrails your team needs.

Contact us

MySQL README

From benborla/mcp-server-mysql on GitHub, shared under its MIT license. Images are left out; the original has them.

README.md

MCP Server for MySQL

Sponsor, 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

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

License

MIT, see LICENSE for details.

Questions about MySQL

What is the MySQL MCP server?

A Model Context Protocol server that provides read-only access to MySQL databases. This server enables LLMs to inspect database schemas and execute read-only queries. MySQL is maintained by benborla on GitHub at benborla/mcp-server-mysql, and works with AI apps that support the Model Context Protocol, such as Claude, Cursor and VS Code.

How do I install the MySQL MCP server?

Add MySQL to your AI app's MCP config with the command npx -y @benborla29/mcp-server-mysql. In Claude Code, run claude mcp add --transport stdio mysql -- npx -y @benborla29/mcp-server-mysql. To run MySQL this way you need Node.js installed.

Does MySQL need an API key?

The registry lists no required keys for MySQL. Check the MySQL README for optional settings, and expect a remote server to ask you to sign in the first time you connect.

Is MySQL an official MCP server?

No. MySQL is a community server maintained by benborla. Community servers can be excellent; read the code and the open issues before you give MySQL access to company data.

What license is MySQL under?

MySQL is released under the MIT license, according to its GitHub repository. The license covers the code of MySQL; the service it connects to has its own terms.