MCP Mysql Connector logo

MCP Mysql Connector

Connects AI agents to MySQL for SQL execution, schema management, transactions, user privileges, and server status.

Install MCP Mysql Connector

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

STDIOPython
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "mcp-mysql-connector": {
      "command": "uvx",
      "args": [
        "mcp-mysql-connector"
      ],
      "env": {
        "MYSQL_HOST": "YOUR_VALUE_HERE",
        "MYSQL_PORT": "YOUR_VALUE_HERE",
        "MYSQL_USER": "YOUR_VALUE_HERE",
        "MYSQL_PASSWORD": "YOUR_VALUE_HERE",
        "MYSQL_DATABASE": "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.

uvx mcp-mysql-connector

Process exited before answering 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

The mcp-mysql-connector MCP server exposes MySQL connection, query, administration, and metadata operations through MCP tools. It runs over stdio by default, and an agent establishes a database session with the connect tool using host, port, user, password, and database values. Available operations include raw SQL execution, transaction control, database and table changes, schema inspection, index management, user privileges, and server status checks. Reach for it when an MCP client needs direct MySQL administration or query access through standardized tools.

Use cases

  • Run SQL queries against a connected MySQL database
  • Inspect database, table, column, and index metadata
  • Create or modify MySQL databases and tables
  • Manage MySQL users and privileges
  • Control transactions with commits and rollbacks

Key features

  • Raw SQL execution with returned results
  • Database and table lifecycle management
  • Schema, column, and index inspection
  • MySQL user and privilege administration
  • Explicit commit and rollback controls
  • Dynamic database and table metadata resources

Tools25

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

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

13/13 checks healthy over the last 78d

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-connector (PyPI)

Adoption & maintenance

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

Last commit7mo agoMost recent push to the default branch.
Install checkInconclusiveDidn't respond in our test window — often a slow first install.
Tools exposed25Callable tools this server registers over MCP.
Directory activity2 viewsConfig copies, upvotes, and views on AllMCPs.

How MCP Mysql Connector works

What mcp-mysql-connector MCP server does

The mcp-mysql-connector MCP server gives an MCP-compatible agent access to MySQL operations. It covers both data access and administrative tasks: agents can run raw SQL, inspect database structures, create or remove databases and tables, manage indexes, and check server status.

Connection and transaction controls are included. An agent can connect, disconnect, check connection state, commit changes, or roll back the current transaction. User administration tools support creating and removing MySQL users, granting and revoking privileges, and viewing a user’s privileges.

The server also publishes dynamic metadata resources. A database://{name} resource represents database metadata and its table list, while table://{db}/{table} provides table metadata, including schema, columns, and indexes.

How it works

The server uses the Model Context Protocol to expose MySQL functions as callable tools. It starts with stdio transport by default, making it suitable for MCP clients that launch local servers through standard input and output.

A connection must be established through connect before database operations can be used. The connection parameters include the MySQL host, port, username, password, and optionally a database. Once connected, an agent can call execute_query with SQL text or use the narrower management tools for databases, tables, columns, indexes, users, and privileges.

Transaction handling is explicit. An agent can issue SQL such as BEGIN through execute_query, perform subsequent operations, then call commit or rollback as appropriate. The available tools do not describe a separate query language or ORM layer; SQL execution is provided directly through the raw-query tool.

Setup and configuration

Install the package with:

Terminal
pip install mcp-mysql-connector

The documented runtime requires Python 3.11 or newer. The package lists fastmcp >= 2.0.0, pymysql >= 1.1.0, and sqlparse >= 0.4.0 as requirements.

Start the default stdio server with:

bash
mcp-mysql-connector

It can also be started programmatically with mcp.run() from the mcp_mysql package. Database settings may be supplied through the connect tool or environment variables: MYSQL_HOST, MYSQL_PORT, MYSQL_USER, MYSQL_PASSWORD, and MYSQL_DATABASE.

Tools and capabilities

The mcp-mysql-connector MCP server exposes these groups of tools:

  • Connection and transactions: connect, disconnect, is_connected, commit, and rollback.
  • SQL execution: execute_query, which runs raw SQL and returns results.
  • Database administration: list, create, remove, and check databases.
  • Table administration: list, describe, create, remove, and check tables.
  • Schema details: inspect columns and indexes, and create or remove indexes.
  • User and privilege management: create or remove users, grant or revoke privileges, and show privileges.
  • Server information: retrieve MySQL server status.

These capabilities make the server applicable to database exploration, schema changes, controlled SQL workflows, and MySQL account administration. Operations that change databases, tables, indexes, users, or privileges should be exposed only to agents with appropriate database permissions.

Limitations and notes

The server exposes raw SQL execution, so the connected MySQL account and the agent’s instructions determine which SQL operations can be attempted. The material also does not specify authentication enhancements, query safety checks, or a read-only mode beyond the permissions enforced by MySQL.

The project includes development instructions for running tests, formatting, linting, and type checking, but those commands are for contributors rather than normal installation. It is licensed under the MIT License.

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 Connector

mcp-mysql-connector is an MCP server that connects AI agents to MySQL databases through the Model Context Protocol. Its main tools cover connection management, raw SQL execution, database and table administration, schema and index inspection, user privileges, transactions, and server status.

Install it with `pip install mcp-mysql-connector`, then run `mcp-mysql-connector`. The documented runtime requires Python 3.11 or newer, along with the package dependencies specified by the project.

Configure credentials by calling `connect` with the host, port, user, password, and database, or by setting `MYSQL_HOST`, `MYSQL_PORT`, `MYSQL_USER`, `MYSQL_PASSWORD`, and `MYSQL_DATABASE`. The server uses these values to connect to MySQL.

Yes, it provides an `execute_query` tool that runs raw SQL and returns results. Agents can also use dedicated tools for database, table, index, user, privilege, and transaction operations.

Yes, it provides `commit` and `rollback` tools for transaction control. An agent can issue `BEGIN` through `execute_query`, perform operations, and then commit or roll back the current transaction.

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