经 AI Skill Hub 精选评估,MCP MySQL 服务器 获评「推荐使用」。这款MCP工具在功能完整性、社区活跃度和易用性方面表现出色,AI 评分 7.5 分,适合有一定技术背景的用户使用。
MCP MySQL 服务器 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
MCP MySQL 服务器 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
# 方式一:通过 Claude Code CLI 一键安装
claude skill install https://github.com/askdba/mysql-mcp-server
# 方式二:手动配置 claude_desktop_config.json
{
"mcpServers": {
"mcp-mysql----": {
"command": "npx",
"args": ["-y", "mysql-mcp-server"]
}
}
}
# 配置文件位置
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: %APPDATA%/Claude/claude_desktop_config.json
# 安装后在 Claude 对话中直接使用 # 示例: 用户: 请帮我用 MCP MySQL 服务器 执行以下任务... Claude: [自动调用 MCP MySQL 服务器 MCP 工具处理请求] # 查看可用工具列表 # 在 Claude 中输入:"列出所有可用的 MCP 工具"
// claude_desktop_config.json 配置示例
{
"mcpServers": {
"mcp_mysql____": {
"command": "npx",
"args": ["-y", "mysql-mcp-server"],
"env": {
// "API_KEY": "your-api-key-here"
}
}
}
}
// 保存后重启 Claude Desktop 生效
[](https://github.com/askdba/mysql-mcp-server/releases)
[](https://golang.org/)
[](LICENSE)
A fast, read-only MySQL Server for the Model Context Protocol (MCP) written in Go.
This project exposes safe MySQL introspection tools to Claude Desktop via MCP. Claude can explore databases, describe schemas, and execute controlled read-only SQL queries — ideal for secure development assistance, debugging, analytics, and schema documentation.
/status dashboard in HTTP modeexplain_query plan warningsfeatures: extended_tools: true vector_tools: false
docker pull ghcr.io/askdba/mysql-mcp-server:latest
Note: Docker image tags use the raw version number without a leading "v" (e.g.,1.5.0, notv1.5.0).
git clone https://github.com/askdba/mysql-mcp-server.git
cd mysql-mcp-server
make build
Binary output: bin/mysql-mcp-server
git clone https://github.com/askdba/mysql-mcp-server.git
cd mysql-mcp-server
make build
When running from a cloned repo you can also use the interactive setup script:
./scripts/quickstart.sh
This will test your MySQL connection, optionally create a read-only MCP user, and generate your Claude Desktop configuration.
claude mcp add --transport stdio \
--env MYSQL_DSN="user:password@tcp(127.0.0.1:3306)/mydb?parseTime=true" \
--env MYSQL_MCP_EXTENDED=1 \
mysql -- mysql-mcp-server
export MYSQL_TEST_DSN="mcpuser:mcppass00@tcp(127.0.0.1:13306)/testdb?parseTime=true"
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"mysql": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "MYSQL_DSN=user:password@tcp(host.docker.internal:3306)/mydb",
"ghcr.io/askdba/mysql-mcp-server:latest"
]
}
}
}
With extended tools:
{
"mcpServers": {
"mysql": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "MYSQL_DSN=user:password@tcp(host.docker.internal:3306)/mydb",
"-e", "MYSQL_MCP_EXTENDED=1",
"ghcr.io/askdba/mysql-mcp-server:latest"
]
}
}
}
services:
mysql:
image: mysql:8.4
environment:
MYSQL_ROOT_PASSWORD: rootpass
MYSQL_DATABASE: testdb
ports:
- "3306:3306"
mcp:
image: ghcr.io/askdba/mysql-mcp-server:latest
depends_on:
- mysql
environment:
MYSQL_DSN: "root:rootpass@tcp(mysql:3306)/testdb?parseTime=true"
MYSQL_MCP_EXTENDED: "1"
Run:
docker compose up
docker build -t mysql-mcp-server .
docker run -p 9306:9306 \
-e MYSQL_DSN="user:password@tcp(host.docker.internal:3306)/mydb" \
-e MYSQL_MCP_HTTP=1 \
-e MYSQL_MCP_EXTENDED=1 \
ghcr.io/askdba/mysql-mcp-server:latest
Enable estimated token counting for tool inputs/outputs to monitor LLM context usage:
export MYSQL_MCP_TOKEN_TRACKING=1
export MYSQL_MCP_TOKEN_MODEL=cl100k_base # default, used by GPT-4/Claude
Or via YAML config file:
logging:
token_tracking: true
token_model: "cl100k_base"
When enabled: - JSON logs include a tokens object with estimated input/output/total tokens - Audit log entries for run_query include input_tokens and output_tokens - All other tools also emit token estimates when token_tracking is enabled
Example JSON log output:
{
"level": "INFO",
"msg": "query executed",
"tool": "run_query",
"duration_ms": 45,
"row_count": 10,
"tokens": {
"input_estimated": 25,
"output_estimated": 150,
"total_estimated": 175,
"model": "cl100k_base"
}
}
Notes: - Token counts are estimates using tiktoken encoding, not actual LLM billing - For payloads exceeding 1MB, a heuristic (~4 bytes per token) is used to prevent memory spikes - The feature is disabled by default to avoid overhead when not needed
List databases:
curl http://localhost:9306/api/databases
Run a query:
curl -X POST http://localhost:9306/api/query \
-H "Content-Type: application/json" \
-d '{"sql": "SELECT * FROM users LIMIT 5", "database": "myapp"}'
Get server info:
curl http://localhost:9306/api/server-info
List / switch connections (no HTTP “add” endpoint):
curl http://localhost:9306/api/connections
curl -X POST http://localhost:9306/api/connections/use \
-H "Content-Type: application/json" \
-d '{"name": "staging"}' Registering a new DSN at runtime is MCP-only via the add_connection tool when MYSQL_MCP_ENABLE_ADD_CONNECTION=1 (see add_connection).
The examples/ folder contains:
claude_desktop_config.json - Example Claude Desktop configurationtest-dataset.sql - Demo database with tables, views, and sample dataLoad the test dataset:
mysql -u root -p < examples/test-dataset.sql
This creates a mcp_demo database with: - 5 categories, 13 products, 8 customers - 9 orders with 16 order items - Views: order_summary, product_inventory - Stored procedure: GetCustomerOrders - Stored function: GetProductStock
brew install askdba/tap/mysql-mcp-server
mysql-mcp-server --version
Then follow the client-specific setup in the Claude Desktop, Claude Code, or Cursor IDE sections below.
Tip: brew info askdba/tap/mysql-mcp-server shows a config reminder after install.
Environment variables:
| Variable | Required | Default | Description |
|---|---|---|---|
| MYSQL_DSN | Yes | – | MySQL DSN |
| MYSQL_MAX_ROWS | No | 200 | Max rows returned per query |
| MYSQL_QUERY_TIMEOUT_SECONDS | No | 30 | Query timeout (seconds); wins over MYSQL_QUERY_TIMEOUT when both are set |
| MYSQL_QUERY_TIMEOUT | No | – | Query timeout in **milliseconds** (e.g. 30000); used only if MYSQL_QUERY_TIMEOUT_SECONDS is unset |
| MYSQL_POOL_SIZE | No | – | Alias for MYSQL_MAX_OPEN_CONNS (pool size); MYSQL_MAX_OPEN_CONNS overrides when both are set |
| MYSQL_MCP_EXTENDED | No | 0 | Enable extended tools (set to 1) |
| MYSQL_MCP_ENABLE_ADD_CONNECTION | No | 0 | Set 1 to expose the MCP tool **add_connection** (runtime DSN registration; see [add_connection](#add_connection)). Requires **MYSQL_MCP_EXTENDED=1**. Not available over the HTTP REST API. |
| MYSQL_MCP_JSON_LOGS | No | 0 | Enable JSON structured logging (set to 1) |
| MYSQL_MCP_TOKEN_TRACKING | No | 0 | Enable estimated token usage tracking (set to 1) |
| MYSQL_MCP_TOKEN_MODEL | No | cl100k_base | Tokenizer encoding to use for estimation |
| MYSQL_MCP_TOKEN_CARD | No | **on** when MYSQL_MCP_HTTP is set | **/status** live token dashboard + listing in **GET /api**; omit to use default **on**; set to **0** to disable |
| MYSQL_MCP_AUDIT_LOG | No | – | Path to audit log file |
| MYSQL_MCP_ALLOWED_DATABASES | No | – | Comma-separated schema allowlist (empty = all allowed). With an allowlist, **run_query** rejects **SHOW DATABASES** / **SHOW DATABASES LIKE**—use **list_databases**. |
| MYSQL_MCP_STRICT_READ_ONLY | No | 0 | Set 1 to enable transaction_read_only=ON on new connections |
| MYSQL_MCP_ALLOW_SYSTEM_SCHEMAS | No | 0 | Set 1 to allow **read-only** access to information_schema, performance_schema, and sys (for diagnostics: index cardinality, index usage, redundant/unused indexes). mysql stays blocked regardless. |
| MYSQL_MCP_PROCESS_ADMIN | No | 0 | Set 1 to enable **process_list** / **kill_query** (extended); **kill_query** issues **KILL QUERY** (cancels the running statement only, not the connection) |
| MYSQL_MCP_READ_AUDIT_TOOL | No | 0 | Set 1 to enable read_audit_log when audit path is set |
| MYSQL_MCP_SLOW_QUERY_TOOL | No | 0 | Set 1 to enable slow_query_log tool (extended) |
| MYSQL_MCP_VECTOR | No | 0 | Enable vector tools for MySQL 9.0+ (set to 1) |
| MYSQL_MCP_HTTP | No | 0 | Enable REST API mode (set to 1); **mutually exclusive** with stdio MCP |
| MYSQL_MCP_METRICS_HTTP | No | 0 | With **stdio MCP only**: expose **/status** + **/api/metrics/tokens** on **MYSQL_HTTP_PORT** (same process as Claude/Cursor) |
| MYSQL_HTTP_PORT | No | 9306 | Port for REST API **or** metrics sidecar |
| MYSQL_HTTP_RATE_LIMIT | No | 0 | Enable rate limiting for HTTP mode (set to 1) |
| MYSQL_HTTP_RATE_LIMIT_RPS | No | 100 | Rate limit: requests per second |
| MYSQL_HTTP_RATE_LIMIT_BURST | No | 200 | Rate limit: burst size |
| MYSQL_MAX_OPEN_CONNS | No | 10 | Max open database connections (overrides MYSQL_POOL_SIZE when both are set) |
| MYSQL_MAX_IDLE_CONNS | No | 5 | Max idle database connections |
| MYSQL_CONN_MAX_LIFETIME_MINUTES | No | 30 | Connection max lifetime in minutes |
| MYSQL_CONN_MAX_IDLE_TIME_MINUTES | No | 5 | Max idle time before connection is closed |
| MYSQL_PING_TIMEOUT_SECONDS | No | 5 | Database ping/health check timeout |
| MYSQL_MCP_DB_RETRY_MAX | No | 3 | Retries for transient errors on **run_query** and **ping** (0 disables retries) |
| MYSQL_MCP_DB_RETRY_MAX_INTERVAL_MS | No | 10000 | Max exponential-backoff interval between retries (milliseconds) |
| MYSQL_HTTP_REQUEST_TIMEOUT_SECONDS | No | 60 | HTTP request timeout in REST API mode |
| MYSQL_SSL | No | – | Enable SSL/TLS for connections (true, false, skip-verify, preferred) |
Enable encrypted connections to MySQL servers:
| SSL Value | Description |
|---|---|
true | Enable TLS with certificate verification |
false | Disable TLS (default) |
skip-verify | Enable TLS without certificate verification (self-signed certs) |
preferred | Maps to skip-verify (Go MySQL driver limitation) |
Note: The Go MySQL driver doesn't supporttls=preferred. When you specifypreferred, it is automatically mapped toskip-verifyto ensure TLS is enabled.
Environment variable:
```bash
Configure multiple MySQL connections using numbered environment variables:
```bash
As an alternative to environment variables, you can use a YAML or JSON configuration file.
Config file search order: 1. --config /path/to/config.yaml (command line flag) 2. MYSQL_MCP_CONFIG environment variable 3. ./mysql-mcp-server.yaml (current directory) 4. ~/.config/mysql-mcp-server/config.yaml (user config) 5. /etc/mysql-mcp-server/config.yaml (system config)
Example config file (mysql-mcp-server.yaml):
```yaml
query: max_rows: 200 timeout_seconds: 30
http: enabled: false port: 9306
**Command line options:**
bash
mysql-mcp-server --config /path/to/config.yaml
mysql-mcp-server --validate-config /path/to/config.yaml
mysql-mcp-server --print-config
This repo includes a .mcp.json that Claude Code auto-discovers when you open the project. Set your DSN in the shell before starting Claude Code:
export MYSQL_DSN="user:password@tcp(127.0.0.1:3306)/mydb?parseTime=true"
claude # start Claude Code — MySQL tools will be available automatically
To use the same config in your own project, copy .mcp.json to your project root and set MYSQL_DSN in your shell.
Verify the integration by asking Claude Code: "List all databases on this MySQL server."
| Variable | Purpose |
|---|---|
MYSQL_MCP_ALLOWED_DATABASES | Comma-separated schema allowlist. When set, tools that take a database argument must use an allowed name; list_databases / database_size only expose allowed schemas; run_query requires database and cannot be used to hop schemas via omission. **run_query** rejects **SHOW DATABASES** and **SHOW DATABASES LIKE** (use **list_databases**). Qualified names in SQL, **EXPLAIN** (including **FORMAT=** / **EXTENDED**), and inner DML in **EXPLAIN** are checked against the allowlist. **slow_query_log** (table mode) only returns mysql.slow_log rows whose **db** column matches an allowed schema (case-insensitive); rows with null/empty db are omitted. |
MYSQL_MCP_STRICT_READ_ONLY | When 1, new driver connections run with transaction_read_only=ON (harder to accidentally issue writes if grants allow them). |
MYSQL_MCP_ALLOW_SYSTEM_SCHEMAS | When 1, lifts the default block on the read-only diagnostic schemas information_schema, performance_schema, and sys so run_query / explain_query may reference them (e.g. information_schema.STATISTICS for index cardinality, sys.schema_redundant_indexes / sys.schema_unused_indexes, performance_schema.table_io_waits_summary_by_index_usage). The mysql schema remains blocked unconditionally. Off by default; reads still require the connection's MySQL grants. This flag and MYSQL_MCP_ALLOWED_DATABASES are **orthogonal and both enforced**: the flag lifts the hardcoded system-schema guard, while the allowlist (when set) independently rejects any schema not on it. So if you run with an allowlist, you must **also add information_schema / performance_schema / sys to MYSQL_MCP_ALLOWED_DATABASES** for these queries to pass; with no allowlist (the default), the flag alone is sufficient. The flag never unlocks mysql. |
MYSQL_MCP_PROCESS_ADMIN | Enables **process_list** and **kill_query** (issues **KILL QUERY**, not connection kill; plus HTTP /api/processlist, /api/kill). Requires appropriate MySQL privileges (CONNECTION_ADMIN / PROCESS, etc.). |
MYSQL_MCP_READ_AUDIT_TOOL | Enables **read_audit_log** when **MYSQL_MCP_AUDIT_LOG** is set (tail of the audit JSON file). |
MYSQL_MCP_SLOW_QUERY_TOOL | Enables **slow_query_log** (reads mysql.slow_log when log_output includes TABLE, otherwise returns file settings). |
server_info: Pass detailed: true (MCP) or ?detailed=1 (HTTP) for ping latency, Threads_running, Slow_queries, Questions, and InnoDB buffer pool hit rate when stats are available. If MYSQL_MCP_TOKEN_TRACKING=1, token_metrics is always included (cumulative since process start).
YAML file equivalents live under security: in the config file (allowed_databases, strict_read_only, allow_system_schemas, process_admin, read_audit_tool, slow_query_tool).
When running tests manually, set the DSN:
```bash
Enable HTTP REST API mode to use with ChatGPT, Gemini, or any HTTP client:
export MYSQL_DSN="user:password@tcp(localhost:3306)/mydb"
export MYSQL_MCP_HTTP=1
export MYSQL_HTTP_PORT=9306 # Optional, defaults to 9306
mysql-mcp-server
Discovery (GET /api): The JSON response includes an endpoints map that lists only routes the server has registered for the current configuration—same rules as the mux: core routes always; extended routes only if MYSQL_MCP_EXTENDED=1; /api/processlist and /api/kill only if extended and MYSQL_MCP_PROCESS_ADMIN=1; /api/audit-log only if extended and read-audit is enabled (MYSQL_MCP_READ_AUDIT_TOOL=1 with MYSQL_MCP_AUDIT_LOG); /api/slow-log only if extended and MYSQL_MCP_SLOW_QUERY_TOOL=1; vector routes only if MYSQL_MCP_VECTOR=1; /status appears in the index only when the token card is enabled. modes in the JSON reflects extended, vector, and token_card.
Runtime DSN registration: There is no HTTP route to register a new connection. The MCP tool add_connection (optional; MYSQL_MCP_EXTENDED=1 and MYSQL_MCP_ENABLE_ADD_CONNECTION=1) is the only supported registration path and applies to the MCP (stdio) process only. In REST API mode, the process never registers tools; GET /api/connections lists only connections configured for that HTTP server process (not connections added by MCP elsewhere).
| Method | Endpoint | Description |
|---|---|---|
| GET | /health | Health check |
| GET | /api | API index: registered endpoints + **modes** (see Discovery above) |
| GET | /api/databases | List databases |
| GET | /api/tables?database= | List tables |
| GET | /api/describe?database=&table= | Describe table |
| POST | /api/query | Run SQL query |
| GET | /api/ping | Ping database |
| GET | /api/server-info | Server info |
| GET | /api/connections | List connections (masked DSNs) known to **this HTTP server process** (config-loaded; no MCP add_connection in REST mode) |
| POST | /api/connections/use | Switch active connection: JSON body {"name": "<connection_name>"}. Invalid JSON or missing name → **400**. Unknown connection name → **200** with **success: false** in the JSON body (same semantics as MCP use_connection). |
POST /api/connections/use response: JSON with success, active, message, database when applicable (see Response Format).
Not implemented over HTTP: POST /api/connections (register new DSN) — use MCP add_connection when enabled.
Extended endpoints (requires MYSQL_MCP_EXTENDED=1):
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/indexes?database=&table= | List indexes |
| GET | /api/create-table?database=&table= | Show CREATE TABLE |
| POST | /api/explain | Explain query |
| GET | /api/views?database= | List views |
| GET | /api/triggers?database= | List triggers |
| GET | /api/procedures?database= | List procedures |
| GET | /api/functions?database= | List functions |
| GET | /api/partitions?database=&table= | List table partitions |
| GET | /api/size/database?database= | Database size |
| GET | /api/size/tables?database= | Table sizes |
| GET | /api/foreign-keys?database= | Foreign keys |
| GET | /api/status?pattern= | Server status |
| GET | /api/variables?pattern= | Server variables |
| GET | /api/audit-log?lines= | Tail lines from the MCP audit log (JSON). Listed only when extended **and** **MYSQL_MCP_READ_AUDIT_TOOL=1** with **MYSQL_MCP_AUDIT_LOG** configured. |
| GET | /api/slow-log?limit= | Slow query log rows or file/table settings. Listed only when extended **and** **MYSQL_MCP_SLOW_QUERY_TOOL=1**. |
| GET | /api/processlist | Active MySQL threads (SHOW FULL PROCESSLIST). Listed only when extended **and** **MYSQL_MCP_PROCESS_ADMIN=1**. Requires MySQL **PROCESS** (or equivalent) to succeed. |
| POST | /api/kill | Cancel the **current statement** on a connection: JSON body {"id": <positive integer>} (same id as **/api/processlist**). Executes **KILL QUERY**—the client connection stays open. Listed only when extended **and** **MYSQL_MCP_PROCESS_ADMIN=1**. Requires privilege to run **KILL QUERY** for that thread (e.g. **CONNECTION_ADMIN** or **PROCESS** as applicable). |
Vector endpoints (requires MYSQL_MCP_VECTOR=1):
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/vector/search | Vector similarity search |
| GET | /api/vector/info?database= | Vector column info |
Token metrics (HTTP mode; /status defaults on when MYSQL_MCP_HTTP is set—use MYSQL_MCP_TOKEN_CARD=0 to hide it; YAML features.token_card applies when not using that default):
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/metrics/tokens | Cumulative token usage, cost estimate, recent queries (always registered; zeros when tracking off) |
| GET | /status | Live HTML dashboard (auto-refresh); listed in GET /api when the feature is enabled |
Edit your Claude Desktop configuration file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Windows:
%APPDATA%\Claude\claude_desktop_config.json
Linux:
~/.config/Claude/claude_desktop_config.json
Add:
{
"mcpServers": {
"mysql": {
"command": "mysql-mcp-server",
"env": {
"MYSQL_DSN": "user:password@tcp(127.0.0.1:3306)/mydb?parseTime=true",
"MYSQL_MAX_ROWS": "200",
"MYSQL_MCP_EXTENDED": "1"
}
}
}
}
Note: If Claude Desktop cannot find the binary, replace"mysql-mcp-server"with the full path fromwhich mysql-mcp-server.
Token dashboard (/status) in the same process as MCP: stdio MCP does not open HTTP by default. Set MYSQL_MCP_METRICS_HTTP=1 so this instance also listens on MYSQL_HTTP_PORT (default 9306) for http://127.0.0.1:9306/status and /api/metrics/tokens — the same counters as Claude’s tool calls. Use MYSQL_MCP_TOKEN_TRACKING=1 so the dashboard is meaningful. Do not set MYSQL_MCP_HTTP=1 here (that mode replaces MCP with full REST only).
"env": {
"MYSQL_DSN": "user:password@tcp(127.0.0.1:3306)/mydb?parseTime=true",
"MYSQL_MCP_TOKEN_TRACKING": "1",
"MYSQL_MCP_METRICS_HTTP": "1",
"MYSQL_HTTP_PORT": "9306"
}
Restart Claude Desktop.
Cursor IDE supports the Model Context Protocol (MCP). Configure it to use mysql-mcp-server:
Edit your Cursor MCP configuration file:
macOS:
~/.cursor/mcp.json
Windows:
%APPDATA%\Cursor\mcp.json
Linux:
~/.config/Cursor/mcp.json
Add:
{
"mcpServers": {
"mysql": {
"command": "mysql-mcp-server",
"env": {
"MYSQL_DSN": "root:password@tcp(127.0.0.1:3306)/mydb?parseTime=true",
"MYSQL_MAX_ROWS": "200",
"MYSQL_MCP_EXTENDED": "1"
}
}
}
}
Token dashboard (/status) in the same process as MCP: Same behavior as Claude Desktop — stdio MCP does not open HTTP by default. Set MYSQL_MCP_TOKEN_TRACKING=1, MYSQL_MCP_METRICS_HTTP=1, and MYSQL_HTTP_PORT (default 9306) for http://127.0.0.1:9306/status and /api/metrics/tokens. Do not set MYSQL_MCP_HTTP=1 here (full REST replaces stdio MCP).
"env": {
"MYSQL_DSN": "root:password@tcp(127.0.0.1:3306)/mydb?parseTime=true",
"MYSQL_MAX_ROWS": "200",
"MYSQL_MCP_EXTENDED": "1",
"MYSQL_MCP_TOKEN_TRACKING": "1",
"MYSQL_MCP_METRICS_HTTP": "1",
"MYSQL_HTTP_PORT": "9306"
}
Restart Cursor after editing mcp.json.
With Docker:
{
"mcpServers": {
"mysql": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "MYSQL_DSN=root:password@tcp(host.docker.internal:3306)/mydb?parseTime=true",
"-e", "MYSQL_MCP_EXTENDED=1",
"ghcr.io/askdba/mysql-mcp-server:latest"
]
}
}
}
Restart Cursor after saving the configuration.
Claude Code supports MCP servers via the CLI or a project-scoped .mcp.json file.
Integration tests run against real MySQL instances using Docker Compose.
Test against MySQL 8.0 (default):
make test-integration-80
Test against MySQL 8.4:
make test-integration-84
Test against MySQL 9.0:
make test-integration-90
Test against all supported versions (MySQL & MariaDB):
make test-integration-all
Test specifically against MariaDB 11.4:
make test-integration-mariadb-11
/apiMySQL MCP 服务是一个快速、可扩展的 MySQL 服务,支持多个 MySQL 或 MariaDB 实例,提供多种功能,包括向量搜索、MCP 工具等。
MySQL MCP 服务的功能包括:只读模式、多 DSN 支持、MariaDB 支持、向量搜索、MCP 工具等。
MySQL MCP 服务需要 Go 1.24+、Docker 和 Docker Compose、MySQL 客户端等环境依赖。
可以通过 Docker、源码安装 MySQL MCP 服务,具体步骤包括:下载 Docker 镜像、编译源码等。
使用 MySQL MCP 服务,需要配置环境变量、启用 HTTP REST API 模式等,具体步骤包括:配置环境变量、启用 HTTP REST API 模式、使用 MCP 工具等。
MySQL MCP 服务的配置包括:环境变量、MCP 参数、HTTP 端口等,具体配置包括:配置环境变量、设置 MCP 参数、配置 HTTP 端口等。
MySQL MCP 服务提供 REST API 模式,支持多种 API 端点,包括:发现端点、数据库端点、查询端点等。
MySQL MCP 服务支持多种集成,包括:Claude Desktop 集成、Cursor IDE 集成、Claude Code 集成等,具体步骤包括:配置环境变量、启用集成模式、使用集成工具等。
高质量的MCP工具实现
该工具使用 NOASSERTION 协议,商用场景请仔细阅读协议条款,必要时咨询法律意见。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
📄 NOASSERTION — 请查阅原始协议条款了解具体使用限制。
AI Skill Hub 点评:MCP MySQL 服务器 的核心功能完整,质量良好。对于Claude Desktop / Claude Code 用户来说,这是一个值得纳入个人工具库的选择。建议先在非生产环境试用,再逐步推广。
| 原始名称 | mysql-mcp-server |
| 原始描述 | 开源MCP工具:MySQL Server implementation for Model Context Protocol (MCP) written in Go.。⭐35 · Go |
| Topics | mcpgomysql |
| GitHub | https://github.com/askdba/mysql-mcp-server |
| License | NOASSERTION |
| 语言 | Go |
收录时间:2026-06-05 · 更新时间:2026-06-06 · License:NOASSERTION · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端