Is the MySQL MCP server safe? What it can reach
What the MySQL MCP server can read, write and delete, how it signs in, and how to limit it in Claude Code and Codex.
MySQL has no general-purpose official MCP server, so this page covers benborla/mcp-server-mysql, a community server with about 2,200 stars. It runs locally over stdio and signs in with a MySQL user and password, so the agent holds that user’s rights. It is read-only by default, and the ALLOW_ flags turn on inserts, updates, deletes and DDL.
Who maintains it
| Implementation | Kind | Status |
|---|---|---|
| benborla/mcp-server-mysql (community, npm @benborla29/mcp-server-mysql) | Community | active |
It runs as a local process on your machine or as a hosted remote server.
How it signs in
A MySQL user and password from MYSQL_USER and MYSQL_PASS, or a connection string. The server acts with that database user’s privileges. Its optional HTTP mode uses a bearer token in REMOTE_SECRET_KEY.
What its tools can do
| Kind | Tools |
|---|---|
| Read | none documented |
| Write | mysql_query |
| Can’t be undone | none documented |
There is one tool, mysql_query, which runs SQL. It is read-only unless you set the ALLOW_ environment variables. With ALLOW_DELETE_OPERATION or ALLOW_DDL_OPERATION on, the same tool can delete rows or drop tables, so tool-level rules cannot separate safe queries from unsafe ones. The README also lists a mysql://tables resource. Oracle’s separate MySQL AI and HeatWave server was not reviewed.
Built-in limits
| Option | What it does |
|---|---|
ALLOW_INSERT_OPERATION, ALLOW_UPDATE_OPERATION, ALLOW_DELETE_OPERATION, ALLOW_DDL_OPERATION | All default to false. Each turns on one kind of write. |
SCHEMA_INSERT_PERMISSIONS and related | Set write permissions per database in the form db:true or db:false, which override the global flags. MULTI_DB_WRITE_MODE defaults to false. |
MYSQL_DISABLE_READ_ONLY_TRANSACTIONS | Defaults to false. The docs warn to leave it off. |
ENABLE_PII_REDACTION | Masks columns it treats as personal data in read results. It is off by default. |
MYSQL_RATE_LIMIT and MYSQL_QUERY_TIMEOUT | Cap queries per minute (100 by default) and query time (30 seconds by default). |
The risks
- An injected instruction in a text column the agent reads could make it run a query that copies sensitive rows into its answer, since mysql_query reads whatever the database user can read.
- If ALLOW_DELETE_OPERATION or ALLOW_DDL_OPERATION is on, one bad query can delete rows or drop a table, and the tool has no separate confirmation step.
- Connecting as root, the example default, gives the agent full control of the server regardless of the ALLOW_ flags.
- SSL is off by default and MYSQL_CONNECTION_STRING holds credentials in plain text, so a remote database needs MYSQL_SSL on and secrets kept out of committed config.
Limit it in Claude Code
Add it from the documented launch settings, at local or user scope so a token never lands in a shared .mcp.json:
claude mcp add --env MYSQL_HOST=... --env MYSQL_PORT=... --env MYSQL_USER=... --env MYSQL_PASS=... --env MYSQL_DB=... mysql -- npx -y @benborla29/mcp-server-mysqlClaude Code names MCP tools mcp__mysql__<tool>. Once you know the tool names, deny the ones you won’t use and set the rest to ask in .claude/settings.json.
Limit it in Codex
Codex reads MCP servers from ~/.codex/config.toml. disabled_tools removes tools, and enabled_tools keeps only the ones you list:
[mcp_servers.mysql]
command = "npx"
args = ["-y", "@benborla29/mcp-server-mysql"]
env_vars = ["MYSQL_HOST", "MYSQL_PORT", "MYSQL_USER", "MYSQL_PASS", "MYSQL_DB"]Checklist
- Create a MySQL user with SELECT only on the schemas you need, and do not use root.
- Leave every ALLOW_ flag unset, or set per-schema permissions that keep production false.
- Point it at a replica or a copy of the data where you can.
- Turn on MYSQL_SSL for any non-local host.
- Turn on ENABLE_PII_REDACTION if tables hold personal data.
Checked against the vendor documentation on November 25, 2026. mcp-server-mysql README · mcp-server-mysql configuration
What Excellent covers
Excellent doesn’t inspect MCP servers themselves. Its free scan reads supported logs on the Mac (Claude Code, Codex, Grok Build, GitHub Copilot CLI, Gemini CLI and Qwen Code) and reports findings for review, so you can see what an agent did after a session. Run the free scan · See a sample report · How to vet any MCP server
Excellent Pro adds checks before supported actions. Claude Code can display an ask prompt. With Codex, an Excellent “ask” refuses the action and tells the agent to ask you. Pro is US-only for now. Agent coverage · Pricing