MCP ExplorerExplorer

Alibabacloud Adbpg Mcp Server

@aliyunon a year ago
4 Apache-2.0
FreeCommunity
AI Systems

Overview

What is Alibabacloud Adbpg Mcp Server

The AnalyticDB PostgreSQL MCP Server is a middleware that facilitates communication between AI agents and AnalyticDB PostgreSQL databases. It allows AI agents to retrieve metadata and execute SQL operations seamlessly.

Use cases

The server can be used in various scenarios including data analysis, reporting, real-time data retrieval, and executing complex SQL queries from AI-driven applications. It supports operations like SELECT, DML, and DDL on databases.

How to use

Users can set up the server in two modes: by downloading from GitHub or using pip for installation. Configuration involves adding details to the MCP client configuration file, including database connection parameters and specifying the command to run the server.

Key features

Key features include support for executing SELECT, DML, and DDL SQL queries, gathering table statistics, obtaining query execution plans, and accessing database schemas and tables through built-in resources and resource templates.

Where to use

The MCP Server is best utilized in environments where AI applications need to interact with PostgreSQL databases, such as in analytics platforms, business intelligence tools, and AI-based data processing systems.

Content

AnalyticDB PostgreSQL MCP Server

AnalyticDB PostgreSQL MCP Server serves as a universal interface between AI Agents and AnalyticDB PostgreSQL databases. It enables seamless communication between AI Agents and AnalyticDB PostgreSQL, helping AI Agents retrieve database metadata and execute SQL operations.

Configuration

Mode 1: Download

Download from Github

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

MCP Integration

Add the following configuration to the MCP client configuration file:

Mode 2: Using pip

pip install adbpg_mcp_server

MCP Integration

Components

Tools

  • execute_select_sql: Execute SELECT SQL queries on the AnalyticDB PostgreSQL server
  • execute_dml_sql: Execute DML (INSERT, UPDATE, DELETE) SQL queries on the AnalyticDB PostgreSQL server
  • execute_ddl_sql: Execute DDL (CREATE, ALTER, DROP) SQL queries on the AnalyticDB PostgreSQL server
  • analyze_table: Collect table statistics
  • explain_query: Get query execution plan

Resources

Built-in Resources

  • adbpg:///schemas: Get all schemas in the database

Resource Templates

  • adbpg:///{schema}/tables: List all tables in a specific schema
  • adbpg:///{schema}/{table}/ddl: Get table DDL
  • adbpg:///{schema}/{table}/statistics: Show table statistics

Environment Variables

MCP Server requires the following environment variables to connect to AnalyticDB PostgreSQL instance:

  • ADBPG_HOST: Database host address
  • ADBPG_PORT: Database port
  • ADBPG_USER: Database username
  • ADBPG_PASSWORD: Database password
  • ADBPG_DATABASE: Database name

Dependencies

  • Python 3.10 or higher
  • Required packages:
    • mcp >= 1.4.0
    • psycopg >= 3.1.0
    • python-dotenv >= 1.0.0
    • pydantic >= 2.0.0

Running

# Create and activate virtual environment
uv venv .venv
source .venv/bin/activate  # Linux/Mac
# or
.venv\Scripts\activate     # Windows

# Install dependencies
uv pip install -e .

# Run server
uv run adbpg-mcp-server

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers