MySQL MCP Server
About
# MySQL MCP Server A MySQL database connection server built on [go-mcp](https://github.com/ThinkInAIXYZ/go-mcp), supporting communication with clients via stdio, allowing execution of SQL queries and data manipulation operations. ## Features - Communicates with clients through the MCP protocol - Supports connection to…
Details
- License
- Apache-2.0 license
Explore
- Communicates with clients through the MCP protocol
- Supports connection to MySQL databases
- Supports query operations (SELECT, SHOW, DESCRIBE)
- Supports data manipulation operations (INSERT/UPDATE/DELETE)
- Permission control (configurable for insert, update, delete operations)
- Flexible configuration via environment variables
- Debug mode with detailed logging to file
The server is configured using environment variables.
Install directly from GitHub using Go's install command:
go install github.com/blanplan-ai/ai2mysql-mcp-server/cmd/ai2mysql-mcp-server@latest
The following environment variables can be set to configure the server:
| Environment Variable | Description | Default Value |
|---------|------|--------|
| MYSQL_HOST | MySQL host address | 127.0.0.1 |
| MYSQL_PORT | MySQL port number | 3306 |
| MYSQL_USER | MySQL username | root |
| MYSQL_PASS | MySQL password | password |
| DEFAULT_DATABASE | Default database name | test |
| ALLOW_INSERT | Whether to allow INSERT operations | false |
| ALLOW_UPDATE | Whether to allow UPDATE operations | false |
| ALLOW_DELETE | Whether to allow DELETE operations | false |
| IS_DEV | Enable development mode with detailed logging | false |
| LOG_PATH | Path to the log file (only effective in dev mode) | /tmp/ai2mysql.log |
Below is an example JSON configuration you can use to set environment variables:
{
"MYSQL_HOST": "127.0.0.1",
"MYSQL_PORT": "3306",
"MYSQL_USER": "root",
"MYSQL_PASS": "password",
"DEFAULT_DATABASE": "test",
"ALLOW_INSERT": "false",
"ALLOW_UPDATE": "false",
"ALLOW_DELETE": "false",
"IS_DEV": "false",
"LOG_PATH": "/tmp/ai2mysql.log"
}
Configuration notes:
- All boolean type configuration items use the string "true" or "false"
- In production environments, it is recommended to disable IS_DEV to prevent sensitive information leakage
- It is recommended to restrict INSERT/UPDATE/DELETE permissions based on actual needs
- Sensitive information such as passwords should be configured using environment variables
MYSQL_HOST=127.0.0.1 MYSQL_USER=root MYSQL_PASS=password ai2mysql-mcp-server
A MySQL database connection server built on go-mcp, supporting communication with clients via stdio, allowing execution of SQL queries and data manipulation operations.
Features
- Communicates with clients through the MCP protocol
- Supports connection to MySQL databases
- Supports query operations (SELECT, SHOW, DESCRIBE)
- Supports data manipulation operations (INSERT/UPDATE/DELETE)
- Permission control (configurable for insert, update, delete operations)
- Flexible configuration via environment variables
- Debug mode with detailed logging to file
Installation
Method 1: Direct Installation (Recommended)
Install directly from GitHub using Go's install command:
go install github.com/blanplan-ai/ai2mysql-mcp-server/cmd/ai2mysql-mcp-server@latest
Method 2: Manual Build
```bash
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.



