alibaba-cloud-analyticdb-mysql-mediator
A specialized bridge facilitating bidirectional data exchange and operational command execution between sophisticated Artificial Intelligence entities and AnalyticDB for MySQL instances. It furnishes AI Agents with necessary schema introspection capabilities and allows for the execution of arbitrary SQL statements against the real-time Analytical Database environment via a unified protocol interface.
Author

aliyun
Quick Info
Actions
Tags
AnalyticDB for MySQL Protocol Mediator Gateway
This server component acts as a universal conduit, establishing secure and efficient communication pathways between advanced AI software agents and Alibaba Cloud's AnalyticDB for MySQL data stores. Its core function is to empower AI agents to query database structural information (metadata) and dispatch structured query language (SQL) operations directly to the target database cluster.
1. Initial Setup and Client Integration
Deployment Method A: Source Code Checkout
-
Obtain Repository Files
shell git clone https://github.com/aliyun/alibabacloud-adb-mysql-mcp-server
-
Configure the MCP Client
Integrate the following JSON block into your central MCP client configuration manifest:
{ "mcpServers": { "adb-mysql-mcp-server": { "command": "uv", "args": [ "--directory", "/path/to/alibabacloud-adb-mysql-mcp-server", "run", "adb-mysql-mcp-server" ], "env": { "ADB_MYSQL_HOST": "host_address", "ADB_MYSQL_PORT": "connection_port", "ADB_MYSQL_USER": "db_credential_user", "ADB_MYSQL_PASSWORD": "secret_access_key", "ADB_MYSQL_DATABASE": "target_schema_name" } } } }
Deployment Method B: Python Package Installation (PIP)
-
Package Installation
Utilize Python's package installer for deployment:
bash pip install adb-mysql-mcp-server
-
Client Configuration Mapping
Update the MCP client configuration as follows:
{ "mcpServers": { "adb-mysql-mcp-server": { "command": "uv", "args": [ "run", "--with", "adb-mysql-mcp-server", "adb-mysql-mcp-server" ], "env": { "ADB_MYSQL_HOST": "host_address", "ADB_MYSQL_PORT": "connection_port", "ADB_MYSQL_USER": "db_credential_user", "ADB_MYSQL_PASSWORD": "secret_access_key", "ADB_MYSQL_DATABASE": "target_schema_name" } } } }
2. Custom Server Development Environment Setup
To tailor or extend this AnalyticDB for MySQL Mediator Server functionality, follow these prerequisites:
- Acquire the source code repository from GitHub.
- Install the
uvutility for dependency management, as detailed in uv documentation. - Install Node.js, which is required for accessing the
npxtool. - Resolve Python dependencies from the project root using this command:
shell uv pip install -r pyproject.toml
- For local debugging and runtime inspection, initialize the MCP Inspector with the following invocation, passing necessary environment variables directly:
shell npx @modelcontextprotocol/inspector \ -e ADB_MYSQL_HOST=your_host_ip \ -e ADB_MYSQL_PORT=your_port_number \ -e ADB_MYSQL_USER=your_db_username \ -e ADB_MYSQL_PASSWORD=your_db_password \ -e ADB_MYSQL_DATABASE=your_db_name \ uv --directory /path/to/alibabacloud-adb-mysql-mcp-server run adb-mysql-mcp-server
3. Enumeration of Server Capabilities (Tools and Resources)
-
Operational Tools
-
execute_sql: Designed to dispatch and run arbitrary SQL queries against the AnalyticDB for MySQL cluster. -
get_query_plan: Retrieves the anticipated execution strategy for a given SQL statement. -
get_execution_plan: Fetches the actual, post-execution plan detailing runtime metrics and performance statistics for a submitted SQL query.
-
-
Accessible Data Endpoints (Resources)
-
Core System Resources
adbmysql:///databases: An endpoint to list all accessible database schemas within the connected AnalyticDB cluster.
-
Schema-Specific Templates
-
adbmysql:///{schema}/tables: Retrieves the complete roster of tables belonging to a specified database schema. -
adbmysql:///{database}/{table}/ddl: Fetches the Data Definition Language (DDL) script required to recreate the structure of a named table in a specified database. -
adbmysql:///{config}/{key}/value: Used to query and retrieve the specific setting value associated with a cluster configuration parameter.
-
-
-
Agent Interaction Prompts
No predefined interaction prompts are currently documented for direct agent use.
