Alibaba PolarDB
MCP Servers to access PolarDB.
What is Alibaba PolarDB?
Alibaba PolarDB is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to mcp servers to access polardb.
MCP Servers to access PolarDB.
This server falls under the Databases category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- MCP Servers to access PolarDB.
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx alibabacloud-polardbConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Alibaba PolarDB
The Alibaba Cloud PolarDB MCP Server provides three MCP server implementations — for PolarDB MySQL, PolarDB PostgreSQL, and the PolarDB OpenAPI — giving AI agents direct access to Alibaba Cloud's cloud-native relational database service. The MySQL and PostgreSQL servers support natural language to SQL conversion, text-to-chart generation, custom model creation, and document search, while the OpenAPI server enables management-plane operations. Teams running workloads on PolarDB can use these servers to let AI assistants query, analyze, and manage their databases through conversation.
Prerequisites
- Python 3.10 or higher (3.12 recommended) with the uv package manager installed
- A running Alibaba Cloud PolarDB instance (MySQL or PostgreSQL) with network access from your machine
- Database credentials: host, port, username, password, and database name
- An MCP-compatible client such as Claude Desktop
Clone the repository
Clone the alibabacloud-polardb-mcp-server monorepo and navigate to the server variant you need.
git clone https://github.com/aliyun/alibabacloud-polardb-mcp-server.git
cd alibabacloud-polardb-mcp-server/polardb-mysql-mcp-serverCreate a virtual environment and install dependencies
Use uv to create and activate a virtual environment, then install the required Python packages.
uv venv
source .venv/bin/activate
uv pip install -r requirements.txtConfigure environment variables
Copy the example env file and fill in your PolarDB connection details. Set operation toggles to true only if you need write access.
cp .env_example .env
# Edit .env:
# POLARDB_MYSQL_HOST=rm-xxxx.mysql.rds.aliyuncs.com
# POLARDB_MYSQL_PORT=3306
# POLARDB_MYSQL_USER=your_user
# POLARDB_MYSQL_PASSWORD=your_password
# POLARDB_MYSQL_DATABASE=your_database
# POLARDB_MYSQL_ENABLE_UPDATE=false
# POLARDB_MYSQL_ENABLE_DELETE=false
# POLARDB_MYSQL_ENABLE_INSERT=false
# POLARDB_MYSQL_ENABLE_DDL=false
# RUN_MODE=stdioTest the server locally
Run the server directly to confirm it connects to your PolarDB instance without errors.
uv run src/polardb_mysql_mcp_server/server.pyConfigure Claude Desktop to use the server
Add the server to your Claude Desktop MCP config, passing connection details as environment variables.
{
"mcpServers": {
"polardb-mysql": {
"command": "uv",
"args": ["run", "/path/to/polardb-mysql-mcp-server/src/polardb_mysql_mcp_server/server.py"],
"env": {
"POLARDB_MYSQL_HOST": "rm-xxxx.mysql.rds.aliyuncs.com",
"POLARDB_MYSQL_PORT": "3306",
"POLARDB_MYSQL_USER": "your_user",
"POLARDB_MYSQL_PASSWORD": "your_password",
"POLARDB_MYSQL_DATABASE": "your_database",
"RUN_MODE": "stdio"
}
}
}
}Alibaba PolarDB Examples
Client configuration
Claude Desktop MCP config for the PolarDB MySQL server with read-only access.
{
"mcpServers": {
"polardb-mysql": {
"command": "uv",
"args": ["run", "/home/user/alibabacloud-polardb-mcp-server/polardb-mysql-mcp-server/src/polardb_mysql_mcp_server/server.py"],
"env": {
"POLARDB_MYSQL_HOST": "rm-xxxx.mysql.rds.aliyuncs.com",
"POLARDB_MYSQL_PORT": "3306",
"POLARDB_MYSQL_USER": "readonly_user",
"POLARDB_MYSQL_PASSWORD": "your_password",
"POLARDB_MYSQL_DATABASE": "production_db",
"POLARDB_MYSQL_ENABLE_UPDATE": "false",
"POLARDB_MYSQL_ENABLE_DELETE": "false",
"POLARDB_MYSQL_ENABLE_INSERT": "false",
"POLARDB_MYSQL_ENABLE_DDL": "false",
"RUN_MODE": "stdio"
}
}
}
}Prompts to try
Example prompts for interacting with PolarDB through an AI client.
- "List all tables in the production_db database and describe their schemas."
- "How many orders were placed in the last 7 days? Group by status."
- "Generate a chart showing daily revenue for the past 30 days from the orders table."
- "Find the top 10 customers by total spend in the customers and orders tables."
- "What indexes exist on the users table and are there any missing indexes I should add?"Troubleshooting Alibaba PolarDB
Connection refused or timeout when starting the server
Verify that your PolarDB instance's whitelist includes your machine's public IP address. In the Alibaba Cloud console, go to your PolarDB cluster, then Security > Whitelist, and add your IP.
POLARDB_MYSQL_ENABLE_UPDATE is false but the AI still attempts write operations
The enable flags restrict the server from exposing write tools. Confirm the env vars are correctly set in your MCP config's env block (not just in your shell). Restart your MCP client after changing them.
uv command not found when Claude Desktop tries to start the server
Install uv globally with: curl -LsSf https://astral.sh/uv/install.sh | sh and ensure ~/.cargo/bin or ~/.local/bin (where uv installs) is in the system PATH that Claude Desktop inherits.
Frequently Asked Questions about Alibaba PolarDB
What is Alibaba PolarDB?
Alibaba PolarDB is a Model Context Protocol (MCP) server that mcp servers to access polardb. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Alibaba PolarDB?
Follow the installation instructions on the Alibaba PolarDB GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with Alibaba PolarDB?
Alibaba PolarDB works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Alibaba PolarDB free to use?
Yes, Alibaba PolarDB is open source and available under the Apache-2.0 license. You can use it freely in both personal and commercial projects.
Alibaba PolarDB Alternatives — Similar Databases Servers
Looking for alternatives to Alibaba PolarDB? Here are other popular databases servers you can use with Claude, Cursor, and VS Code.
Excelize
★ 20.6kGo language library for reading and writing Microsoft Excel™ (XLAM / XLSM / XLSX / XLTM / XLTX) spreadsheets
MCP Toolbox for Databases
★ 15.3kOpen source MCP server specializing in easy, fast, and secure tools for Databases.
DBHub
★ 2.8kA universal database gateway MCP server that enables AI assistants to connect to and query multiple databases (PostgreSQL, MySQL, MariaDB, SQL Server, SQLite) with support for schema exploration, SQL execution, and secure connections via SSH tunnels.
Tabularis
★ 2.1kA lightweight, cross-platform database client for developers. Supports MySQL, PostgreSQL and SQLite. Hackable with plugins. Built for speed, security, and aesthetics.
Postgres AI Guide
★ 1.7kMCP server and Claude plugin for Postgres skills and documentation. Helps AI coding tools generate better PostgreSQL code.
Anyquery
★ 1.7k🏎️ 🏠 ☁️ - Query more than 40 apps with one binary using SQL. It can also connect to your PostgreSQL, MySQL, or SQLite compatible database. Local-first and private by design.
Browse More Databases MCP Servers
Explore all databases servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Alibaba PolarDB in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Alibaba PolarDB?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.