MySQL MCP logo

MySQL MCP

Connects an AI client to one MySQL or MariaDB database for schema inspection, read-only SQL, query plans, and guarded data changes.

Install MySQL MCP

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "mysql-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-mysql-client"
      ],
      "env": {
        "MYSQL_USER": "YOUR_VALUE_HERE",
        "MYSQL_DB": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

Automated check passed— started and listed 6 tools correctly ().

Overview

MySQL MCP connects an AI client to one configured MySQL or MariaDB database through six MCP tools. It exposes schema metadata, read-only queries, execution plans, connection details, and optionally controlled INSERT, UPDATE, or DELETE operations. Read results are capped and marked when truncated, while write permissions are disabled by default and configured outside the conversation. Reach for it when an agent needs to inspect an unfamiliar database, analyze SQL performance, or perform narrowly permitted data updates.

Use cases

  • Inspect an unfamiliar database schema
  • Run parameterized read-only reports
  • Analyze slow queries before execution
  • Review foreign-key dependencies before deletion
  • Apply narrowly enabled data updates

Key features

  • Single-database MySQL or MariaDB connection
  • Schema, table, index, and relationship inspection
  • Read-only SQL with parameter binding
  • Execution plans with optional runtime analysis
  • Bounded results with truncation reporting
  • Separately gated INSERT, UPDATE, and DELETE operations

Tools6

What MySQL MCP lets your agent do. Expand a tool for its parameters.

Verified live~1.2k tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

23/23 checks healthy over the last 78d

What it can do

From the 6 tools this server returned when we ran it; 6 declare their own safety hints.

Runs commands · 2Can delete or modify data · 1Makes network requests · 6Read-only tools · 4
Network at startup4 connections
Files written at startup1
Install scriptsprepare
npm provenanceNot published
Package age79 days
Maintainers1

Observed 2026-11-10 in an isolated sandbox. A description of reach, not a security audit.

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 3d ago via OSV.dev · mcp-mysql-client (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

npm downloads764Package downloads in the last 30 days.
Last commit1d agoMost recent push to the default branch.
Availability100%Our rolling endpoint + install checks that succeeded.
Install checkPassedOur sandbox started it and listed its tools.
Tools exposed6Callable tools this server registers over MCP.
Directory activity17 viewsConfig copies, upvotes, and views on AllMCPs.

How MySQL MCP works

What MySQL MCP does

MySQL MCP gives an MCP-compatible AI client access to one MySQL or MariaDB database. The database is selected in the server configuration, so a running instance cannot switch to another database through a tool call. To work with multiple databases, configure separate server entries and credentials for each one.

The default posture is read-only. Agents can inspect tables and relationships, run supported read queries, and examine execution plans without changing data. INSERT, UPDATE, and DELETE can be enabled independently through environment variables, but both the MCP setting and the connected MySQL account's GRANT permissions must allow the operation. DDL remains unavailable, including CREATE, ALTER, DROP, TRUNCATE, and RENAME.

How it works

The server provides six tools:

  • server_info reports the selected database, connected MySQL user, server version, database size, MySQL grants, and MCP-side limits.
  • list_tables returns tables and views with engine, character set, comments, storage sizes, and an estimated row count. InnoDB estimates may differ from an exact COUNT(*).
  • describe_table shows columns, types, nullability, defaults, comments, indexes, outgoing foreign keys, and tables that reference the target.
  • query accepts one read statement, including SELECT, SHOW, DESCRIBE, and suitable WITH queries. Parameters use ? placeholders and a separate params value.
  • explain returns an execution plan. With analyze=true, it runs the query to report actual timing, which can be expensive for large tables.
  • execute runs one INSERT, UPDATE, DELETE, or REPLACE statement and returns affected-row counts.

Read queries run in read-only transactions when that setting is enabled, and their results are streamed up to MYSQL_MAX_ROWS. A response exceeding that limit is a prefix of the result and carries a truncated indicator. Each call contains one statement. UPDATE and DELETE statements without WHERE or LIMIT require allow_full_table=true in the call.

Setup and configuration

Run the npm package with npx -y mcp-mysql-client from an MCP client configuration. Set MYSQL_USER and MYSQL_DB, along with the connection details required by the target environment. MYSQL_HOST defaults to 127.0.0.1, MYSQL_PORT to 3306, and MYSQL_PASS accepts a password; MYSQL_PASSWORD is an alias. MYSQL_SOCKET_PATH can select a Unix socket instead of host and port, while MYSQL_PASS_FILE reads the password from a file.

TLS can be required with MYSQL_SSL=true. Providing MYSQL_SSL_CA also enables TLS, and MYSQL_SSL_REJECT_UNAUTHORIZED controls certificate verification. MYSQL_TIMEOUT_MS, MYSQL_CONNECT_TIMEOUT_MS, MYSQL_POOL_SIZE, and MYSQL_MAX_RETRIES tune query timeout, connection timeout, pool size, and retry behavior.

Set ALLOW_INSERT_OPERATION, ALLOW_UPDATE_OPERATION, or ALLOW_DELETE_OPERATION to true to enable the corresponding write type. These changes require a server restart and do not grant permissions in MySQL. MYSQL_READ_ONLY_TX controls read-only transaction behavior, and ASKADS_TELEMETRY=0 disables anonymous tool-call startup statistics.

Tools and capabilities

A practical discovery sequence is server_info, list_tables, and describe_table, followed by query for exact counts or filtered data. explain is useful before running expensive reads or investigating slow SQL. Foreign-key references returned by describe_table help identify dependencies before deleting rows.

Use a least-privileged MySQL account rather than an administrative account. The server blocks session-changing or unsafe operations such as SET, CALL, PREPARE, LOAD DATA, locking statements, GRANT, and SELECT ... INTO OUTFILE. It also rejects multiple statements in one request.

Limitations and notes

execute is immediate and does not provide a rollback facility through the server. Enabling an MCP write flag is not enough when the MySQL account lacks the matching grant. The server cannot perform DDL under any configuration, and read responses may be incomplete when the row ceiling is reached. Start with server_info when a request is rejected, because database grants and MCP restrictions are separate layers.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about MySQL MCP

MySQL MCP is an MCP server that connects AI clients to one MySQL or MariaDB database. Its main tools inspect schema, run read-only queries, explain execution plans, report connection details, and optionally execute guarded INSERT, UPDATE, or DELETE statements when configured permissions allow them.

Install it through an MCP client by running `npx -y mcp-mysql-client` and supplying the database environment variables. Configure `MYSQL_USER` and `MYSQL_DB`, then add the host, port, password or password file, and TLS settings needed for the connection.

Yes, MySQL MCP works with Claude Desktop through its MCP server configuration. Add a server entry that runs `npx` with `-y mcp-mysql-client` and pass the MySQL connection values in the entry's `env` object.

Set `ALLOW_UPDATE_OPERATION=true` or `ALLOW_DELETE_OPERATION=true` in the MCP server environment and restart it. The MySQL account must also have the matching grant, and UPDATE or DELETE without WHERE or LIMIT requires `allow_full_table=true` in the tool call.

No, MySQL MCP does not support DDL statements. CREATE, ALTER, DROP, TRUNCATE, and RENAME remain blocked even when write-related environment variables are enabled.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewMySQL MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/mysql-mcp?style=directory)](https://allmcps.com/mcp/mysql-mcp)
HTML Embed
<a href="https://allmcps.com/mcp/mysql-mcp"><img src="https://allmcps.com/api/badge/mysql-mcp?style=directory" alt="MySQL MCP on AllMCPs" /></a>