crystaldba avatar

Postgres MCP Pro

crystaldba/postgres-mcp

Postgres MCP Pro is a Model Context Protocol server that enables AI agents and developers to interact with PostgreSQL databases throughout the entire development lifecycle. It provides tools for database health analysis, index tuning using industrial-strength algorithms, query plan optimization with EXPLAIN support, schema-aware SQL generation, and safe SQL execution with configurable access controls for both development and production environments. The server solves the problem of integrating comprehensive database optimization and management capabilities into AI-assisted development workflows, supporting both stdio and SSE transports.

GitHub stars
2.8K
tools
9
last updated
Mar 9, 2026

Tools

9 tools

Public tool metadata for what this MCP can expose to an agent.

list_schemasLists all database schemas available in the PostgreSQL instance.

Lists all database schemas available in the PostgreSQL instance.

No parameter schema in public metadata yet.

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

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

No parameter schema in public metadata yet.

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

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

No parameter schema in public metadata yet.

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

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

No parameter schema in public metadata yet.

explain_queryGets 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.

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.

No parameter schema in public metadata yet.

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

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

No parameter schema in public metadata yet.

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

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

No parameter schema in public metadata yet.

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

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

No parameter schema in public metadata yet.

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

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

No parameter schema in public metadata yet.

Sponsors

Readme

Postgres MCP Pro Logo

License: MIT PyPI - Version Discord Twitter Follow Contributors

A Postgres MCP server with index tuning, explain plans, health checks, and safe sql execution.

Overview


View the full README on GitHub

Details

Repository
github.com/crystaldba/postgres-mcp
Category
Databases

Related Databases MCP servers

View all
1designcomputer avatarMySQLdesigncomputer/mysql_mcp_serverA Model Context Protocol (MCP) server that enables secure interaction with MySQL databases1.3Kstars
2clickhouse avatarClickHouseclickhouse/mcp-clickhouseOfficial ClickHouse MCP server for querying and exploring ClickHouse clusters and chDB.903stars
3alexander-zuev avatarSupabasealexander-zuev/supabase-mcp-serverQuery MCP enables end-to-end management of Supabase via chat interface: read & write query executions, management API support, automatic migration versioning, a821stars
4timescale avatarTiger MCPtimescale/tiger-cliProvides programmatic access to Tiger Cloud services, databases, and documentation.127stars
5wgong avatarWgong Sqlite Mcp Serverwgong/sqlite-mcp-serverExplore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…1stars
6rosch100 avatarMcp Encrypted Sqliterosch100/mcp-encrypted-sqliteMCP server for encrypted SQLite databases (SQLCipher 4) - Works with MoneyMoney, KeePass and more0stars