MySQL
About
Interact with and manage MySQL databases. Requires connection details configured via environment variables.
Details
- Author
- xiangma9712
- Categories
- Database, Other
Jump to
Setup
Install MySQL in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/xiangma9712/mysql-mcp-server
Follow the installation instructions in the repository README, then restart your MCP client.
An MCP server for interacting with MySQL databases.
This server supports executing read-only queries (query) and write queries that are ultimately rolled back (test_execute).
Add the following environment variables to~/.mcp/.env:
MYSQL_HOST=host.docker.internal # Hostname to access host services from Docker container MYSQL_PORT=3306 MYSQL_USER=root MYSQL_PASSWORD=your_password
Note:host.docker.internalis a special DNS name for accessing host machine services from Docker containers. Use this setting when connecting to a MySQL server running on your host machine. If connecting to a different MySQL server, change to the appropriate hostname.
{ "mcpServers": { "mysql": { "command": "docker", "args": [ "run", "-i", "--rm", "--add-host=host.docker.internal:host-gateway", "--env-file", "/Users/username/.mcp/.env", "ghcr.io/xiangma9712/mcp/mysql" ] } } }
docker run -i --rm --add-host=host.docker.internal:host-gateway --env-file ~/.mcp/.env ghcr.io/xiangma9712/mcp/mysql
Note: If you're using OrbStack,host.docker.internalis automatically supported, so the--add-hostoption can be omitted. While Docker Desktop also typically supports this automatically, adding the--add-hostoption is recommended for better reliability.
{ "type": "query", "payload": { "sql": "SELECT * FROM your_table" } }
{ "success": true, "data": [ { "id": 1, "name": "example" } ] }
{ "type": "test_execute", "payload": { "sql": "UPDATE your_table SET name = 'updated' WHERE id = 1" } }
{ "success": true, "data": "The UPDATE SQL query can be executed." }
{ "type": "list_tables" }
{ "success": true, "data": ["table1", "table2", "table3"] }
{ "type": "describe_table", "payload": { "table": "your_table" } }
{ "success": true, "data": [ { "Field": "id", "Type": "int(11)", "Null": "NO", "Key": "PRI", "Default": null, "Extra": "" }, { "Field": "name", "Type": "varchar(255)", "Null": "YES", "Key": "", "Default": null, "Extra": "" } ] }
- Implemented in TypeScript
- Uses mysql2 package
- Runs as a Docker container
- Accepts JSON commands through standard input
- Returns JSON responses through standard output
- Useshost.docker.internalto connect to host MySQL (compatible with both OrbStack and Docker Desktop)
- Uses environment variables for sensitive information management
- SQL injection prevention is the implementer's responsibility
- Proper network configuration required for production use
- Appropriate firewall settings needed when connecting to host machine services
Multi-database agent access (PostgreSQL, SQLite, MySQL, Oracle, SQL Server) with batch queries, pre-configured connections, and SQLGlot-enforced read-only safety
A read-only MCP server for MySQL, enabling LLMs to query live data using the CData JDBC Driver.
Database MCP server for MySQL, MariaDB, PostgreSQL & SQLite
A single-binary MCP server for MySQL, MariaDB, PostgreSQL, and SQLite
A Model Context Protocol (MCP) server that provides multi-database query execution capabilities with support for SQLite, PostgreSQL, and MySQL databases. Includes a built-in Web UI for managing database connections.
Allows Claude AI to interact directly with MySQL databases.
Update various databases (PostgreSQL, MySQL, MongoDB, SQLite) using data from CSV and Excel files.
Enables AI assistants to interact with various databases through JDBC connections.
An MCP server for retrieving data from a MariaDB database.
Access and manage MariaDB or MySQL databases using an MCP server.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





