crystaldba/postgres-mcp

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

What it solves

Postgres MCP Pro provides AI agents with the tools necessary to manage, optimize, and maintain PostgreSQL databases throughout the development lifecycle. It moves beyond simple query execution by providing deterministic tools for database health checks, index tuning, and performance analysis, reducing the reliance on non-deterministic LLM guesses for database administration.

How it works

It is implemented as a Model Context Protocol (MCP) server that integrates with AI assistants (like Claude Desktop, Cursor, or Windsurf). The server exposes a set of specialized tools that the agent can call to interact with the database. It leverages classical optimization algorithms—such as a version of the Anytime Algorithm for index tuning—and PostgreSQL extensions like pg_stat_statements for workload analysis and hypopg for simulating the impact of hypothetical indexes without actually creating them.

Who it’s for

  • Developers who want AI agents to help them fix slow ORM queries and optimize database performance.
  • Database Administrators (DBAs) looking to integrate AI-driven automation into production tuning and maintenance.
  • AI Agent builders who need a reliable, safe way to connect LLMs to PostgreSQL databases.

Highlights

  • Index Tuning: Uses industrial-strength algorithms to explore thousands of possible indexes and recommend the best ones.
  • Database Health: Performs deterministic checks on buffer cache, connection utilization, vacuum health, and replication lag.
  • Query Plan Analysis: Reviews EXPLAIN plans and simulates performance improvements using hypothetical indexes.
  • Safe SQL Execution: Offers configurable access modes (Unrestricted for development and Restricted for read-only production use).
  • Schema Intelligence: Provides context-aware SQL generation based on a deep understanding of the database schema.

Related

  • Project
  • Project
  • Project
  • Project
  • Project