MCP server for executing SQL queries against MySQL databases. Version 1.0.2. Designed for AI agents via the Model Context Protocol. Supports read-only queries, test execution (with automatic rollback), table listing, and schema inspection. Runs as a Docker container communicating via JSON over STDIO. Uses mysql2 under the hood. Primarily targets local development with host.docker.internal connectivity. Requires manual environment variable setup. No npm package released; distributed as Docker image 'my-mcp/mysql'.
npm install mcp-mysqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Run the Docker container, set env vars inline, send a list_tables command via stdin, and get JSON response.
Ensure MySQL is accessible and set MYSQL_HOST accordingly. Use --add-host=host.docker.internal:host-gateway.
For actual writes, use query with INSERT/UPDATE/DELETE. test_execute is for validation only.
Stay updated with future releases. The MCP protocol may standardize a different JSON-RPC format.
Use this only on localhost or behind a firewall. Do not expose directly to the internet.
Check the repository for build instructions or confirm image availability.
Ensure MySQL is running on host. Set MYSQL_HOST=host.docker.internal and add --add-host=host.docker.internal:host-gateway.
Use --add-host=host.docker.internal:host-gateway or set MYSQL_HOST to an IP address like 172.17.0.1.
Check MYSQL_USER and MYSQL_PASSWORD. Ensure user has permissions from the connecting host.