MCP.so
登录

Postgres Mcp

@crystaldba

关于 Postgres Mcp

Postgres MCP Pro provides configurable read/write access and performance analysis for you and your AI agents.

基本信息

分类

数据库

许可证

MIT

运行时

python

传输方式

stdio

发布者

crystaldba

配置

使用下面的配置,将此服务器添加到你的 MCP 客户端。

{
  "mcpServers": {
    "postgres-mcp": {
      "command": "docker",
      "args": [
        "pull",
        "crystaldba/postgres-mcp"
      ]
    }
  }
}

工具

未检测到工具

工具是从 README 中自动提取的。维护者可以在 ## Tools 标题下列出工具,即可填充这部分内容。

概览

What is Postgres Mcp?

Postgres Mcp is an open-source Model Context Protocol (MCP) server for PostgreSQL that provides database health analysis, index tuning, query plan explanations, schema intelligence, and safe SQL execution. It supports both stdio and SSE transports and is designed for developers and AI agents throughout the development lifecycle.

How to use Postgres Mcp?

Install Postgres Mcp via Docker (docker pull crystaldba/postgres-mcp) or Python (pipx install postgres-mcp or uv pip install postgres-mcp). Configure your MCP client (e.g., Claude Desktop, Cursor) by editing the mcpServers configuration with a DATABASE_URI and optionally the --access-mode flag (unrestricted or restricted). For full index tuning and performance analysis, optionally install the pg_stat_statements and hypopg Postgres extensions.

Key features of Postgres Mcp

  • Database health monitoring (index health, connections, buffer cache, replication lag, etc.)
  • Index tuning using workload analysis and industrial-strength algorithms
  • Query plan validation and hypothetical index simulation
  • Schema intelligence for context-aware SQL generation
  • Safe SQL execution with read-only and restricted access modes
  • Support for both stdio and SSE MCP transports

Use cases of Postgres Mcp

  • Analyze database health and identify degradation or risk areas
  • Find and fix slow queries with index recommendations
  • Optimize ORM-generated SQL for production performance
  • Generate and validate schema-aware SQL during development
  • Safely execute database operations with configurable access controls

FAQ from Postgres Mcp

How do I configure Postgres Mcp with Claude Desktop?

Edit the claude_desktop_config.json file, adding a mcpServers entry with the Docker command or Python runner, the --access-mode flag, and the DATABASE_URI environment variable.

What access modes are available?

Postgres Mcp supports unrestricted mode (full read/write access for development) and restricted mode (read-only transactions with execution time limits, suitable for production).

Do I need to install Postgres extensions?

Installing pg_stat_statements and hypopg is optional but recommended to enable index tuning and comprehensive performance analysis.

Does Postgres Mcp support SSE transport?

Yes. Use the --transport=sse option when starting the server, then configure your MCP client to connect via URL (e.g., http://localhost:8000/sse).

Is there a read-only mode?

Yes. Restricted mode limits operations to read-only transactions and enforces execution time limits, making it safe for production use.

评论

数据库 分类下的更多 MCP 服务器