AnalyticDB for MySQL MCP Server
@aliyun
AnalyticDB for MySQL MCP Server
Overview
What is AnalyticDB for MySQL MCP Server?
AnalyticDB for MySQL MCP Server is a universal interface between AI Agents and Alibaba Cloud's AnalyticDB for MySQL. It provides two categories of capabilities: OpenAPI tools for managing clusters, whitelists, accounts, networking, monitoring, and diagnostics, and SQL tools for direct database query execution, execution plan viewing, and metadata browsing. Read-only tools are annotated per the MCP protocol to distinguish them from mutating operations.
How to use AnalyticDB for MySQL MCP Server?
Install by cloning the GitHub repository and running uv sync. Configure via environment variables: set ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET for OpenAPI tools, or ADB_MYSQL_HOST, ADB_MYSQL_PORT, ADB_MYSQL_USER, ADB_MYSQL_PASSWORD, and ADB_MYSQL_DATABASE for SQL tools. Run with uv --directory /path/to/alibabacloud-adb-mysql-mcp-server run adb-mysql-mcp-server. Transport can be stdio (default), SSE, or streamable HTTP, configured via SERVER_TRANSPORT and SERVER_PORT. Example configurations are provided for cherry-studio, Claude Code, and Cline.
Key features of AnalyticDB for MySQL MCP Server
- OpenAPI tools for cluster management and diagnostics
- SQL tools for direct query execution and plans
- Resource URIs for database metadata browsing
- Read‑only tools annotated for safe use
- Supports stdio, SSE, and streamable HTTP transports
- Temporary account creation when credentials are absent
Use cases of AnalyticDB for MySQL MCP Server
- Manage ADB MySQL cluster IP whitelists and accounts
- Diagnose slow SQL and performance issues
- Query cluster performance metrics (CPU, memory, QPS)
- Execute SQL queries and analyze execution plans via AI Agent
- Automate cluster administration and auditing tasks
FAQ from AnalyticDB for MySQL MCP Server
What are the prerequisites?
Python >= 3.13 and uv are required. For OpenAPI tools, an Alibaba Cloud AccessKey (ID and Secret) is needed. For SQL tools in direct‑connection mode, database host, port, username, and password are required.
How do I configure both SQL tools and OpenAPI tools together?
Set all relevant environment variables (both AccessKey and ADB MySQL credentials) simultaneously. If AccessKey is not configured, OpenAPI tools are automatically disabled and only SQL tools remain active.
What transport protocols are supported?
The server supports stdio (default), SSE, and streamable HTTP transport. Use the SERVER_TRANSPORT environment variable to select the protocol and SERVER_PORT to set the port for SSE/HTTP (default 8000).
Can I use the server without providing direct database credentials?
Yes. If ADB_MYSQL_USER and ADB_MYSQL_PASSWORD are not set but an AccessKey is available, a temporary database account is automatically created via OpenAPI for SQL execution and cleaned up afterward.