# Postgres MCP Pro — HypoPG 指数调整、EXPLAIN 计划和健康审计 (`postgres-mcp-pro`)

> 生产 PostgreSQL MCP 服务器通过 uvx 运行，具有受限只读模式、工作负载索引顾问、HypoPG 虚拟索引和 pg_stat_statements 分析。

- **Canonical URL:** https://syndipath.com/zh/mcp/postgres-mcp-pro
- **Runtime:** `pypi` | **Transport:** STDIO | **License:** MIT | **Package:** `postgres-mcp`
- **Upvotes:** 913 | **GitHub Stars:** 7420 | **Weekly Installs:** 54800
- **Security Note:** HTTP-200 在 PyPI (postgres-mcp) 上验证；在隔离的 Astral uvx 临时虚拟环境中运行。

## Quick CLI Setup
```bash
# Run isolated Python tool via Astral uvx
uvx postgres-mcp --access-mode=restricted

# Alternative: run via pipx
pipx run postgres-mcp --access-mode=restricted

# Add to Claude Code CLI
claude mcp add -e DATABASE_URI=${DATABASE_URI} postgres-mcp-pro -- uvx postgres-mcp --access-mode=restricted
```

## MCP Manifest (`mcp.json`)
```json
{
  "mcpServers": {
    "postgres-mcp-pro": {
      "command": "uvx",
      "args": [
        "postgres-mcp",
        "--access-mode=restricted"
      ],
      "env": {
        "DATABASE_URI": "${DATABASE_URI}"
      }
    }
  }
}
```

## Exposed MCP Tools
- `postgres_mcp_pro_query(sql_or_filter: string, limit?: number)`: Production PostgreSQL MCP server running via uvx with restricted read-only mode, workload index advisor, HypoPG virtual indexes, and pg.
- `postgres_mcp_pro_inspect_schema(namespace?: string)`: Enumerates tables, collections, column types, and active index definitions.
