MySQL MCP Server
A Python MCP server for MySQL: listing tables, reading data, running SQL and inspecting schema through a controlled interface
- 1,416 ★ on the repository
- Last commit
- MIT
Broad access
Why this level
- Runs arbitrary SQL, including INSERT, UPDATE and DELETE in the database
- Handles database credentials and can change data when granted write access
Install
- Works in
In your terminal, with SkillFoxx CLI
npx skillfoxx add mcp/mysql-mcp-serverDetects the agents on your machine, shows the access level and pins the version.
Other ways to install
Access and checks
How we reviewBroad accessThe tool can change data, run commands or handle secrets.
- Runs arbitrary SQL, including INSERT, UPDATE and DELETE in the database
- Handles database credentials and can change data when granted write access
This is third-party code. Review the repository files before installing.
What it does
The server gives the agent safe access to a MySQL database through a set of tools. It exposes tables as resources, reads their contents and runs SQL with error handling: SELECT, SHOW, DESCRIBE and data-changing operations, which are marked as destructive. The get_schema_info tool returns columns, types, nullability, defaults and comments, and get_table_sample takes a small sample of rows. There is a multi-database mode when MYSQL_DATABASE is unset, with database.table references. Table and database names are validated against a strict character whitelist to block injection. The server runs over stdio and over SSE or HTTP, supports SSL and SSH tunneling, and masks passwords and keys in logs. It also ships ready prompts for exploring the database and analyzing a table.
Who it is for. For developers and analysts who need to explore a MySQL database and run queries through an agent.
Good fit when
- You want the agent to read schema and data from MySQL
- You want to run SQL queries against the database from the chat
- You need an overview of an unfamiliar database: tables, structure, sample rows
- You need access to several databases on one MySQL server
Not a fit when
- You need a database engine other than MySQL
- You cannot give the agent access to production data and have no test database
Example request
Show the tables in the database and sample the customers tableMCP
- Transport
- stdio, sse
- Authentication
- not required
Environment variables
MYSQL_HOSTrequired- MySQL database host.
MYSQL_USERrequired- MySQL user, preferably a dedicated one with minimal permissions.
MYSQL_PASSWORDrequired, secret- MySQL user password.
MYSQL_DATABASE- Default database. If unset, multi-database mode is enabled.
MYSQL_PORT- Database port, defaults to 3306.
Limitations
Access is configured with the MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD and other environment variables, and the password lives in the client configuration. Only single SQL statements are supported; compound queries like USE db; SELECT do not work. The .env file is read from the process working directory, but Claude Code and Claude Desktop launch the server from their own directory, so the variables are set in the MCP config env block instead. The SSE transport has no built-in authentication: the server listens on 0.0.0.0 by default, and beyond localhost it is placed behind an authenticating reverse proxy. The author recommends a dedicated MySQL user with minimal permissions and not using root.
How to disable. Remove the server entry from the client's MCP configuration or run claude mcp remove for its name. If installed via pip, uninstall the mysql-mcp-server package.
FAQ
Can the server change data?
Yes. execute_sql runs INSERT, UPDATE and DELETE, and such operations are marked as destructive. You limit them through the MySQL user's permissions.
Is this the same as benborla's MySQL MCP server?
No, it is a different project. This one is a Python server with the mysql-mcp-server package; benborla's is a Node server with a different package name.
Discussion
No questions or reviews yet.
Related
MCP serversMCP server that gives an agent access to MySQL: schema inspection and queries, read-only by default, writes behind flags
MySQL MCP Server Pro
mysql_mcp_server_pro
A MySQL MCP server that runs SQL under access roles, finds tables by comments and analyzes locks, indexes and query plans
A single-binary MCP server for MySQL, MariaDB, PostgreSQL and SQLite: read-only by default, with optional PII redaction
One MCP server for SQLite, SQL Server, PostgreSQL and MySQL: read and change data, edit schemas and export to CSV and JSON
An MCP server for Microsoft SQL Server and Azure SQL: the agent lists tables and runs SQL queries that read and write data
DB MCP Server
db-mcp-server
An MCP server for several databases with protection: a read-only mode per database and a row limit. Written in Go, launched in Docker
Comparison with similar tools
Cards that share the main search query, and how they differ.
| Tool | Official | Authentication | Repository stars | Main difference |
|---|---|---|---|---|
| MySQL MCP Server (this card) | no | not required | 1,416 | |
| MySQL MCP Server Pro | no | not required | 248 | A MySQL MCP server that runs SQL under access roles, finds tables by comments and analyzes locks, indexes and query plans |
| Microsoft SQL Server MCP Server | no | key is optional | 404 | an MCP server for Microsoft SQL Server and Azure SQL |
README in short
The README describes a Python MCP server for safe work with MySQL databases. It lists the execute_sql, get_schema_info and get_table_sample tools, multi-database mode, and the explore_database and analyze_table prompts. Setup goes through pip, uvx or Smithery, access is configured with environment variables, and the stdio and SSE transports, SSL and SSH tunneling are supported. A security section explains identifier validation, masking secrets in logs and the lack of authentication on SSE, for which a reverse proxy is recommended. The author advises creating a MySQL user with minimal permissions. MIT licensed.