Provides tools to interact with MySQL databases, allowing for querying data, executing updates, listing databases and tables, and inspecting schema structures with support for SSL and read-only modes.
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., "@MySQL MCP Servershow me the schema for all tables"
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.
@imrieul/mysql-mcp-server
한국어 | 日本語 | 中文 | Español | Português | Français | Русский
A simple MySQL MCP server.
Features
LLM-friendly — compact column/row format, auto LIMIT, error hints with next-action suggestions
Bulk schema —
describe_all_tablesreturns entire DB schema in one callRead-only mode — app-level prefix check + DB-level
SET SESSION TRANSACTION READ ONLYQuery timeout —
Promise.race()based timeout with guaranteed connection cleanupSSL support — one env var to enable encrypted connections
Minimal — 3 dependencies, zero config required
Quick Start
Add to your MCP config (.mcp.json or claude_desktop_config.json):
{
"mcpServers": {
"mysql": {
"command": "npx",
"args": ["-y", "@imrieul/mysql-mcp-server"],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "root",
"MYSQL_PASSWORD": "your-password",
"MYSQL_DATABASE": "your-database"
}
}
}
}Or with a connection string:
{
"mcpServers": {
"mysql": {
"command": "npx",
"args": ["-y", "@imrieul/mysql-mcp-server", "mysql://root:password@localhost:3306/mydb"]
}
}
}Read-only mode with SSL
{
"mcpServers": {
"mysql": {
"command": "npx",
"args": ["-y", "@imrieul/mysql-mcp-server", "--readonly"],
"env": {
"MYSQL_HOST": "db.example.com",
"MYSQL_USER": "readonly_user",
"MYSQL_PASSWORD": "password",
"MYSQL_DATABASE": "production",
"MYSQL_SSL": "true",
"MYSQL_QUERY_TIMEOUT": "10000"
}
}
}
}Tools
Tool | Description | Read-only mode |
| Execute SELECT, SHOW, DESCRIBE, EXPLAIN | Allowed |
| Execute INSERT, UPDATE, DELETE, DDL | Blocked |
| List all databases | Allowed |
| List tables in a database | Allowed |
| Show table schema | Allowed |
| Show all table schemas at once | Allowed |
Configuration
Environment variables
Variable | Required | Default | Description |
| Yes | — | MySQL host |
| Yes | — | MySQL user |
| Yes | — | MySQL password |
| No |
| MySQL port |
| No | — | Default database |
| No |
| Read-only mode |
| No |
| Auto LIMIT for SELECT queries |
| No |
| Query timeout in ms (0 to disable) |
| No |
| Enable SSL connection |
Connection string
mysql://user:password@host:port/databasePassed as the first CLI argument. Takes priority over environment variables.
License
MIT