AnalyticDB PostgreSQL MCP Server

# AnalyticDB PostgreSQL MCP Server AnalyticDB PostgreSQL MCP Server serves as a universal interface between AI Agents and AnalyticDB PostgreSQL

Local serverstdioPython

What is the AnalyticDB PostgreSQL MCP server?

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. That is what the analyticdb postgresql mcp server brings to an AI assistant: the same capability, reachable through the Model Context Protocol rather than a separate app or dashboard.

The tools it exposes

The server publishes 14 tools. What each one is for:

  • 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
  • adbpg_graphrag_uploadDescription: Upload a text file (with its name) and file content to graphrag to generate a knowledge graph
  • Parameters — **
  • adbpg_graphrag_queryDescription: Query the graphrag using the specified query string and mode。
  • Description — ** Upload a decision tree with the specified root_node. If the root_node does not exist, a new decision tree will be created
  • adbpg_llm_memory_addDescription: Add LLM long memory
  • adbpg_llm_memory_get_allDescription: Retrieves all memory records associated with a specific user, run or agent
  • adbpg_llm_memory_searchDescription: Retrieves memories relevant to the given query for a specific user, run, or agent

Getting it running

The server ships on PyPI as adbpg-mcp-server, so your MCP client can launch it on demand — there is no separate build step. Add the server block to your client's configuration, restart it, and the tools register themselves.

What it needs from you

Configuration is passed through the environment: ADBPG_HOST, ADBPG_PORT, ADBPG_USER, ADBPG_PASSWORD, ADBPG_DATABASE, GRAPHRAG_API_KEY, GRAPHRAG_BASE_URL, GRAPHRAG_LLM_MODEL. Treat anything key-shaped as a real credential — scope it to the minimum the server needs, and rotate it if it ever lands in a shared config.

How it compares

Among the AI and media services options, the useful question is rarely "what can it do" but "what does it cost you to run" — permissions, credentials, and how much of your context its toolset consumes. AnalyticDB PostgreSQL's toolset — execute_select_sql, execute_dml_sql, execute_ddl_sql and 11 more — is a fair guide to whether it matches your workflow. It is maintained by aliyun; worth a glance at recent repository activity before you build anything load-bearing on it.

This entry was verified against AnalyticDB PostgreSQL's own documentation before publication; SyncDev keeps the directory reviewed rather than auto-generated.

Things to watch

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • With 14 tools registered it takes up a noticeable share of the context window; turn it off in projects that never touch AnalyticDB PostgreSQL.
  • Missing credentials fail quietly in some clients — if no tools show up, check the environment block first.
  • Keep per-call confirmation enabled while you learn its behaviour; it is the cheapest safeguard you have.

Available tools

ToolWhat it does
execute_select_sqlExecute SELECT SQL queries on the AnalyticDB PostgreSQL server
execute_dml_sqlExecute DML (INSERT, UPDATE, DELETE) SQL queries on the AnalyticDB PostgreSQL server
execute_ddl_sqlExecute DDL (CREATE, ALTER, DROP) SQL queries on the AnalyticDB PostgreSQL server
analyze_tableCollect table statistics
explain_queryGet query execution plan
adbpg_graphrag_upload**Description:** Upload a text file (with its name) and file content to graphrag to generate a knowledge graph.
Parameters**
adbpg_graphrag_query**Description:** Query the graphrag using the specified query string and mode。
Description** Upload a decision tree with the specified root_node. If the root_node does not exist, a new decision tree will be created.
adbpg_llm_memory_add**Description:** Add LLM long memory.
adbpg_llm_memory_get_all**Description:** Retrieves all memory records associated with a specific user, run or agent.
adbpg_llm_memory_search**Description:** Retrieves memories relevant to the given query for a specific user, run, or agent.
adbpg_llm_memory_delete_all- **Description:** Delete all memory records associated with a specific user, run or agent.
ToolsThe Tools tool exposed by this server.

How to install the AnalyticDB PostgreSQL MCP server

{
  "mcpServers": {
    "alibabacloud-adbpg": {
      "command": "uvx",
      "args": ["adbpg-mcp-server"],
      "env": {
        "ADBPG_HOST": "your-value",
        "ADBPG_PORT": "your-value",
        "ADBPG_USER": "your-value",
        "ADBPG_PASSWORD": "your-value",
        "ADBPG_DATABASE": "your-value",
        "GRAPHRAG_API_KEY": "your-value",
        "GRAPHRAG_BASE_URL": "your-value",
        "GRAPHRAG_LLM_MODEL": "your-value"
      }
    }
  }
}

Add to claude_desktop_config.json, then restart Claude Desktop.

Configuration

VariableDescriptionRequired
ADBPG_HOSTEndpoint or connection string the server talks to.Optional
ADBPG_PORTConfiguration value read at startup.Optional
ADBPG_USERConfiguration value read at startup.Optional
ADBPG_PASSWORDConfiguration value read at startup.Optional
ADBPG_DATABASEConfiguration value read at startup.Optional
GRAPHRAG_API_KEYCredential the server authenticates with.Yes
GRAPHRAG_BASE_URLEndpoint or connection string the server talks to.Yes
GRAPHRAG_LLM_MODELConfiguration value read at startup.Optional

Example prompts to try

  • Use AnalyticDB PostgreSQL to execute select sql.
  • Use AnalyticDB PostgreSQL to execute dml sql.
  • Use AnalyticDB PostgreSQL to execute ddl sql.

Frequently asked questions

Python 3.11 or higher and the `uv` package manager for environment and package management.