
MySQL
โ 1,900from benborla
Access MySQL databases to inspect schemas and execute SQL queries via a NodeJS-based server.
MCP Server for MySQL
Sponsor โ Bloome
Using mcp-server-mysql to let your AI query MySQL? Bloome brings that to your whole team โ an AI-agent IM platform where AI agents are members of the chat. Connect your MCP tools and have agents inspect schemas, run queries, and answer data questions for everyone in one thread. Zero local setup, runs in the cloud, on web and mobile.
MCP server that gives Claude and other LLMs access to MySQL โ inspect schemas, run queries, and optionally write data, all through the Model Context Protocol.
Key Features
-
Read-only by default โ write operations opt-in via env flags
-
Claude Code integration โ optimized for Anthropic's Claude Code CLI
-
SSH tunnel support โ built-in support for remote databases
-
Multi-DB mode โ query across multiple databases without reconnecting
-
Schema-specific permissions โ per-database read/write control
-
PII redaction โ automatic masking of sensitive data in results
-
Remote mode โ HTTP transport with bearer token auth
-
SSL/TLS support โ encrypted connections with mTLS option
Documentation
-
Installation Guide โ Smithery, Cursor, Codex, Claude Code, local repo, remote mode
-
Configuration & Environment Variables โ all env vars, advanced config
-
Multi-DB Mode โ querying multiple databases
-
PII Redaction โ automatic data masking
-
Testing โ test setup and running
-
Troubleshooting โ common issues and fixes
Tools & Resources
Tool: mysql_query
Execute SQL queries. Read-only by default. Write operations enabled per flag.
Resources: mysql://tables
Lists all tables and column metadata for the connected database.
Contributing
PRs welcome at github.com/benborla/mcp-server-mysql.
git clone https://github.com/benborla/mcp-server-mysql.git
pnpm install
pnpm run build
pnpm test
License
MIT โ see LICENSE for details.
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-mysqlBefore it works, you'll need: MYSQL_HOSTMYSQL_PORTMYSQL_USERMYSQL_PASSMYSQL_DB
Requirements
-
Node.js v20+
-
MySQL 5.7+ (8.0+ recommended)
-
MySQL user with appropriate privileges
Quick Install
Claude Code (simplest):
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
Claude Desktop / other clients:
{
"mcpServers": {
"mcp_server_mysql": {
"command": "npx",
"args": ["-y", "@benborla29/mcp-server-mysql"],
"env": {
"MYSQL_HOST": "127.0.0.1",
"MYSQL_PORT": "3306",
"MYSQL_USER": "root",
"MYSQL_PASS": "your_password",
"MYSQL_DB": "your_database"
}
}
}
}
All write operations are disabled by default. Enable with ALLOW_INSERT_OPERATION=true, ALLOW_UPDATE_OPERATION=true, ALLOW_DELETE_OPERATION=true.
No common issues documented yet. If you hit a problem, the repository's GitHub Issues page is the best place to look.