MCP Mysql logo

MCP Mysql

by @abelmferreira

Query, inspect, monitor, and analyze MySQL or MariaDB through MCP with read-only controls and optional SSH tunneling.

Install MCP Mysql

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": {
    "abelmferreira-mcp-mysql": {
      "command": "npx",
      "args": [
        "-y",
        "@abelmferreira/mcp-mysql"
      ],
      "env": {
        "READONLY": "YOUR_VALUE_HERE",
        "SQL_CONNECTION_URL": "YOUR_VALUE_HERE",
        "SQL_SERVER": "YOUR_VALUE_HERE",
        "SQL_DATABASE": "YOUR_VALUE_HERE",
        "SQL_USER": "YOUR_VALUE_HERE",
        "SQL_PASSWORD": "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.

We couldn’t confirm it starts correctly

We ran the install command but it didn't respond within our test window — this can mean a slow first-time install rather than a real problem.

npx -y @abelmferreira/mcp-mysql

No response to initialize.

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked .

Overview

@abelmferreira/mcp-mysql connects MCP clients to MySQL and MariaDB for SQL queries, schema inspection, monitoring, and performance analysis. It runs over stdio through npx or Docker and accepts either a connection URL or separate database settings. Read-only mode is required as an explicit setting and is recommended; writes become available only when READONLY=false. An integrated SSH local tunnel supports databases reachable through a bastion host.

Use cases

  • Run read-only SQL queries against MySQL or MariaDB
  • Inspect tables, columns, views, and indexes
  • Diagnose waits, locks, and active database queries
  • Review query plans and identify index opportunities
  • Reach a private database through an SSH bastion

Key features

  • MySQL and MariaDB query execution
  • Read-only mode with optional write enablement
  • Schema and index exploration
  • Performance and wait monitoring
  • Query and index analysis
  • Built-in SSH tunneling with host-key pinning

Tools17

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

Self-reported~51 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.

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 7d ago via OSV.dev · @abelmferreira/mcp-mysql (npm)

Adoption & maintenance

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

npm downloads800Package downloads in the last 30 days.
Last commit6d agoMost recent push to the default branch.
Install checkInconclusiveDidn't respond in our test window — often a slow first install.
Tools exposed17Callable tools this server registers over MCP.

How MCP Mysql works

What @abelmferreira/mcp-mysql does

@abelmferreira/mcp-mysql exposes MySQL and MariaDB databases to MCP-compatible clients. Its database features cover four main areas: executing permitted SQL, exploring schemas, monitoring runtime activity, and examining query or index performance.

The server supports SELECT, WITH, EXPLAIN, DESCRIBE, and read-only SHOW statements. Queries can use named @param placeholders. Results include row data and metadata such as row counts, fields, execution duration, and whether output was truncated. Schema tools can inspect tables, views, columns, indexes, stored procedures, and complete table descriptions.

How it works

The recommended deployment uses npx -y @abelmferreira/mcp-mysql as an MCP stdio process. Docker is also supported through the abelmferreira/mcp-mysql image. Connection details can be supplied with a MySQL or MariaDB URL, individual SQL_* variables, or a dotenv file referenced by ENV_FILE.

For private databases, set SSH_HOST to have the server create an in-process local port forward. The database host and port are then interpreted from the SSH host's network perspective. The SSH host fingerprint is mandatory, keys can be protected with a passphrase, and dropped sessions are re-established automatically. The tunnel key should be restricted on the bastion to local forwarding and the intended database destination.

Setup and configuration

Node.js 20.12 or newer is required for the npx method. MySQL 8.0+ or MariaDB 10.5+ is recommended. Monitoring and analysis functions depend in part on the performance_schema and sys schemas.

A minimal client configuration sets READONLY and either SQL_CONNECTION_URL or the individual connection variables. SQL_SSL enables TLS; certificate verification is enabled by default, and SQL_SSL_CA can identify a custom certificate authority. QUERY_TIMEOUT, MAX_ROWS, MAX_RESULT_BYTES, and POOL_MAX limit execution time, result size, and connection usage. Environment variables supplied directly by the MCP client take precedence over values loaded from ENV_FILE.

Tools and capabilities

  • Execute read-only SQL and inspect returned rows, fields, counts, duration, and truncation status.
  • Analyze query plans with EXPLAIN and identify possible index improvements.
  • List schemas and inspect indexes, including unused or redundant indexes.
  • Monitor active queries, connections, InnoDB lock waits, wait statistics, database size, and performance counters.
  • Review fragmentation and statistics freshness through the database's metadata systems.
  • Enable INSERT, UPDATE, and DELETE tools only by setting READONLY=false.

Limitations and notes

Results are capped by MAX_ROWS and MAX_RESULT_BYTES; oversized results are cut and marked as truncated. Query execution is bounded by QUERY_TIMEOUT, with a maximum configured timeout of 120 seconds. The connection pool defaults to three database connections and should remain below the account's connection limit.

Some monitoring and analysis tools require suitable MySQL or MariaDB versions and populated performance_schema or sys data. With Docker, the SSH key must be mounted into the container, and a database running on the Docker host should be addressed through host.docker.internal rather than localhost.

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 MCP Mysql

@abelmferreira/mcp-mysql is an MCP server that connects AI clients to MySQL and MariaDB databases. Its main tools execute SQL, inspect schemas and indexes, monitor queries and performance, analyze execution plans, and suggest indexes. It runs over stdio and supports read-only operation plus optional SSH tunneling.

Run it with `npx -y @abelmferreira/mcp-mysql` from your MCP client configuration, or use the `abelmferreira/mcp-mysql` Docker image. Configure `READONLY` and either `SQL_CONNECTION_URL` or the individual SQL connection variables in the client's environment.

Set `SSH_HOST`, `SSH_USER`, `SSH_KEY_PATH`, and the required `SSH_HOST_FINGERPRINT` environment variables. The server creates the local forwarding tunnel itself, while `SQL_SERVER` and `SQL_PORT` identify the database as seen from the SSH host.

Set `READONLY=false` to enable write operations. Read-only mode is the recommended default, and write-capable tools remain disabled unless this setting explicitly permits them.

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 PreviewMCP Mysql AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/abelmferreira-mcp-mysql?style=directory)](https://allmcps.com/mcp/abelmferreira-mcp-mysql)
HTML Embed
<a href="https://allmcps.com/mcp/abelmferreira-mcp-mysql"><img src="https://allmcps.com/api/badge/abelmferreira-mcp-mysql?style=directory" alt="MCP Mysql on AllMCPs" /></a>