Postgres MCP Pro - 数据库性能优化工具

Postgres MCP Pro - 数据库性能优化工具

提供可配置的读写访问和性能分析,支持 AI 代理的 Postgres 工具。

快速入门

前置条件

  1. 确保拥有数据库访问凭据。
  2. 安装 Docker 或 Python 3.12+。

安装方法

  • Docker: 拉取镜像 docker pull crystaldba/postgres-mcp
  • Python: 使用 pipx 安装 pipx install postgres-mcp

配置 AI 助手

编辑助手配置文件,添加以下内容:

{
  "mcpServers": {
    "postgres": {
      "command": "postgres-mcp",
      "args": ["--access-mode=unrestricted"],
      "env": {
        "DATABASE_URI": "postgresql://username:password@localhost:5432/dbname"
      }
    }
  }
}

DATABASE_URI 替换为实际数据库连接 URI。

启动服务器

使用命令 uv run postgres-mcp "postgresql://username:password@localhost:5432/dbname" 启动服务。