MCP SERVER PROFILE · Database
Database

Postgres MCP Pro

Maintained PostgreSQL MCP server with schema inspection, restricted SQL queries, execution plans, indexing recommendations and database health diagnostics.

GitHub stars18400
Setup options1
Documented tools9
Maintained bycrystaldba

Overview

Postgres MCP Pro by CrystalDBA supports PostgreSQL schema inspection, SQL queries, execution plans, index analysis and health checks.

postgresqldatabasesqlperformanceindexinganalytics

Installation & configuration 1 documented option

Choose the configuration documented for your client. Replace placeholders with your own values, and review the maintainer documentation before connecting.

Postgres MCP Pro (restricted)

Claude Desktop

{
  "mcpServers": {
    "postgres": {
      "command": "uvx",
      "args": [
        "postgres-mcp",
        "--access-mode=restricted"
      ],
      "env": {
        "DATABASE_URI": "postgresql://username:password@localhost:5432/dbname"
      }
    }
  }
}

Restricted mode enforces read-only transactions; use a database role with read-only permissions. Not runtime-tested.

Read maintainer installation documentation ↗

Before you install

  • Python uv/uvx installed.
  • A reachable PostgreSQL database and connection URI.
  • A dedicated least-privilege read-only PostgreSQL account.

Documented tools 9

Capabilities provided in the listing metadata. Check upstream documentation for current availability and parameters.

list_schemas

Lists all database schemas available in the PostgreSQL instance.

list_objects

Lists database objects (tables, views, sequences, extensions) within a specified schema.

get_object_details

Provides information about a specific database object, for example, a table's columns, constraints, and indexes.

execute_sql

Executes SQL statements on the database, with read-only limitations when connected in restricted mode.

explain_query

Gets the execution plan for a SQL query describing how PostgreSQL will process it and exposing the query planner's cost model. Can be invoked with hypothetical indexes to simulate the behavior after adding indexes.

get_top_queries

Reports the slowest SQL queries based on total execution time using `pg_stat_statements` data.

analyze_workload_indexes

Analyzes the database workload to identify resource-intensive queries, then recommends optimal indexes for them.

analyze_query_indexes

Analyzes a list of specific SQL queries (up to 10) and recommends optimal indexes for them.

analyze_db_health

Performs comprehensive health checks including: buffer cache hit rates, connection health, constraint validation, index health (duplicate/unused/invalid), sequence limits, and vacuum health.

Listed on FreeMCP badge

Maintaining this MCP server? Add this optional badge to your GitHub README so visitors can find its FreeMCP listing. Listing is not a security certification or independent verification.

MCP — Listed on FreeMCP

[![Listed on FreeMCP](https://freemcp.in/badges/listed.svg)](https://freemcp.in/servers/postgres-mcp-pro)

Security & permissions

  • Use --access-mode=restricted for production; unrestricted mode permits writes.
  • Protect DATABASE_URI credentials and restrict network access.
  • Some diagnostics require PostgreSQL extensions or additional read privileges.

See the installation and security guide for a setup checklist.

Buy me a beer