mcp-mysql-client
Connect to one MySQL/MariaDB database and, by default, inspect and query it read-only; limited writes are opt-in, and DDL is never allowed.
Show connection and permission details: database, user, MySQL version, GRANTs, and MCP server limits.
List tables/views with engine, charset, comments, sizes, and estimated row counts.
Describe a table: columns, indexes, and foreign keys in both directions.
Run one read-only SQL query (SELECT, SHOW, DESCRIBE, WITH ... SELECT) with parameter binding; results are capped by MYSQL_MAX_ROWS and marked truncated.
Explain a read query plan, optionally running EXPLAIN ANALYZE.
Execute one INSERT/UPDATE/DELETE/REPLACE only if the corresponding ALLOW_* environment variable is enabled; returned as affected-row count, with no rollback.
Require allow_full_table=true for UPDATE or DELETE without WHERE/LIMIT.
Never allow DDL, database changes, SET/CALL/PREPARE/LOAD DATA/locks/GRANT, SELECT INTO OUTFILE, or multiple statements.
Write permissions are configured outside the dialog and require a server restart.
Provides tools for interacting with a MariaDB database, including listing tables, describing table structure, running SELECT queries, explaining query execution plans, and optionally executing write operations when explicitly enabled.
Provides tools for interacting with a MySQL database, including listing tables, describing table structure, running SELECT queries, explaining query execution plans, and optionally executing write operations when explicitly enabled.
Click on "Deploy 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., "@mcp-mysql-client What tables exist in the database and how are they structured?"
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.
MySQL MCP
MySQL MCP connects an AI application to a single MySQL or MariaDB database: view the schema, ask questions about the data in natural language, find out why a query is slow, and — if you have explicitly allowed it — change the data.
The server is bound to one database: the database is set through the configuration, and no tool can escape into any other. By default, only read access is available.
6 tools. Connection and permissions, list tables, table structure, read query, query plan, modifying query.
The server determines the request type. SQL is parsed before connecting:
DELETEin the read tool is rejected even if write permissions are enabled.Reads cannot write. Read queries run inside
START TRANSACTION READ ONLY— MySQL itself rejects the write even if the SQL parser is tricked.The response will not overflow the context. Rows are read as a stream and are cut off at the limit instead of being loaded entirely; the response carries an honest
truncatedmarker.Permissions are only granted from outside. INSERT, UPDATE, and DELETE are switched on by environment variables and require a restart — they cannot be granted from a chat. DDL is always unavailable.
Start with a query that only reads data:
Show me the database schema and count how many records were added in the last week.
Quick start
Claude Code:
claude mcp add mysql-myapp \
-e MYSQL_HOST=db.example.com \
-e MYSQL_USER=myapp_ro \
-e MYSQL_PASS='пароль' \
-e MYSQL_DB=myapp \
-e MYSQL_SSL=true \
-- npx -y mcp-mysql-clientOr in .mcp.json / claude_desktop_config.json:
{
"mcpServers": {
"mysql-myapp": {
"command": "npx",
"args": ["-y", "mcp-mysql-client"],
"env": {
"MYSQL_HOST": "db.example.com",
"MYSQL_PORT": "3306",
"MYSQL_USER": "myapp_ro",
"MYSQL_PASS": "пароль",
"MYSQL_DB": "myapp",
"MYSQL_SSL": "true"
}
}
}
}One server — one database. Need several databases? Add several entries with their own credentials: this keeps permissions isolated, and a server connected to the test database physically cannot see the production one.
Related MCP server: mysql-mcp
What can you assign
Request | What the server does |
"What is there at all in this database?" |
|
"How is the orders table structured?" |
|
"How many orders were placed in July, and for how much?" |
|
"Why is this query slow?" |
|
"Who am I connected as and what am I allowed to do?" |
|
"Set the status of the canceled orders." |
|
What can change
By default, nothing: the server starts in read-only mode. Writing is enabled per operation:
"ALLOW_INSERT_OPERATION": "true",
"ALLOW_UPDATE_OPERATION": "true",
"ALLOW_DELETE_OPERATION": "false"What remains impossible:
What | Why |
DDL |
|
Switching databases, | Changes the meaning of the next query or executes untrusted text. |
| Writing a file on the database server. |
| Requires explicit |
Multiple statements in one call | Executes exactly one. |
MySQL privileges are a separate restriction on top of the above. The ALLOW_UPDATE_OPERATION permission does not give anything to a user without a GRANT UPDATE. Best practice: a dedicated user with minimal privileges, not root.
Environment variables
Variable | Default | Purpose |
|
| Database server host |
|
| Port |
| — | Unix socket instead of host/port |
| — | User (required) |
| — | Password (alias of |
| — | Read the password from a file instead of a variable |
| — | Database (required, alias of |
|
| Require TLS |
| — | Path to the root certificate; it alone enables TLS |
|
| Verify the server certificate |
|
| Allow INSERT |
|
| Allow UPDATE |
|
| Allow DELETE |
|
| Maximum rows in one response |
|
| Query timeout |
|
| Connection timeout |
|
| Connections in the pool |
|
| Retries on connection loss or deadlocks |
|
| Run reads in a read-only transaction |
| — |
|
The password is present in the MCP client config in plain text. MYSQL_PASS_FILE lets you keep it in a file with the required permissions.
Migration from @benborla29/mcp-server-mysql
The variable names are the same, so just replace the package in the launch command:
- "args": ["-y", "@benborla29/mcp-server-mysql"]
+ "args": ["-y", "mcp-mysql-client"]What will change in behavior:
Behavior | Change |
| The server is always bound to one database. |
Responses are limited by | Answers are marked as |
DDL is unavailable | Even if write permissions are enabled. |
| They require explicit confirmation in the call. |
The toolset is different |
|
Diagnostics
First, call server_info: it shows where the server has connected, what permissions the MySQL user has, and which limits are enabled.
Symptom | Cause |
| Invalid |
| The user exists, but has no access to the database. |
| Missing |
| The server requires TLS: set |
| Host, port, firewall, or a VPN that isn’t up. |
| TLS is required for |
Server doesn’t connect | The configuration error is visible directly in the dialog: the server starts without credentials and explains what is missing. |
Technical documentation
Tools — parameters and responses
Development — building, tests, live verification
Publishing — releases in npm and the MCP registry
CLAUDE.md — repository layout for AI agents
License
Available Tools
6 toolsdescribe_tableСтруктура таблицыARead-onlyIdempotent
Показывает структуру таблицы: столбцы с типами, обнуляемостью, значениями по умолчанию и комментариями, индексы с их составом, внешние ключи наружу и, главное, ссылки на эту таблицу из других (referenced_by) — именно они определяют, безопасно ли удалять строки. Разделы, кроме столбцов, можно отключить, если нужен только их список.
Inputs: table (required), include_indexes, include_foreign_keys.
executeВыполнить изменяющий SQL-запросADestructive
Выполняет один изменяющий запрос — INSERT, UPDATE, DELETE или REPLACE — и возвращает число затронутых строк. Сейчас сервер разрешает: только чтение. Права выдаются переменными ALLOW_INSERT_OPERATION, ALLOW_UPDATE_OPERATION и ALLOW_DELETE_OPERATION в конфигурации MCP-клиента и требуют перезапуска сервера — из диалога их получить нельзя. DDL (CREATE, ALTER, DROP, TRUNCATE) не поддерживается ни при каких настройках. Запрос выполняется сразу и без транзакции: откатить его отсюда нельзя. UPDATE и DELETE без WHERE и LIMIT требуют явного allow_full_table=true.
Inputs: sql (required), params, allow_full_table.
explainПоказать план выполнения запросаARead-onlyIdempotent
Возвращает план выполнения читающего запроса: какие индексы будут использованы и сколько строк сервер рассчитывает просмотреть. Обычный режим ничего не выполняет; analyze=true запускает запрос по-настоящему и показывает фактическое время — на больших таблицах это дорого. Полезно перед тяжёлой выборкой и при диагностике медленных запросов.
Inputs: sql (required), format, params, analyze.
list_tablesСписок таблиц базыARead-onlyIdempotent
Перечисляет таблицы и представления подключённой базы: движок, кодировку, комментарий, размер данных и индексов в байтах и оценку числа строк. Оценка берётся из статистики InnoDB и может заметно расходиться с реальностью — точное число даёт COUNT(*) через query. С этого инструмента стоит начинать знакомство с незнакомой базой.
Inputs: no named parameters.
queryВыполнить читающий SQL-запросARead-onlyIdempotent
Выполняет один читающий запрос (SELECT, SHOW, DESCRIBE, WITH ... SELECT) и возвращает строки. Изменяющие запросы отклоняются даже при включённых правах на запись — для них есть execute. Запрос идёт внутри read-only транзакции, число строк ограничено MYSQL_MAX_ROWS: если ответ обрезан, поле truncated равно true и это префикс, а не весь результат. Значения подставляйте через ? и params — драйвер экранирует их сам.
Inputs: sql (required), limit, params.
server_infoСведения о подключении и правахARead-onlyIdempotent
Показывает, к какой базе и под каким пользователем подключён сервер, версию MySQL, размер базы, выданные пользователю права (GRANT) и действующие ограничения самого MCP-сервера: разрешённые операции записи, потолок строк в ответе и таймаут запроса. Стоит вызвать первым, если непонятно, почему запрос отклонён: права MySQL и разрешения сервера — это два независимых ограничения.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool has a clearly distinct purpose: server_info covers connection state, list_tables and describe_table cover schema discovery, query executes read-only SQL, explain returns execution plans, and execute handles mutations. The only mild overlap is between query and explain, but their outputs and use cases are sufficiently different that an agent should not select the wrong one.
The tool names are all lowercase and readable, but they do not follow one consistent pattern: list_tables and describe_table use verb_noun, explain and execute are bare verbs, while server_info and query are noun-style names. This is a mixed convention rather than a chaotic one, but it still falls short of a uniform naming scheme.
Six tools is a well-scoped set for a MySQL client server. Each tool covers a distinct part of the interaction surface: server diagnostics, table enumeration, schema inspection, read queries, query planning, and write execution, so none feel redundant or missing.
The tool set covers the full expected workflow for a MySQL client: understand the environment, discover tables, inspect schema, run read queries, analyze plans, and perform DML writes. DDL and transactions are explicitly excluded by design, so their absence is not an unexpected gap within the server's declared scope.
Maintenance
Related MCP Connectors
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
Guard AI agents' PostgreSQL/MySQL access via MCP: SQL audit, auth, masking, write approval
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Hosted SQL Server MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI agents to safely interact with MySQL/MariaDB databases, supporting read-only queries by default with optional write operations and access control.8MIT
- AlicenseAqualityDmaintenanceEnables AI agents to query and manage MySQL databases through a structured MCP interface, supporting SQL execution, table inspection, and database operations.911 npmMIT
- AlicenseAqualityDmaintenanceEnables AI agents to explore MySQL database schemas and execute read-only queries through a safe, MCP interface.6ISC
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to query and modify MySQL and MariaDB databases over MCP, with each connection independently permitting selects, inserts, updates, deletes, and DDL while defaulting to read-only and rejecting anything outside the allowed operations. Connections are configured in JSON, result sets are capped and truncated, and passwords stay server-side.MIT