MySQL MCP Server
A Python MCP server for MySQL: listing tables, reading data, running SQL and inspecting schema through a controlled interface
High risk
We rate an entry high when the tool writes to external systems, handles money, production databases or secrets, or runs arbitrary commands. The CLI installs it only with your consent.
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
In your terminal, with SkillFoxx CLI
npx skillfoxx add mcp/mysql-mcp-serverDetects the agents on your machine, checks the risk and pins the version.
Other ways to install
This entry is high risk, so there is no one-click install. Review the code and add the config by hand.
Run in a terminal
claude mcp add --transport stdio --env 'MYSQL_HOST=<MYSQL_HOST value>' --env 'MYSQL_USER=<MYSQL_USER value>' --env 'MYSQL_PASSWORD=<your MYSQL_PASSWORD>' mysql -- uvx --from mysql-mcp-server mysql_mcp_serverOr add to the file .mcp.json, in the project
{
"mcpServers": {
"mysql": {
"command": "uvx",
"args": [
"--from",
"mysql-mcp-server",
"mysql_mcp_server"
],
"env": {
"MYSQL_HOST": "<MYSQL_HOST value>",
"MYSQL_USER": "<MYSQL_USER value>",
"MYSQL_PASSWORD": "<your MYSQL_PASSWORD>"
}
}
}
}If the file already exists, add the server inside the mcpServers key.
Keys and settings
MYSQL_HOSTrequiredMYSQL_PORToptionalMYSQL_USERrequiredMYSQL_PASSWORDsecret, requiredMYSQL_DATABASEoptional
Replace the values in angle brackets with your own. Keys never go into install links and are not stored by us.
Add to the file ~/.cursor/mcp.json, for all projects
{
"mcpServers": {
"mysql": {
"command": "uvx",
"args": [
"--from",
"mysql-mcp-server",
"mysql_mcp_server"
],
"env": {
"MYSQL_HOST": "<MYSQL_HOST value>",
"MYSQL_USER": "<MYSQL_USER value>",
"MYSQL_PASSWORD": "<your MYSQL_PASSWORD>"
}
}
}
}If the file already exists, add the server inside the mcpServers key. For a single project, put the same block into .cursor/mcp.json.
Keys and settings
MYSQL_HOSTrequiredMYSQL_PORToptionalMYSQL_USERrequiredMYSQL_PASSWORDsecret, requiredMYSQL_DATABASEoptional
Replace the values in angle brackets with your own. Keys never go into install links and are not stored by us.
Run in a terminal
code --add-mcp '{"name":"mysql","type":"stdio","command":"uvx","args":["--from","mysql-mcp-server","mysql_mcp_server"],"env":{"MYSQL_HOST":"<MYSQL_HOST value>","MYSQL_USER":"<MYSQL_USER value>","MYSQL_PASSWORD":"<your MYSQL_PASSWORD>"}}'Or add to the file .vscode/mcp.json, in the project
{
"servers": {
"mysql": {
"type": "stdio",
"command": "uvx",
"args": [
"--from",
"mysql-mcp-server",
"mysql_mcp_server"
],
"env": {
"MYSQL_HOST": "<MYSQL_HOST value>",
"MYSQL_USER": "<MYSQL_USER value>",
"MYSQL_PASSWORD": "<your MYSQL_PASSWORD>"
}
}
}
}If the file already exists, add the server inside the servers key.
Keys and settings
MYSQL_HOSTrequiredMYSQL_PORToptionalMYSQL_USERrequiredMYSQL_PASSWORDsecret, requiredMYSQL_DATABASEoptional
Replace the values in angle brackets with your own. Keys never go into install links and are not stored by us.
Run in a terminal
codex mcp add mysql --env 'MYSQL_HOST=<MYSQL_HOST value>' --env 'MYSQL_USER=<MYSQL_USER value>' --env 'MYSQL_PASSWORD=<your MYSQL_PASSWORD>' -- uvx --from mysql-mcp-server mysql_mcp_serverOr add to the file ~/.codex/config.toml, for all projects
[mcp_servers.mysql]
command = "uvx"
args = ["--from", "mysql-mcp-server", "mysql_mcp_server"]
env = { MYSQL_HOST = "<MYSQL_HOST value>", MYSQL_USER = "<MYSQL_USER value>", MYSQL_PASSWORD = "<your MYSQL_PASSWORD>" }If the file already exists, append the block to the end.
Keys and settings
MYSQL_HOSTrequiredMYSQL_PORToptionalMYSQL_USERrequiredMYSQL_PASSWORDsecret, requiredMYSQL_DATABASEoptional
Replace the values in angle brackets with your own. Keys never go into install links and are not stored by us.
Add to the file ~/.gemini/settings.json, for all projects
{
"mcpServers": {
"mysql": {
"command": "uvx",
"args": [
"--from",
"mysql-mcp-server",
"mysql_mcp_server"
],
"env": {
"MYSQL_HOST": "<MYSQL_HOST value>",
"MYSQL_USER": "<MYSQL_USER value>",
"MYSQL_PASSWORD": "<your MYSQL_PASSWORD>"
}
}
}
}If the file already exists, add the server inside the mcpServers key.
Keys and settings
MYSQL_HOSTrequiredMYSQL_PORToptionalMYSQL_USERrequiredMYSQL_PASSWORDsecret, requiredMYSQL_DATABASEoptional
Replace the values in angle brackets with your own. Keys never go into install links and are not stored by us.
Add to the file ~/.config/devin/mcp_config.json, for all projects
{
"mcpServers": {
"mysql": {
"command": "uvx",
"args": [
"--from",
"mysql-mcp-server",
"mysql_mcp_server"
],
"env": {
"MYSQL_HOST": "<MYSQL_HOST value>",
"MYSQL_USER": "<MYSQL_USER value>",
"MYSQL_PASSWORD": "<your MYSQL_PASSWORD>"
}
}
}
}If the file already exists, add the server inside the mcpServers key. Legacy Cascade keeps the MCP config in ~/.codeium/windsurf/mcp_config.json.
Keys and settings
MYSQL_HOSTrequiredMYSQL_PORToptionalMYSQL_USERrequiredMYSQL_PASSWORDsecret, requiredMYSQL_DATABASEoptional
Replace the values in angle brackets with your own. Keys never go into install links and are not stored by us.
Formerly Windsurf.
Add to the file cline_mcp_settings.json, for all projects
{
"mcpServers": {
"mysql": {
"command": "uvx",
"args": [
"--from",
"mysql-mcp-server",
"mysql_mcp_server"
],
"env": {
"MYSQL_HOST": "<MYSQL_HOST value>",
"MYSQL_USER": "<MYSQL_USER value>",
"MYSQL_PASSWORD": "<your MYSQL_PASSWORD>"
}
}
}
}If the file already exists, add the server inside the mcpServers key. Open the settings file in Cline: MCP Servers tab, Configure MCP Servers.
Keys and settings
MYSQL_HOSTrequiredMYSQL_PORToptionalMYSQL_USERrequiredMYSQL_PASSWORDsecret, requiredMYSQL_DATABASEoptional
Replace the values in angle brackets with your own. Keys never go into install links and are not stored by us.
Add to the file .roo/mcp.json, in the project
{
"mcpServers": {
"mysql": {
"command": "uvx",
"args": [
"--from",
"mysql-mcp-server",
"mysql_mcp_server"
],
"env": {
"MYSQL_HOST": "<MYSQL_HOST value>",
"MYSQL_USER": "<MYSQL_USER value>",
"MYSQL_PASSWORD": "<your MYSQL_PASSWORD>"
}
}
}
}If the file already exists, add the server inside the mcpServers key.
Keys and settings
MYSQL_HOSTrequiredMYSQL_PORToptionalMYSQL_USERrequiredMYSQL_PASSWORDsecret, requiredMYSQL_DATABASEoptional
Replace the values in angle brackets with your own. Keys never go into install links and are not stored by us.
A fork of Roo Code, same .roo folders.
Add to the file opencode.json, in the project
{
"mcp": {
"mysql": {
"type": "local",
"command": [
"uvx",
"--from",
"mysql-mcp-server",
"mysql_mcp_server"
],
"environment": {
"MYSQL_HOST": "<MYSQL_HOST value>",
"MYSQL_USER": "<MYSQL_USER value>",
"MYSQL_PASSWORD": "<your MYSQL_PASSWORD>"
}
}
}
}If the file already exists, add the server inside the mcp key.
Keys and settings
MYSQL_HOSTrequiredMYSQL_PORToptionalMYSQL_USERrequiredMYSQL_PASSWORDsecret, requiredMYSQL_DATABASEoptional
Replace the values in angle brackets with your own. Keys never go into install links and are not stored by us.
Add to the file ~/.config/zed/settings.json, for all projects
{
"context_servers": {
"mysql": {
"command": "uvx",
"args": [
"--from",
"mysql-mcp-server",
"mysql_mcp_server"
],
"env": {
"MYSQL_HOST": "<MYSQL_HOST value>",
"MYSQL_USER": "<MYSQL_USER value>",
"MYSQL_PASSWORD": "<your MYSQL_PASSWORD>"
}
}
}
}If the file already exists, add the server inside the context_servers key.
Keys and settings
MYSQL_HOSTrequiredMYSQL_PORToptionalMYSQL_USERrequiredMYSQL_PASSWORDsecret, requiredMYSQL_DATABASEoptional
Replace the values in angle brackets with your own. Keys never go into install links and are not stored by us.
Add to the file .codeassistant/mcp.json, in the project
{
"mcpServers": {
"mysql": {
"command": "uvx",
"args": [
"--from",
"mysql-mcp-server",
"mysql_mcp_server"
],
"env": {
"MYSQL_HOST": "<MYSQL_HOST value>",
"MYSQL_USER": "<MYSQL_USER value>",
"MYSQL_PASSWORD": "<your MYSQL_PASSWORD>"
}
}
}
}If the file already exists, add the server inside the mcpServers key.
Keys and settings
MYSQL_HOSTrequiredMYSQL_PORToptionalMYSQL_USERrequiredMYSQL_PASSWORDsecret, requiredMYSQL_DATABASEoptional
Replace the values in angle brackets with your own. Keys never go into install links and are not stored by us.
In Claude Code run claude mcp add --transport stdio designcomputer-mysql_mcp_server uvx mysql_mcp_server. Then set MYSQL_HOST, MYSQL_PORT, MYSQL_USER, MYSQL_PASSWORD and, if needed, MYSQL_DATABASE in the MCP config env block. Requires uv installed.
Other ways from the author
claude mcp add --transport stdio designcomputer-mysql_mcp_server uvx mysql_mcp_serverRequires uv. The MySQL connection variables are set in the MCP config env block.
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 tableLimitations
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.
MCP
- Transport
- stdio, sse
- Authentication
- not required
| Environment variables | |
|---|---|
| MYSQL_HOST required | MySQL database host. |
| MYSQL_USER required | MySQL user, preferably a dedicated one with minimal permissions. |
| MYSQL_PASSWORD required, secret | MySQL user password. |
| MYSQL_DATABASE | Default database. If unset, multi-database mode is enabled. |
| MYSQL_PORT | Database port, defaults to 3306. |
Security check
- Runs arbitrary SQL, including INSERT, UPDATE and DELETE in the database
- Handles database credentials and can change data when granted write access
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.
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.
Related
166 skills for scientific work: bioinformatics, cheminformatics, clinical data, geospatial analysis and 100+ databases
Google's open-source MCP server for databases: ready tools for Postgres, MySQL, BigQuery, Spanner and more, plus custom tools in tools.yaml
Official Hugging Face skills: Hub operations via the hf CLI, datasets, model training, Spaces, evals and deployment
A visualization language for agents and an MCP server: neat charts from a simple semantic spec