Vibeleaderboard
Index / tool
Visit github.com
Category
Developer Tools
Rank
No. 441Tools index
Pricing
Open Source
Platform
cli
Type
TOOL
Builder
crystaldba
Latest release
v0.3.0
Added
Jul 2, 2026

About

Postgres MCP Pro is an open-source Model Context Protocol (MCP) server that gives AI agents and developers powerful access to PostgreSQL databases. It provides index tuning, query explain plans, database health checks, schema intelligence, and configurable safe SQL execution for both development and production environments.

What it does

It turns conversational database work into controlled PostgreSQL operations. An MCP client can inspect schemas, run queries, diagnose operational health, compare execution plans, and test proposed indexes before creating them. It runs locally through standard input and output, or as a shared server over Server-Sent Events.

Why it's ranked here

This is a serious database assistant rather than a thin query bridge. It combines schema inspection, workload analysis, plan interpretation, and hypothetical index evaluation behind one MCP connection. Restricted access and parsed SQL improve its production story, although the documented resource guardrail currently covers execution time only.

What's good

Index advice is tested against PostgreSQL’s planner using hypothetical indexes, so recommendations can reflect estimated plan changes without immediately altering the schema. Health coverage spans connections, caching, vacuum state, sequences, replication, and indexes. Docker and Python installation paths support several popular MCP clients, while shared-server transport accommodates multiple clients.

Tradeoffs

The strongest tuning features require PostgreSQL statistics and hypothetical-index extensions, which may need database privileges or system installation. Python users need version 3.12 or newer. Restricted mode uses read-only transactions and safe parsing, but its documented resource constraint is presently limited to execution time. Unrestricted mode permits data and schema changes.

How to use it well

Use it with an AI coding assistant when investigating slow PostgreSQL applications, validating query plans, or preparing evidence-backed index changes. Start with restricted access against production and reserve unrestricted access for development. It is PostgreSQL-specific, so it does not replace a general data platform or cover other database engines.

Technical notes+

pyproject.toml defines a Python 3.12 package built with Hatchling and exposes the postgres-mcp CLI entry point. src/postgres_mcp/server.py builds the MCP service with FastMCP, selects unrestricted SqlDriver or restricted SafeSqlDriver, and registers database tools. src/postgres_mcp/sql/safe_sql.py parses statements with pglast, applies statement and function allowlists, and wraps execution with safety checks. src/postgres_mcp/sql/sql_driver.py uses psycopg’s asynchronous connection pool with one to five connections and supports forced read-only transactions. src/postgres_mcp/index/dta_calc.py generates candidate column combinations, evaluates them through HypoPG, considers index size, and performs a time-bounded greedy search. src/postgres_mcp/index/llm_opt.py also contains an OpenAI-backed optimizer that requests index alternatives and scores them against hypothetical planner costs and estimated storage.

Observed

License
MIT
Primary language
Python
Runtime requirement
Python 3.12 or newer
Packaging
PyPI package, pipx and uv installation, plus a Docker image
Interfaces
MCP tools through stdio or Server-Sent Events, with a command-line entry point
Platform support
Documented configuration for macOS, Windows, and Linux
Optional database extensions
PostgreSQL statistics and HypoPG extensions enable workload analysis and hypothetical-index tuning

Read from README.md, pyproject.toml, src/postgres_mcp/server.py, src/postgres_mcp/__init__.py, src/postgres_mcp/artifacts.py, src/postgres_mcp/sql/index.py, src/postgres_mcp/sql/__init__.py, src/postgres_mcp/sql/safe_sql.py, src/postgres_mcp/index/llm_opt.py, src/postgres_mcp/index/dta_calc.py, src/postgres_mcp/sql/sql_driver.py, src/postgres_mcp/sql/bind_params.py.

What it can do

  • Analyze query execution plans

    SQL query stringDetailed explain plan with cost estimates, execution steps, and bottleneck identification

  • Recommend index optimizations

    PostgreSQL database schema and query workloadSuggested indexes to create or drop for improved query performance

  • Run database health checks

    PostgreSQL database connectionHealth report covering bloat, replication lag, cache hit rates, and other diagnostics

  • Introspect database schema

    PostgreSQL database connectionStructured schema metadata including tables, columns, types, constraints, and relationships

  • Execute SQL queries with configurable access controls

    SQL statement and access mode configuration (read-only or read-write)Query results with safety guardrails enforced based on environment settings

  • Expose database capabilities to AI agents via MCP protocol

    AI agent MCP client requestStructured database responses consumable by AI agents over stdio or SSE transport

Tags

postgresmcpdatabaseai agentsindex tuningsqlperformancepostgresql

Tech Stack

PythonDocker

Comments (0)

No comments yet

Indexed by a proprietary survey. Corrections welcome.