Multi-MySQL MCP Server
Supports connecting to Google Cloud SQL for MySQL with SSL/TLS support.
Provides tools for querying and managing MariaDB databases, including SQL queries with read-only enforcement, table listing, schema listing, health checks, and EXPLAIN analysis.
Provides tools for querying and managing MySQL databases, including SQL queries with read-only enforcement, table listing, schema listing, health checks, and EXPLAIN analysis.
Supports connecting to PlanetScale MySQL-compatible databases with SSL/TLS support.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Multi-MySQL MCP Serverlist tables in the local database with row counts"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Multi-MySQL MCP Server
English
A Model Context Protocol (MCP) server for MySQL and MariaDB — designed for AI coding assistants like Claude Code, Cursor, Windsurf, GitHub Copilot, and any MCP-compatible client.
One server, many databases. Connect multiple MySQL and MariaDB databases through a single MCP server with built-in SQL injection protection, read-only mode, connection pooling, and hot-reload configuration.
Why Use This?
AI-native database access — let Claude, Cursor, or Copilot query your MySQL databases directly
Multi-database — manage all your MySQL connections from one MCP server
Secure by default — state-machine SQL injection parser, read-only transactions, prepared statements
Hot-reload config — change connections without restarting the server
Per-project isolation — use
--labelto expose only relevant databases7 powerful tools — query, describe, explain, health check and more
Broad compatibility — MySQL 5.7–9.x, MariaDB 10.x–11.x, AWS RDS, Azure, GCP, PlanetScale
Tools
Tool | Description |
| List all configured database connections with status |
| Execute SQL queries with read-only enforcement and SQL injection protection |
| List tables with row counts, storage engine (InnoDB, MyISAM), and data size |
| Show columns, types, indexes, primary keys, foreign keys, and constraints |
| List all databases/schemas available on the MySQL server |
| Test connectivity, MySQL version, and response latency |
| Run EXPLAIN ANALYZE with automatic ROLLBACK for safety |
Quick Start
Install
git clone https://github.com/VKirill/multi-mysql-mcp-server.git
cd multi-mysql-mcp-server
npm install
npm run buildConfigure
Create ~/.mcp-mysql/config.json (or use --config to specify a custom path):
{
"connections": [
{
"label": "local",
"host": "localhost",
"port": 3306,
"user": "dev",
"password": "devpass123",
"database": "myapp"
},
{
"label": "production",
"url": "mysql://${PROD_USER}:${PROD_PASS}@db.example.com:3306/prod_db",
"readOnly": true,
"ssl": true
}
]
}Add to Claude Code
claude mcp add mysql -- node /path/to/dist/index.js --config ~/.mcp-mysql/config.jsonOr add to ~/.claude.json:
{
"mcpServers": {
"mysql": {
"type": "stdio",
"command": "node",
"args": ["/path/to/dist/index.js", "--config", "/path/to/config.json"]
}
}
}Add to Cursor
Add to .cursor/mcp.json:
{
"mcpServers": {
"mysql": {
"command": "node",
"args": ["/path/to/dist/index.js", "--config", "/path/to/config.json"]
}
}
}Docker
docker build -t mcp-mysql .
docker run -v /path/to/config.json:/app/config.json mcp-mysql --config /app/config.jsonConfiguration
Connection Fields
Field | Type | Required | Default | Description |
| string | Yes | — | Unique identifier for the database |
| string | * | — | MySQL server hostname |
| number | No | 3306 | MySQL server port |
| string | * | — | Database username |
| string | No |
| Database password |
| string | * | — | Default database/schema name |
| string | * | — | MySQL connection URL (alternative to host/user/database) |
| bool/object | No | — | Enable SSL/TLS (supports AWS RDS, Azure, GCP Cloud SQL) |
| boolean | No |
| Enforce read-only transactions |
| boolean | No |
| Enable/disable this connection |
| number | No |
| Maximum pool connections (1–100) |
* Either url or host + user + database is required.
Environment Variables in Config
Use ${VAR} or ${VAR:-default} syntax in any config string value:
{
"host": "${MYSQL_HOST:-localhost}",
"user": "${MYSQL_USER}",
"password": "${MYSQL_PASSWORD}"
}CLI Options
Option | Description |
| Path to config file (default: |
| Restrict server to a single database (per-project isolation) |
Environment variable: MCP_MYSQL_CONFIG — alternative config file path.
Security
SQL injection protection — state-machine parser detects multi-statement queries, handles MySQL-specific syntax (backtick identifiers,
#comments, backslash escapes)DDL protection — blocks CREATE, DROP, ALTER, TRUNCATE statements
Prepared statements — all user parameters go through
connection.execute()with?placeholdersRead-only by default —
SET SESSION TRANSACTION READ ONLYwraps all queries in transactionsEXPLAIN safety — EXPLAIN ANALYZE always wrapped in transaction with ROLLBACK
Config permissions — warns if config file is world-readable on Unix
Zod validation — config file validated with strict schemas
See SECURITY.md for the full security model and responsible disclosure policy.
Compatibility
MySQL 5.7, 8.0, 8.4, 9.x
MariaDB 10.x, 11.x
Cloud: AWS RDS, Azure Database for MySQL, Google Cloud SQL, PlanetScale, Aiven
Node.js >= 18
MCP clients: Claude Code, Cursor, Windsurf, GitHub Copilot, VS Code, any MCP-compatible tool
Related Projects
multi-postgres-mcp-server — Same architecture for PostgreSQL
Related MCP server: MySQL MCP Server
Русский
MCP-сервер для MySQL и MariaDB — предназначен для AI-ассистентов: Claude Code, Cursor, Windsurf, GitHub Copilot и любых MCP-совместимых клиентов.
Один сервер — много баз данных. Подключайте несколько MySQL и MariaDB баз через один MCP-сервер со встроенной защитой от SQL-инъекций, режимом read-only, пулом соединений и горячей перезагрузкой конфигурации.
Преимущества
AI-нативный доступ к БД — Claude, Cursor или Copilot напрямую запрашивают ваши MySQL базы
Мульти-база — все MySQL-подключения в одном MCP-сервере
Безопасность по умолчанию — state-machine парсер SQL-инъекций, read-only транзакции, prepared statements
Горячая перезагрузка — меняйте подключения без перезапуска сервера
Изоляция по проектам —
--labelпоказывает только нужные базы7 инструментов — запросы, описание таблиц, EXPLAIN, health check и др.
Широкая совместимость — MySQL 5.7–9.x, MariaDB 10.x–11.x, AWS RDS, Azure, GCP, PlanetScale
Инструменты
Инструмент | Описание |
| Список всех настроенных подключений к БД |
| Выполнение SQL-запросов с read-only и защитой от инъекций |
| Список таблиц: кол-во строк, движок (InnoDB, MyISAM), размер |
| Колонки, типы, индексы, первичные и внешние ключи, ограничения |
| Список всех баз данных/схем на сервере MySQL |
| Проверка соединения, версия MySQL, задержка |
| EXPLAIN ANALYZE с автоматическим ROLLBACK |
Быстрый старт
git clone https://github.com/VKirill/multi-mysql-mcp-server.git
cd multi-mysql-mcp-server
npm install
npm run buildСоздайте ~/.mcp-mysql/config.json:
{
"connections": [
{
"label": "local",
"host": "localhost",
"port": 3306,
"user": "dev",
"password": "devpass123",
"database": "myapp"
}
]
}Добавьте в Claude Code (~/.claude.json):
{
"mcpServers": {
"mysql": {
"type": "stdio",
"command": "node",
"args": ["путь/до/dist/index.js", "--config", "путь/до/config.json"]
}
}
}Безопасность
Защита от SQL-инъекций — state-machine парсер обрабатывает backtick-идентификаторы,
#комментарии,\экранированиеЗащита от DDL — блокирует CREATE, DROP, ALTER, TRUNCATE
Prepared statements — параметры через
connection.execute()с?плейсхолдерамиRead-only по умолчанию —
SET SESSION TRANSACTION READ ONLYEXPLAIN — всегда в транзакции с ROLLBACK
Валидация конфига — Zod-схемы
Совместимость
MySQL 5.7, 8.0, 8.4, 9.x | MariaDB 10.x, 11.x
AWS RDS, Azure Database for MySQL, Google Cloud SQL, PlanetScale, Aiven
Node.js >= 18
Claude Code, Cursor, Windsurf, GitHub Copilot, VS Code
中文
MySQL 和 MariaDB 的 MCP 服务器 — 专为 AI 编码助手设计:Claude Code、Cursor、Windsurf、GitHub Copilot 以及任何 MCP 兼容客户端。
一个服务器,多个数据库。 通过单个 MCP 服务器连接多个 MySQL 和 MariaDB 数据库,内置 SQL 注入防护、只读模式、连接池和热重载配置。
优势
AI 原生数据库访问 — 让 Claude、Cursor 或 Copilot 直接查询你的 MySQL 数据库
多数据库 — 在一个 MCP 服务器中管理所有 MySQL 连接
默认安全 — 状态机 SQL 注入解析器、只读事务、预处理语句
热重载配置 — 更改连接无需重启服务器
项目隔离 — 使用
--label仅暴露相关数据库7 个工具 — 查询、表描述、EXPLAIN、健康检查等
广泛兼容 — MySQL 5.7–9.x、MariaDB 10.x–11.x、AWS RDS、Azure、GCP、PlanetScale
工具列表
工具 | 说明 |
| 列出所有已配置的数据库连接及状态 |
| 执行 SQL 查询,强制只读模式并防止 SQL 注入 |
| 列出表:行数、存储引擎(InnoDB、MyISAM)、数据大小 |
| 显示列、类型、索引、主键、外键和约束 |
| 列出 MySQL 服务器上所有数据库/模式 |
| 测试连接、MySQL 版本和响应延迟 |
| 执行 EXPLAIN ANALYZE 并自动 ROLLBACK |
快速开始
git clone https://github.com/VKirill/multi-mysql-mcp-server.git
cd multi-mysql-mcp-server
npm install
npm run build创建 ~/.mcp-mysql/config.json:
{
"connections": [
{
"label": "local",
"host": "localhost",
"port": 3306,
"user": "dev",
"password": "devpass123",
"database": "myapp"
}
]
}添加到 Claude Code 配置(~/.claude.json):
{
"mcpServers": {
"mysql": {
"type": "stdio",
"command": "node",
"args": ["dist/index.js的路径", "--config", "config.json的路径"]
}
}
}安全性
SQL 注入防护 — 状态机解析器处理反引号标识符、
#注释、\转义DDL 防护 — 阻止 CREATE、DROP、ALTER、TRUNCATE 语句
预处理语句 — 通过
connection.execute()使用?占位符默认只读 —
SET SESSION TRANSACTION READ ONLYEXPLAIN 安全 — 始终在事务中执行并 ROLLBACK
配置验证 — Zod 模式验证
兼容性
MySQL 5.7、8.0、8.4、9.x | MariaDB 10.x、11.x
AWS RDS、Azure Database for MySQL、Google Cloud SQL、PlanetScale、Aiven
Node.js >= 18
Claude Code、Cursor、Windsurf、GitHub Copilot、VS Code
Contributing
See CONTRIBUTING.md for development setup and guidelines.
License
MIT — see LICENSE for details.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/VKirill/multi-mysql-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server