A universal database MCP server — one integration for PostgreSQL, MySQL, SQL Server, SQLite, and MariaDB.
MySQL MCP Server
Summary
Open-source Python MCP server for MySQL: lets an AI assistant list tables, read schemas, sample rows and run SQL against your database, with multi-database mode, SSH tunnelling and stdio or SSE transport.
Features
- execute_sql runs single SQL statements, with DML flagged as destructive
- get_schema_info returns columns, types, nullability, defaults and comments
- get_table_sample fetches up to 20 rows to show a table's shape
- Tables exposed as MCP resources; explore_database and analyze_table prompts
- Multi-database mode with database.table addressing
- SSH tunnelling, SSL modes and an SSE/HTTP transport for self-hosting
Installation
Set up this MCP server in your favorite AI agent — copy a ready-made configuration below.
Description
MySQL MCP Server is a widely used open-source Model Context Protocol server, published by Design Computer, that connects an AI assistant to a MySQL database through a small, controlled interface. Credentials stay in environment variables, and the assistant works through a handful of tools rather than an open shell.
It exposes tables as MCP resources so a client can list and read them, and three tools: execute_sql runs a single SQL statement (SELECT, SHOW, DESCRIBE, and INSERT, UPDATE or DELETE, which are flagged as destructive), get_schema_info returns column names, types, nullability, defaults and comments, and get_table_sample fetches up to 20 rows to show the data's shape. Two prompts, explore_database and analyze_table, chain those tools into guided walk-throughs. Leaving MYSQL_DATABASE unset switches on multi-database mode, where every user database is listed and tables are addressed as database.table. Multi-statement queries are not supported.
The server is the MIT-licensed PyPI package mysql-mcp-server, usually launched with uvx --from mysql-mcp-server mysql_mcp_server and configured with MYSQL_HOST, MYSQL_PORT, MYSQL_USER, MYSQL_PASSWORD and optionally MYSQL_DATABASE. Further settings cover SSL mode, timeouts, charset and auth plugin for older MySQL versions, an SSH jump host for databases that are not directly reachable, and an SSE/HTTP transport (MCP_TRANSPORT=sse) for self-hosted shared deployments. Using a database user with only the privileges the assistant should have is the main safety control.
Related MCP Servers
See all MySQL MCP Server alternativesMCP: PlanetScale
by PlanetScale
PlanetScale's official hosted MCP server — browse organizations, databases and branches, read schema, run guarded SQL, and pull Insights and schema recommendations.
MCP: Database MCP (dbmcp)
by Haymon AI
A single ~7 MB binary that gives your AI assistant schema discovery, SQL queries and EXPLAIN plans for MySQL, MariaDB, PostgreSQL and SQLite, with a read-only mode.
MCP: CockroachDB MCP Server
by Cockroach Labs
Cockroach Labs' official MCP server exposes a CockroachDB cluster to agents as typed tools — schema inspection, cluster metadata, EXPLAIN and SELECT — with writes and DDL locked off unless you explicitly turn them on.