Alibaba Cloud ADB MySQL MCP server

Connects to Alibaba Cloud's Adb MySQL databases for executing SQL queries, analyzing query plans, and retrieving database metadata with minimal configuration requirements
Back to servers
Setup instructions
Provider
Alibaba Cloud
Release date
Mar 29, 2025
Language
Python
Package
Stats
1.1K downloads
16 stars

Adb MySQL MCP Server provides a universal interface between AI Agents and Adb MySQL databases, enabling seamless communication that helps AI Agents retrieve database metadata and execute SQL operations. This server follows the Model Context Protocol (MCP) to standardize the interaction between AI systems and database services.

Installation Options

Using PIP (Recommended)

1. Install the package

pip install adb-mysql-mcp-server

2. Configure MCP Client

Add the following configuration to your MCP client configuration file:

{
  "mcpServers": {
    "adb-mysql-mcp-server": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "adb-mysql-mcp-server",
        "adb-mysql-mcp-server"
      ],
      "env": {
        "ADB_MYSQL_HOST": "host",
        "ADB_MYSQL_PORT": "port",
        "ADB_MYSQL_USER": "database_user",
        "ADB_MYSQL_PASSWORD": "database_password",
        "ADB_MYSQL_DATABASE": "database"
      }
    }
  }
}

Using Local Files

1. Clone the repository

git clone https://github.com/aliyun/alibabacloud-adb-mysql-mcp-server

2. Configure MCP Client

Add the following configuration to your MCP client configuration file:

{
  "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",
        "ADB_MYSQL_PORT": "port",
        "ADB_MYSQL_USER": "database_user",
        "ADB_MYSQL_PASSWORD": "database_password",
        "ADB_MYSQL_DATABASE": "database"
      }
    }
  }
}

Using the MCP Server

Available Tools

The Adb MySQL MCP Server provides several tools for interacting with your database:

  • execute_sql: Execute SQL queries in the Adb MySQL Cluster
  • get_query_plan: Get the query plan for a SQL query
  • get_execution_plan: Get the actual execution plan with runtime statistics for a SQL query

Accessing Resources

Built-in Resources

  • adbmysql:///databases: Get all databases in the Adb MySQL cluster

Resource Templates

  • adbmysql:///{schema}/tables: Get all tables in a specific database
  • adbmysql:///{database}/{table}/ddl: Get the DDL script of a table in a specific database
  • adbmysql:///{config}/{key}/value: Get the value for a config key in the cluster

Testing with MCP Inspector

To debug the MCP server locally, you can use the MCP Inspector:

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

This will start the inspector interface where you can test and validate the MCP server operations before integrating with your AI agents.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "adb-mysql-mcp-server" '{"command":"uv","args":["run","--with","adb-mysql-mcp-server","adb-mysql-mcp-server"],"env":{"ADB_MYSQL_HOST":"host","ADB_MYSQL_PORT":"port","ADB_MYSQL_USER":"database_user","ADB_MYSQL_PASSWORD":"database_password","ADB_MYSQL_DATABASE":"database"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "adb-mysql-mcp-server": {
            "command": "uv",
            "args": [
                "run",
                "--with",
                "adb-mysql-mcp-server",
                "adb-mysql-mcp-server"
            ],
            "env": {
                "ADB_MYSQL_HOST": "host",
                "ADB_MYSQL_PORT": "port",
                "ADB_MYSQL_USER": "database_user",
                "ADB_MYSQL_PASSWORD": "database_password",
                "ADB_MYSQL_DATABASE": "database"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your 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

2. Add this to your configuration file:

{
    "mcpServers": {
        "adb-mysql-mcp-server": {
            "command": "uv",
            "args": [
                "run",
                "--with",
                "adb-mysql-mcp-server",
                "adb-mysql-mcp-server"
            ],
            "env": {
                "ADB_MYSQL_HOST": "host",
                "ADB_MYSQL_PORT": "port",
                "ADB_MYSQL_USER": "database_user",
                "ADB_MYSQL_PASSWORD": "database_password",
                "ADB_MYSQL_DATABASE": "database"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later