mcp-mysql-client
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 "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., "@mcp-mysql-clientWhat 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 Server
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
Maintenance
Related MCP Servers
- FlicenseNot gradedqualityBmaintenanceAn MCP server that enables AI agents to safely explore and interact with MySQL databases through dynamic tool generation from stored procedures. It provides database discovery capabilities and intelligent procedure categorization while enforcing security restrictions to prevent data modification.
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to safely interact with MySQL/MariaDB databases, supporting read-only queries by default with optional write operations and access control.MIT
- AlicenseAqualityDmaintenanceEnables AI agents to query and manage MySQL databases through a structured MCP interface, supporting SQL execution, table inspection, and database operations.914MIT
- AlicenseNot gradedqualityDmaintenanceA robust MCP server for interacting with MySQL databases through AI agents, providing tools for schema analysis, query execution, and dynamic connection management with read-only security.61MIT
Related MCP Connectors
Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.
Security firewall for AI agents — scans MCP calls for injection, secrets, and risks.
Shared, governed long-term memory for AI agents across tools and sessions via MCP and REST.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- 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/gistrec/mcp-mysql-client'
If you have feedback or need assistance with the MCP directory API, please join our Discord server