🐘

PostgreSQL MCP Server

✓ 官方/认证

Anthropic (官方)

用自然语言查询 PostgreSQL 数据库,支持只读模式和完整 SQL 模式

10.1k
GitHub Stars
stdio
安装方式
MIT
开源协议
4
可用工具

📖 详细介绍

Anthropic 官方 PostgreSQL MCP Server,让 AI 助手直接执行 SQL 查询、获取表结构、解析数据。支持只读安全模式(推荐生产使用)和读写模式,提供连接池和 schema 反射。

核心特性

执行任意 SQL
只读安全模式
Schema 自省
查询计划分析
连接池支持

🛠️ 可用工具 (4)

query()
list_tables()
describe_table()
explain_query()

🎯 适用场景

自然语言查数据
生成报表
数据库 schema 探索
数据迁移辅助
BI 查询

⚙️ 安装与配置

系统要求

  • Python 3.10+
  • PostgreSQL 12+
  • 数据库连接字符串

安装命令

uvx mcp-server-postgres postgresql://user:pass@host:5432/db

Claude Desktop 配置 (claude_desktop_config.json)

{
  "mcpServers": {
    "postgres-mcp-server": {
      "command": "uvx",
      "args": [
        "mcp-server-postgres",
        "postgresql://user:pass@host:5432/db"
      ]
    }
  }
}

🔗 相关链接

🧩 相关 MCP Servers

浏览更多 数据库 MCP

PostgreSQL MCP Server数据库 分类下的 MCP server 之一