Skip to content

MCP server

MySQL MCP server

A community MCP server that lets AI run SQL against MySQL, read-only by default, with insert, update and delete each switched on separately.

At a glance

Maintained by
Ben Borla (community)
Tools exposed
1 listed below
Reviewed
September 24, 2026

Why it matters

What it does and why it matters

MySQL runs a large share of business websites and apps, including many WordPress and WooCommerce stores. A MySQL MCP server lets an AI assistant query that data directly, so questions about orders, customers or content can be answered in plain English.

We did not find a production-grade MySQL server from the vendor. Oracle's own server targets MySQL HeatWave and is labeled as not for production use. The community server by Ben Borla is widely used and exposes a single query tool.

It is read-only by default. Insert, update and delete can each be turned on with a separate setting, which makes it easy to allow exactly what a workflow needs and nothing more. For business reporting we keep all three off and connect a user with read access to specific tables.

Because it is a community server, review the code and pin the version you tested before connecting it to real data.

Use cases

Best business use cases

Store questions

Ask about orders, products and customers in a WooCommerce database.

Ad hoc reports

Answer one-off questions without building a dashboard.

Content audits

Find posts or pages that match a condition across a large site.

Support lookups

Let an agent find an order when a customer asks about it.

Schema discovery

Understand an inherited database by asking what it holds.

Tools

Available tools

Tool names as published by the maintainer at review time. Versions change, so check the repository for the current list.

Read and write: Read-only by default; insert, update and delete can each be turned on with an env flag.

  • mysql_query

    Runs SQL queries. Read-only by default; writes need the ALLOW_* flags.

Workflows

Example workflows

Weekly store summary

  1. 1

    Connect the server to a read-only user.

  2. 2

    Ask for last week's orders by product category.

  3. 3

    The assistant writes and runs the query.

  4. 4

    It compares the result with the week before.

  5. 5

    It drafts a short summary for the team.

Customer lookup in support

  1. 1

    A customer asks about an order.

  2. 2

    The support assistant queries the order by email and date.

  3. 3

    It shows status and items to the agent.

  4. 4

    The agent replies with the details.

  5. 5

    No write access is needed at any step.

Prompts

Example prompts

  • “How many orders did we receive last week, by product category?”

  • “Which customers ordered more than three times this year?”

  • “List tables that store product data and describe their columns.”

Setup

Installation and configuration

Examples for Claude Desktop and Claude Code. Replace the placeholder values with your own keys, and store secrets outside version control.

Claude Desktop: claude_desktop_config.json

{
    "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"
            }
        }
    }
}

Claude Code: terminal

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
  • Local server: stdio. npm: @benborla29/mcp-server-mysql.
  • Needs: MYSQL_HOST; MYSQL_PORT; MYSQL_USER; MYSQL_PASS; MYSQL_DB; Optional write flags: ALLOW_INSERT_OPERATION, ALLOW_UPDATE_OPERATION, ALLOW_DELETE_OPERATION.

Security

Security considerations

  • Least privilege

    Create a dedicated database user that can read only the tables the assistant needs.

  • Use a replica

    Point the server at a read replica or copy, not the primary production database.

  • Log every query

    Keep a log of the queries the assistant runs, and review it in the first weeks.

  • Watch for sensitive data

    Keep insert, update and delete off unless a workflow truly needs them, and turn on one at a time.

Related servers

Servers that pair well with it

PostgreSQL

Lets AI assistants explore a PostgreSQL database, run SQL in a restricted read-only mode and check query performance and database health.

WooCommerce

WooCommerce's official MCP support, in preview, exposes store abilities for products and orders through the WordPress MCP Adapter.

SQLite

A community MCP server for SQLite files that lets AI list tables, read and change records and run SQL on a local database.

Keep exploring

FAQ

Questions people ask us

Have a question that is not here? Ask us directly.

Start a project

Want this connected to your own systems? We build AI workflows with MCP.

Send a short brief. We reply with questions, a suggested plan and an estimate you can compare with other offers.

Your privacy choices

We use necessary storage to run this site. With your permission we also use Google Analytics to see which pages help people, and load maps from Google. You can change this at any time. Read the cookie policy.