← Back to directory
P

Postgres MCP Pro

Community
Configurable read/write access and performance analysis for PostgreSQL MCP
Category
Database #43 of 58
Stars
★ 3.4k Popular
Transport
stdio (local process) · SSE
Runtime
Docker · Python 3.12+
Credentials
Optional API key
License
MIT
Last commit
Tools
9
48FMRS · D

Postgres MCP Pro is a feature-rich PostgreSQL MCP server offering health checks, index tuning, and safe SQL execution. Its use of classic optimization algorithms rather than relying solely on LLMs enhances reliability. Suitable for teams aiming to boost database performance and AI-assisted development.

Strongest · Setup experience 11/20 Weakest · Security and permissions 7/20

Reliability
9/20
Security and permissions
7/20
Maintenance
10/20
Documentation
11/20
Setup experience
11/20
Why each score
Reliability 9/20
Evidence: README describes clear functionality, active repo with commits, but no actual code inspection, no tests or CI visible. Therefore reliability can only be inferred, cannot confirm startup and handshake. Deduction: no execution, thin testing/edge case handling.
Security and permissions 7/20
Evidence: README mentions two access modes (restricted/unrestricted), restricted uses read-only transactions and SQL parsing to prevent writes. But no code to confirm these protections. Deduction: unverified code, lack of explicit confirmation for dangerous ops and detailed permission scoping.
Maintenance 10/20
Evidence: MIT license, active GitHub repo, commits and issue responses. But no release cadence or dependency update details. Deduction: lack of explicit maintenance policy or security response channel.
Documentation 11/20
Evidence: README provides detailed install, config, usage instructions, examples for various clients, tool list, FAQ. But no layered docs or troubleshooting section. Deduction: missing parameter details, limits, cost info.
Setup experience 11/20
Evidence: Multiple install methods (Docker, pipx, uv) with client config examples, clear steps. But no automated tests or CI to verify install. Deduction: no verifiable install scripts or tests, platform compatibility not detailed.

Static review · not runListed 2026-08-07

Read the FMRS scoring method →

Fit and risk

What it can accessConnects to a database

Best for

  • PostgreSQL developers needing deep performance analysis and index tuning
  • DBAs who need read-only access and health checks in production
  • Teams that want AI assistants to help with database optimization and monitoring

Not for

  • Users needing full write access but wanting safety controls (restricted mode is read-only)
  • Users of non-PostgreSQL databases
  • Users needing real-time monitoring or alerting (this tool is analytical)

Required permissions

  • Database connection credentials (connection URI)
  • Read-write or read-only database access (depending on access mode)
  • Optional: permission to load extensions (pg_stat_statements, hypopg)
  • Optional: OpenAI API key for experimental LLM index tuning

Risks and side effects

  • Unrestricted mode can allow SQL that might damage or delete data
  • SQL parsing may not prevent all bypasses of read-only restrictions if unsafe procedural languages are enabled
  • Connection credentials may be stored in plaintext in MCP client configuration
  • Index tuning search may consume significant database resources

Setup

Before you start

Runtime:Docker · Python 3.12+

DATABASE_URI requiredsecret Postgres connection URI in the form postgresql://username:password@localhost:5432/dbname, using your own database credentials; required.
OPENAI_API_KEY optionalsecret OpenAI API key, only needed for the experimental LLM-based index tuning feature; obtain it from platform.openai.com.
  1. Ensure you have database access credentials and verify them (e.g., using psql).
  2. Choose an installation method: Docker (docker pull crystaldba/postgres-mcp) or Python (via pipx or uv install postgres-mcp).
  3. Configure your MCP client (e.g., Claude Desktop) by editing its configuration file, adding an mcpServers entry with the DATABASE_URI environment variable and access mode (--access-mode=unrestricted or --access-mode=restricted).
  4. Optionally, enable required extensions (pg_stat_statements and hypopg) for index tuning and performance analysis.
claude_desktop_config.json
{
  "mcpServers": {
    "postgres": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "DATABASE_URI",
        "crystaldba/postgres-mcp",
        "--access-mode=unrestricted"
      ],
      "env": {
        "DATABASE_URI": "postgresql://username:password@localhost:5432/dbname"
      }
    }
  }
}

Shown for Claude Desktop. Other clients may use a different file or key (VS Code uses "servers") — the configurator below converts it.

.vscode/mcp.json
{
  "servers": {
    "postgres": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "DATABASE_URI",
        "crystaldba/postgres-mcp",
        "--access-mode=unrestricted"
      ],
      "env": {
        "DATABASE_URI": "postgresql://username:password@localhost:5432/dbname"
      }
    }
  }
}

Goes in your project's .vscode/mcp.json (VS Code uses a "servers" key).

Terminal
claude mcp add postgres -e DATABASE_URI=postgresql://username:password@localhost:5432/dbname -- docker run -i --rm -e DATABASE_URI crystaldba/postgres-mcp --access-mode=unrestricted

Run it in a terminal; replace any <…> placeholders with your own values first.

Check that it works

After startup, the client's tool list should show tools such as list_schemas, execute_sql, and analyze_db_health; asking "Check the health of my database and identify any issues" and getting buffer cache hit rate, connection, and index health results confirms the connection works.

Troubleshooting

  1. Ensure DATABASE_URI is correct and the database is reachable
  2. Check that required extensions (pg_stat_statements, hypopg) are installed
  3. If using Docker, verify port and network configuration
  4. Inspect server logs for error messages
  5. Try different access modes (unrestricted or restricted)

Things to try

Once connected, you can ask your AI assistant things like:

  • Check the health of my database and identify any issues.
  • What are the slowest queries in my database? And how can I speed them up?
  • Analyze my database workload and suggest indexes to improve performance.
  • Help me optimize this query: SELECT * FROM orders JOIN customers ON orders.customer_id = customers.id WHERE orders.created_at > '2023-01-01';

Tools 9

list_schemas read-only
List all database schemas available in the PostgreSQL instance.
list_objects read-only
List database objects (tables, views, sequences, extensions) within a specified schema.
get_object_details read-only
Provide information about a specific database object, such as columns, constraints, and indexes.
execute_sql destructive
Execute SQL statements on the database, with read-only limitations when connected in restricted mode.
explain_query read-only
Get the execution plan for a SQL query, showing how Postgres will process it. Can be used with hypothetical indexes to simulate behavior after adding indexes.
get_top_queries read-only
Report the slowest SQL queries based on total execution time using pg_stat_statements data.
analyze_workload_indexes read-only
Analyze the database workload to identify resource-intensive queries, then recommend optimal indexes.
analyze_query_indexes read-only
Analyze a list of specific SQL queries (up to 10) and recommend optimal indexes.
Show 1 more tools
analyze_db_health read-only
Perform comprehensive health checks including buffer cache hit rates, connection health, constraint validation, index health, sequence limits, and vacuum health.

Use cases

Check database health and identify issues
Analyze slow queries and get optimization suggestions
Get index recommendations for your workload
Optimize a specific query
Simulate the impact of adding indexes
Execute SQL safely in development environments

Supported clients

Claude Desktop
Cursor
Windsurf
Goose
Qodo Gen

Listed from the project's documentation, not tested by this site.

Overview

Postgres MCP Pro is an open-source Model Context Protocol (MCP) server that supports developers and AI agents across the entire development lifecycle, from initial coding to production tuning and maintenance. It offers database health checks, index tuning, query plan analysis, safe SQL execution, and more, with configurable access modes for development and production environments.

Similar servers

Source revision 15c8e3335354 Data synced 2026-10-12 Read the FMRS scoring method