Get the FREE Ultimate OpenClaw Setup Guide →

alibabacloud-adb-mysql

AnalyticDB for MySQL MCP Server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio aliyun-alibabacloud-adb-mysql-mcp-server uv --directory /path/to/alibabacloud-adb-mysql-mcp-server run adb-mysql-mcp-server \
  --env ADB_MYSQL_HOST="host" \
  --env ADB_MYSQL_PORT="port" \
  --env ADB_MYSQL_USER="database_user" \
  --env ADB_MYSQL_DATABASE="database" \
  --env ADB_MYSQL_PASSWORD="database_password"

How to use

This MCP server provides a universal interface between AI agents and AnalyticDB for MySQL. It exposes a set of tools to run SQL against AnalyticDB for MySQL, retrieve the query plan, and obtain runtime execution statistics. The available tools include: execute_sql to run a SQL statement against the AnalyticDB for MySQL cluster; get_query_plan to fetch the logical/physical plan for a query; and get_execution_plan to obtain the actual runtime execution plan with statistics. Built-in resources offer convenient templates for discovering databases, tables, and DDLs, such as adbmysql:///databases, adbmysql:///{database}/tables, adbmysql:///{database}/{table}/ddl, and adbmysql:///config/{key}/value. These can be used to navigate the cluster schema and configuration. Prompts are not provided in the current version, so interactions rely on the defined tools and resources. To use the server, configure your MCP client to point to the adb-mysql-mcp-server, provide the necessary ADB_MYSQL_* environment variables, and issue tool calls or resource queries as part of your agent workflow.

How to install

Prerequisites: Python environment with uv package manager available, and optionally Node.js if you plan to use the inspector for debugging. You will also need access to an AnalyticDB for MySQL cluster and credentials. Installation steps:\n1) Install uv package manager (per uv docs).\n2) Install the MCP server package (example uses the repository source and uv to run it): uv pip install -r pyproject.toml or install the adb-mysql-mcp-server package if published.\n3) Ensure Python dependencies for the MCP server are installed in the project root.\n4) Run the MCP server locally (using uv) and expose the server for MCP clients to connect. Example command flow: uv --directory /path/to/alibabacloud-adb-mysql-mcp-server run adb-mysql-mcp-server.\n5) Optional: start an MCP Inspector for debugging: npx @modelcontextprotocol/inspector -e ADB_MYSQL_HOST=your_host -e ADB_MYSQL_PORT=your_port -e ADB_MYSQL_USER=your_username -e ADB_MYSQL_PASSWORD=your_password -e ADB_MYSQL_DATABASE=your_database uv --directory /path/to/alibabacloud-adb-mysql-mcp-server run adb-mysql-mcp-server.

Additional notes

Environment variables: ADB_MYSQL_HOST, ADB_MYSQL_PORT, ADB_MYSQL_USER, ADB_MYSQL_PASSWORD, ADB_MYSQL_DATABASE must be set to connect to the AnalyticDB for MySQL cluster. The mcpServers configuration uses these env vars to establish the database connection. If you run into connection issues, verify network access to the AnalyticDB cluster, correct host/port, and that the user has sufficient privileges. The server exposes tools for executing SQL and retrieving plans; permission and auditing should be considered for sensitive operations. For development, you can mount the repository directory with uv --directory to run the server locally. The README also shows a PIP mode alternative by using uv with the run and with flags, which mirrors the same service.

Related MCP Servers

Sponsor this space

Reach thousands of developers