1 v0.1.3 更新于 2026-11-03

Postgres (read-only transactions) MCP Server

Drop-in replacement for @modelcontextprotocol/server-postgres that is actually read-only.

适用客户端

本地客户端
Claude Desktop、Claude Code、Cursor、Cline 等支持本地 MCP 的客户端

安装配置

本地运行(npm)
{
  "mcpServers": {
    "postgres-mcp-safe": {
      "command": "npx",
      "args": [
        "-y",
        "postgres-mcp-safe"
      ]
    }
  }
}
本地运行(docker)
{
  "mcpServers": {
    "postgres-mcp-safe": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/poudel0/postgres-mcp-safe:0.1.3"
      ]
    }
  }
}

将上方 JSON 加入 MCP 客户端配置(如 Claude Desktop 的 claude_desktop_config.json 或项目的 .mcp.json)即可接入;远程接入按客户端要求填写 URL 与鉴权头。

提供的工具 接入后 Agent 可调用这 4 个工具

query
执行一条只读 SQL 语句,返回 JSON 数组形式的行结果。
list_tables
列出指定 schema(可选)中的表和视图及其模式与类型。
describe_table
查看某张表的列、约束和索引详情。
explain
显示查询的执行计划,analyze 选项需开启 --allow-explain-analyze。