-
Notifications
You must be signed in to change notification settings - Fork 2
MySQL Shell
Value Proposition Seamlessly orchestrate parallel imports, comprehensive instance dumps, and robust script execution at enterprise scale. 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
Warning
Version Mismatch: Ensure your Shell version matches your server version.
Includes, but is not limited to:
| Tool | Description | Parameters |
|---|---|---|
mysqlsh_version |
Get MySQL Shell version and installation status | - |
mysqlsh_check_upgrade |
Check server upgrade compatibility | targetVersion |
mysqlsh_export_table |
Export table to file (CSV, TSV) |
schema, table, file
|
mysqlsh_import_table |
Parallel table import from file. |
file, schema, table, updateServerSettings
|
mysqlsh_import_json |
Import JSON documents to collection or table |
file, schema, collection
|
mysqlsh_dump_instance |
Dump entire MySQL instance | outputDir |
mysqlsh_dump_schemas |
Dump selected schemas. ddlOnly dumps only DDL |
schemas, outputDir, ddlOnly
|
mysqlsh_dump_tables |
Dump specific tables. all controls trigger inclusion |
schema, tables, outputDir, all
|
mysqlsh_load_dump |
Load MySQL Shell dump. |
dumpDir, updateServerSettings
|
mysqlsh_run_script |
Execute JS/Python/SQL script via MySQL Shell |
code, language
|
| 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 updateServerSettings to auto-enable it. |
mysqlsh_check_upgrade |
User needs RELOAD, PROCESS, SELECT privileges |
mysqlsh_dump_* / mysqlsh_load_dump
|
Shell version should match server version |
mysqlsh_run_script |
Operates under standard execution boundaries but explicitly requires the OAuth admin scope |
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_WORK_DIR |
Current directory | Working directory for dump/load operations |
MYSQLSH_TIMEOUT |
300000 |
Command timeout in milliseconds (5 min) |
MYSQL_XPORT |
33060 |
X Protocol port (for mysqlsh_import_json) |
Warning
If your shell operations are expected to exceed the default HTTP request timeout, increase MCP_REQUEST_TIMEOUT to prevent dropped connections. This applies specifically when using HTTP/SSE clients, not standard stdio. When running heavy HTTP migrations, explicitly align MCP_REQUEST_TIMEOUT with MYSQLSH_TIMEOUT.
[!WARNING]
MySQL Shell commands execute as subprocesses. Ensure proper file permissions. Configure --allowed-io-roots to permit sandbox access.
{
"mcpServers": {
"mysql-mcp": {
"command": "npx",
"args": [
"-y",
"@neverinfamous/mysql-mcp",
"--transport", "stdio",
"--mysql", "mysql://user:password@localhost:3306/database",
"--allowed-io-roots", "C:/temp",
"--allowed-io-roots", "/tmp"
],
"env": {
"MYSQLSH_PATH": "mysqlsh"
}
}
}
}If you only want MySQL Shell tools (e.g., for a dedicated migration agent):
{
"args": [
"--transport", "stdio",
"--tool-filter", "shell"
]
}- Tools - Complete tool list
- Tool Filtering - Custom tool filtering
- Configuration - MCP client configuration
The mysqlsh_* tools use Zod for robust input validation. You can use Zod's native .safeParse() method to safely handle unexpected parameters, or integrate using the Standard Schema specification via the ~standard interface for broader interoperability. Semantic validation still depends on the database engine.
Value Proposition Enforce strict execution boundaries and maximize LLM context efficiency for secure, autonomous database interactions. Read the full value proposition
- Installation
- Configuration
- Architecture
- HTTP Transport
- Tool Filtering
- Code Mode
- Tools
- Prompts
- Resources
- Observability & Telemetry