Back to MCP directory
publicPublicdnsLocal runtime

postgres-mcp

Postgres MCP Pro 是一个开源 MCP 服务器,为 AI 代理提供数据库索引调优、执行计划分析、健康检查和安全 SQL 执行等全方位支持。

article

README

🚀 Postgres MCP Pro 开发指南

本指南为希望参与 Postgres MCP Pro 开发,或选择从源代码安装 Postgres MCP Pro 的用户提供详细说明。

🚀 快速开始

📦 安装指南

本地开发环境搭建

  1. 安装 uv
curl -sSL https://astral.sh/uv/install.sh | sh
  1. 克隆仓库
git clone https://github.com/crystaldba/postgres-mcp.git
cd postgres-mcp
  1. 安装依赖项
uv pip install -e .
uv sync
  1. 运行服务器
uv run postgres-mcp "postgres://user:password@localhost:5432/dbname"
READY-TO-PASTE CONFIG

MCP client config generator

Choose your client, fill the required environment variables, then copy a config generated from this server's published metadata

terminal
Environment variableslockValues stay in this browser tab and are not uploaded or saved
Claude Desktop
{
  "mcpServers": {
    "postgres": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "DATABASE_URI",
        "crystaldba/postgres-mcp",
        "--access-mode=unrestricted"
      ],
      "env": {
        "DATABASE_URI": "postgresql://username:password@localhost:5432/dbname"
      }
    }
  }
}
Save toclaude_desktop_config.json
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client