MCP Server for MySQL 🔌 MCP server Open source
Read-only-by-default MySQL access with opt-in writes, SSH tunnels and PII masking
- GitHub stars
- 2.1k
- Stars this week
- +1
- Forks
- 253
- Licence
- MIT
- Last push
- 2026-07-27
- Maintainer
- benborla
claude mcp add mcp_server_mysql -e MYSQL_HOST="127.0.0.1" -e MYSQL_PORT="3306" -e MYSQL_USER="root" -e MYSQL_PASS="your_password" -e MYSQL_DB="your_database" -- npx @benborla29/mcp-server-mysqlThird-party MCP servers run with your permissions. Read the source before installing, and prefer pinned versions.
Works with
Built on the open MCP standard, so it works in every app that supports MCP.
About MCP Server for MySQL
What it does
MCP Server for MySQL connects a coding agent to a MySQL database so it can read the schema and run SQL while it builds or debugs your app. A typical session has the agent inspect tables before writing a migration or model, check what data a failing endpoint actually returns, or explain a slow query. The server is read-only out of the box. Inserts, updates, deletes and DDL each have to be switched on separately, and you can set these permissions per schema, for example allowing writes on a development database but not on production. It can also reach remote databases through a built-in SSH tunnel, query several databases without reconnecting, and mask personal data in results. It is a community project, not an Oracle product.
Tools it gives your agent
mysql_queryruns SQL. Only reads are allowed unless you enable write flags- The
mysql://tablesresource lists tables and column metadata for the connected database
Works with
It runs locally over stdio through npx by default. An optional remote mode serves HTTP with bearer-token auth. The README targets Claude Code and Claude Desktop, and the installation guide also covers Cursor, Codex CLI and Smithery. Any MCP client will work.
How to connect
The Claude Code command from the README (replace the placeholder credentials with your own):
claude mcp add mcp_server_mysql \
-e MYSQL_HOST="127.0.0.1" \
-e MYSQL_PORT="3306" \
-e MYSQL_USER="root" \
-e MYSQL_PASS="your_password" \
-e MYSQL_DB="your_database" \
-- npx @benborla29/mcp-server-mysql
Cost and limits
It is free and MIT-licensed. It needs Node.js 20 or later and MySQL 5.7 or later, with 8.0 recommended. There is no hosted service, and the only costs come from your own database.
Safety notes
Keep the default read-only mode unless you need writes. Enable writes one at a time with ALLOW_INSERT_OPERATION, ALLOW_UPDATE_OPERATION and ALLOW_DELETE_OPERATION, or use per-schema permission maps. Connect as a dedicated MySQL user with minimal grants rather than root, even though the quick-start example uses it. The credentials sit in your MCP config as environment variables, so keep that file out of version control. ENABLE_PII_REDACTION masks sensitive columns in query results. If you use remote mode, set REMOTE_SECRET_KEY and put the server behind TLS.
Pros
- Read-only by default, with writes enabled per operation and per schema
- Built-in SSH tunnel, multi-database mode and optional PII redaction
Cons
- A single generic mysql_query tool, with no dedicated schema or explain tools
- Community project, not from Oracle or MySQL
Similar MCP servers
All database & backend MCP servers →Supabase MCP 🔌 MCP serverFreemium
Manage Supabase projects, databases, migrations and edge functions from your agent
Neon MCP 🔌 MCP serverFreemium
Neon's MCP server: manage serverless Postgres with natural language
🔥 Startups: up to $200K (VC-backed) in creditsMongoDB MCP Server 🔌 MCP serverFree
Official MongoDB and Atlas MCP server
🔥 MongoDB for Startups: tiered Atlas credits plus Voyage AI tokens for companies under 7 years old, Series A or earlierQdrant MCP Server 🔌 MCP serverOpen source
Official Qdrant server that gives agents a semantic memory: store and search text in a vector DB
🔥 Qdrant for Startups: 20% off Qdrant Cloud for 12 months (pre-seed/seed/Series A, under 5 years old, <$5M raised)OpenViking 🔌 MCP serverOpen source
Open-source context database giving agents shared memory, resources and skills