Repository navigation
MySQL Shell
Value Proposition Enhance AI agents with parallel imports and full instance dumps. Establish robust administrative boundaries and securely orchestrate complex database scripts with native MySQL Shell integration. Gain continuous insights with robust metrics and real-time observability. Read the full value proposition.
- MySQL Shell binary accessible (in PATH or via environment variable)
- Version Compatibility: MySQL Shell version should match your MySQL Server version.
Empower your AI agents to seamlessly orchestrate complex database migrations, execute high-speed parallel imports, and securely manage comprehensive instance dumps. The server provides robust, enterprise-grade tools for MySQL Shell management. Leverage the native MCP discovery mechanism or use the mysql_tool_index prompt to dump the complete tool catalog and identify the available tools within your context. MySQL Shell tools are conditionally loaded only when the mysqlsh binary is locally accessible. (Note: MySQL Router tools operate via its REST API and do not require a local binary).
Prominent Examples:
-
mysqlsh_version: Get MySQL Shell version and installation status. -
mysqlsh_dump_instance: Dump entire MySQL instance. -
mysqlsh_load_dump: Load MySQL Shell dump.
Tip
Use the mysql_setup_shell prompt to securely configure and test MySQL Shell integrations. Note: The mysqlsh binary must be explicitly available in your system PATH for the prompt and integration to function correctly.
| Tool | Requirements |
|---|---|
mysqlsh_import_json |
Requires X Protocol (typically port 33060) for collection imports. NDJSON format only |
mysqlsh_import_table |
Requires target tables to have a PRIMARY KEY when importing to InnoDB Cluster |
mysqlsh_load_dump / mysqlsh_import_table
|
Requires local_infile=ON in MySQL Server config. Use SET GLOBAL local_infile = 1; or configure it in my.cnf. |
mysqlsh_check_upgrade |
User needs RELOAD, PROCESS, SELECT privileges |
mysqlsh_dump_* / mysqlsh_load_dump
|
Shell version should match server version |
mysqlsh_* |
Operates under standard execution boundaries. When OAuth is enabled, the shell tools require the admin scope. |
Ensure execution of database migrations by verifying your environment against these operational baselines:
mysqlsh --version
# Expected: mysqlsh Ver <version> for ...SET GLOBAL local_infile = 1;Or add to my.cnf:
[mysqld]
local_infile=ONmysqlsh --uri root@localhost:33060 --sql -e "SELECT 1"| Variable | Default | Description |
|---|---|---|
MYSQLSH_PATH |
mysqlsh |
Path to MySQL Shell binary |
MYSQLSH_HOST |
localhost |
Default MySQL Shell host |
MYSQLSH_XPORT |
33060 |
X Protocol port for MySQL Shell |
MYSQLSH_DOCKER_CONTAINER |
- |
Docker container name if running shell in container |
MYSQLSH_WORK_DIR |
- |
Working directory for dump/load operations |
MYSQLSH_TIMEOUT |
300000 |
Command timeout in milliseconds (5 min) |
Warning
MySQL Shell commands execute as subprocesses. Ensure proper file permissions. Note: --allowed-io-roots enforces filesystem boundaries at the MCP protocol level, which is completely distinct from the secure V8 code execution sandboxing utilized by the codemode tools.
Furthermore, while MYSQLSH_TIMEOUT defaults to 5 minutes, this is only fully realizable over the stdio transport. When using the http transport, long-running shell commands will be subject to the server's configured HTTP connection timeout limit.
{
"mcpServers": {
"mysql-mcp": {
"command": "npx",
"args": [
"-y",
"@neverinfamous/mysql-mcp",
"--transport",
"stdio",
"--mysql",
"mysql://user:password@localhost:3306/database",
"--allowed-io-roots",
"/data"
],
"env": {
"MYSQLSH_PATH": "mysqlsh"
}
}
}
}Note
Global install users can replace "command": "npx" with "command": "mysql-mcp" and remove the npx-related arguments ("-y", "@neverinfamous/mysql-mcp") from the "args" array.
For environments requiring workload isolation:
{
"mcpServers": {
"mysql-mcp": {
"command": "npx",
"args": [
"-y",
"@neverinfamous/mysql-mcp",
"--transport",
"stdio",
"--mysql",
"mysql://user:password@localhost:3306/database",
"--allowed-io-roots",
"/data",
"--tool-filter",
"shell,-codemode"
],
"env": {}
}
}
}This exposes only the MySQL Shell management tools.
Note
OAuth requires the http transport. Desktop clients (such as Claude Desktop and Cursor) using mcp.json and stdio cannot natively use OAuth. See Authorization & Identity Management for details.
The MCP server automatically validates all tool parameters before execution using Zod for robust schema validation (via .safeParse() and z.infer) and safe parsing best practices. This ensures reliable operations and prevents invalid arguments from reaching MySQL Shell by gracefully rejecting hallucinated payloads.
- Tools - Curated overview of available tools
- Tool Filtering - Custom tool filtering
- Configuration - General configuration
- OAuth - Authorization & Identity Management
Unlock autonomous database orchestration with an enterprise-grade MySQL MCP server. Featuring blazing-fast sandboxed Code Mode, uncompromising schema enforcement, and seamless ecosystem integrations to power secure, intelligent AI workflows.
- Installation
- Configuration
- Architecture
- HTTP Transport
- Tool Filtering
- Code Mode
- Tools
- Prompts
- Resources
- Observability & Telemetry