dotsagent.io
语言:简体中文
数据 · Crystal DBA

配置 Postgres MCP Pro

提供 Postgres 查询、架构检查、索引调优和健康检查,替代已归档的参考服务器。

发布者
Crystal DBA 社区
本地运行
uvx postgres-mcp --access-mode=restricted
传输方式
stdio, sse
身份验证
通过 DATABASE_URI 设置的 Postgres 连接字符串。
环境变量
DATABASE_URI
可访问内容
受限模式为只读;不受限模式可读写。
许可证
MIT
源码
github.com/crystaldba/postgres-mcp
状态
活跃

安装

此服务器会在你的本机上作为客户端的子进程运行。你需要安装其命令所用的运行时,例如 npx 需要 Node.js、uvx 需要 uv,或者使用 Docker;还需要设置 Environment 下列出的变量。

Claude Code

shell
claude mcp add --scope project --env DATABASE_URI='<DATABASE_URI>' postgres-mcp-pro -- uvx postgres-mcp --access-mode=restricted

Cursor

.cursor/mcp.json
{
  "mcpServers": {
    "postgres-mcp-pro": {
      "command": "uvx",
      "args": [
        "postgres-mcp",
        "--access-mode=restricted"
      ],
      "env": {
        "DATABASE_URI": "${env:DATABASE_URI}"
      }
    }
  }
}

Codex

~/.codex/config.toml
[mcp_servers.postgres-mcp-pro]
command = "uvx"
args = ["postgres-mcp", "--access-mode=restricted"]
env_vars = ["DATABASE_URI"]

其他客户端的配置 →

对于任何重要数据库,请保留 --access-mode=restricted;不受限模式允许 agent 写入。

数据 中的其他服务器

来源

  1. github.com/crystaldba/postgres-mcp

为 AI agent 开发者提供的独立参考资料。与此处提及的任何厂商均无关联。

© 2026 DotsAgent · 事实核查日期:2026年10月1日