Skip to main content
📖 The AI Tool Bible
Postgres MCP Pro logo

Postgres MCP Pro

Not yet source-checked

Open-source Postgres MCP server with deterministic health checks, index tuning, and safe SQL execution.

Machine-drafted from the vendor's site · not yet source-checkedProfile updated Link checked How we rate

Free· Free and open source (MIT license). No paid tiers.MCP ServersModel-agnostic (works with any MCP-capable LLM); optional OpenAI models for experimental LLM-based index tuning

In short

Postgres MCP Pro provides AI coding assistants with a safe, deterministic interface to PostgreSQL databases. It specializes in algorithmic index tuning using hypopg and comprehensive health checks, making it ideal for backend developers and DBAs seeking reproducible performance insights.

Best for

Backend developers and DBAs who want an AI assistant that can safely explore, explain, and tune a real Postgres database in development or production with reproducible, algorithmic index recommendations.

Skip if

Teams on non-Postgres databases, users who need fine-grained row/column ACLs, or anyone wanting a hosted GUI dashboard rather than an MCP server wired into an AI IDE.

Postgres MCP Pro is an open-source Model Context Protocol (MCP) server from Crystal DBA that gives AI coding assistants like Claude Desktop, Cursor, Windsurf, Cline, Goose, and Qodo Gen a rich, opinionated interface into a PostgreSQL database. Instead of merely wrapping a connection and letting the LLM improvise, it exposes a set of deterministic tools for schema exploration, query execution, EXPLAIN plans, workload analysis, and comprehensive database health checks (index health, buffer cache hit rate, connection utilization, vacuum/transaction-id wraparound risk, replication lag, invalid constraints, sequence limits). Its standout feature is principled index tuning: it enumerates candidate multi-column indexes, uses the hypopg extension to simulate their effect on real query plans, and runs a greedy Anytime-style search adapted from Microsoft's SQL Server Tuning Advisor to recommend a Pareto-optimal set of indexes given a storage budget. An experimental Optimization-by-LLM mode can substitute the search heuristic with an iterative LLM proposer (requires OPENAI_API_KEY). Safe SQL execution is enforced by parsing statements with pglast and running them inside read-only transactions in restricted mode, blocking COMMIT/ROLLBACK escape hatches. It ships as a Docker image or PyPI package, speaks both stdio and SSE transports, uses psycopg3 under the hood, and works against Postgres 13-17 including RDS, Azure, and Cloud SQL where pg_stat_statements and hypopg can be enabled. Ideal for developers who want their AI agent to genuinely reason about performance rather than guess.

Editor's take

This is the Postgres MCP server I would actually trust to touch a production database. The combination of pglast-guarded read-only transactions and hypopg-backed index simulation puts it in a different league from the reference server that just executes whatever SQL the model emits. The experimental LLM tuner is a nice bonus, but the classical Anytime search is the real value.

— The AI Tool Bible editorial team

Pros

  • ✅ Deterministic index tuning based on the Anytime Algorithm plus hypopg what-if simulation, not LLM guesswork
  • ✅ Comprehensive PgHero-derived health checks covering bloat, cache, connections, vacuum, replication, and sequences
  • ✅ Restricted mode enforces read-only transactions and blocks COMMIT/ROLLBACK escapes via pglast SQL parsing
  • ✅ Works with any MCP client (Claude Desktop, Cursor, Windsurf, Cline, Goose, Qodo Gen) and supports both stdio and SSE transports
  • ✅ MIT-licensed and free; installs via Docker, pipx, uvx, or uv with clear per-client config recipes
  • ✅ Cost-benefit index selection along the Pareto front with configurable performance-vs-storage threshold
  • ✅ Actively maintained by Crystal DBA with Discord community and public roadmap on GitHub

Cons

  • ⚠️ Postgres-only; no MySQL, SQL Server, or other database support
  • ⚠️ Full-featured tuning requires pg_stat_statements and hypopg extensions, which self-managed installs may need to install manually
  • ⚠️ Only two coarse access modes (unrestricted vs restricted) with no per-table or column-level ACLs
  • ⚠️ Credentials are supplied at startup via DATABASE_URI, so switching databases means restarting the server
  • ⚠️ Experimental LLM-based index tuning requires an OpenAI API key and adds external cost/latency
  • ⚠️ Workload compression is basic (query normalization, equal weighting), which can misrank importance in complex workloads

Facts

API available
Yes
Open source
Yes (license: MIT)
GitHub stars
3,437 (checked Oct 29, 2026)
Last GitHub push
Aug 17, 2026
First commit
Mar 2025
Model used
Model-agnostic (works with any MCP-capable LLM); optional OpenAI models for experimental LLM-based index tuning
Package downloads (30 d)
529,340 · pypi postgres-mcp · checked Oct 18, 2026

Where this tool sits

Use cases

AI-assisted query optimization in Cursor or Claude DesktopAutomated index recommendations for slow workloadsEXPLAIN plan review with hypothetical indexesProduction database health monitoring via LLM chatDetecting bloated, duplicate, or unused indexesVacuum and transaction-id wraparound risk auditsSafe read-only SQL exploration by AI agentsSchema introspection for LLM SQL generationShared team Postgres MCP endpoint over SSE

Frequently asked

How does Postgres MCP Pro ensure safe SQL execution?
It parses statements with pglast and runs them inside read-only transactions in restricted mode. This configuration blocks COMMIT and ROLLBACK escape hatches to prevent unintended data modifications.
What makes its index tuning feature distinct from standard LLM guesses?
It uses the hypopg extension to simulate index effects on real query plans and runs a greedy Anytime-style search. This approach recommends a Pareto-optimal set of indexes based on a specific storage budget rather than relying on probabilistic model outputs.
Which AI clients and database versions are supported?
The server works with MCP clients like Claude Desktop, Cursor, Windsurf, Cline, Goose, and Qodo Gen. It supports PostgreSQL versions 13 through 17, including instances on RDS, Azure, and Cloud SQL.
Is Postgres MCP Pro free to use?
Yes, it is free and open source under the MIT license with no paid tiers. It can be installed via Docker, PyPI, pipx, uvx, or uv.
What are the limitations regarding database support and access control?
The tool is exclusively for PostgreSQL and does not support MySQL or SQL Server. It offers only two coarse access modes (unrestricted vs. restricted) and lacks fine-grained row or column-level ACLs.
See alternatives to Postgres MCP Pro →

Explore related

Reviews