Get the FREE Ultimate OpenClaw Setup Guide →

mcp-mysql

MCP server from liucq200518/mcp-mysql-server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio liucq200518-mcp-mysql-server docker run -i liucq200518-mcp-mysql-server \
  --env CONFIG_PATH="Path to the config.json to load (optional, if needed by the image)"

How to use

This MCP server is a Rust-based solution that connects to multiple MySQL data sources and exposes rich MCP capabilities for clients such as Claude Desktop or IDE AI plugins. It supports multiple connections via a config.json, hot reload of configuration without restarting, and two transport modes: local stdio and remote HTTP/SSE. Once running, you can query the server for schema details, preview data, perform safe operations with transactional dry runs, and analyze query plans and relationships to improve data access and governance. Use the provided tools to explore database structures, retrieve table previews, check indexes and foreign keys, and generate schema diffs across environments. For standard workflows, start the server in your preferred mode, provide the config, and connect your MCP client through the appropriate transport endpoint.

How to install

Prerequisites:\n- Docker (recommended for the provided container approach) or a compatible runtime to execute the binary image.\n- A config.json file describing your MySQL connections.\n- Optional: port exposure if you intend to use the HTTP/SSE mode.\n\nInstallation steps (Docker):\n1) Ensure Docker is installed and running.\n2) Pull and run the MCP MySQL server image:\n docker pull liucq200518-mcp-mysql-server || true\n docker run -i --rm -v /path/to/config.json:/config.json -p 3000:3000 liucq200518-mcp-mysql-server --config /config.json\n\nNotes:\n- If the image expects a specific path to the config.json, bind mount the file and pass it via the --config flag as shown.\n- If you prefer to run the Rust binary locally, compile it with cargo build --release and start with the path to your config.\n\nConfiguration file (config.json) example:\n{\n "connections": {\n "local_test": {\n "host": "localhost",\n "port": 3306,\n "username": "root",\n "password": "password",\n "database": "test_db"\n },\n "prod_ref": {\n "host": "192.168.1.100",\n "port": 3306,\n "username": "readonly",\n "password": "secure",\n "database": "analytics"\n }\n }\n}\n

Additional notes

Tips and common scenarios:\n- The server automatically reloads config.json on changes without requiring a restart. Look for the log line: Config file changed, reloading...\n- Use dry_run_sql to safely preview UPDATE/DELETE statements; this runs within a transaction and rolls back to prevent real writes.\n- When using SSE mode, the MCP SSE endpoint is typically http://0.0.0.0:PORT/sse and messages endpoint at http://0.0.0.0:PORT/messages (POST). Claude Desktop primarily supports stdio mode, while SSE is useful for web-based clients or proxies.\n- Keep the MySQL user accounts with least privilege to reduce risk.\n- If you enable multiple connections, the server will manage pools per configuration entry and expose tools to query each connection by name.

Related MCP Servers

Sponsor this space

Reach thousands of developers