PostgreSQL MCP Server
PostgreSQL database health, index tuning, and schema analysis for AI agents.
Data last scanned last week · Reviewed last month
Overview
Postgres MCP Pro facilitates database management by providing AI agents with deep insights into PostgreSQL internals. The server assists with performance optimization by offering index tuning recommendations, analyzing EXPLAIN plans, and simulating the impact of hypothetical schema changes on query performance. Beyond performance tuning, the tool provides health monitoring for production environments, including metrics for replication lag, vacuum health, and sequence limits. It supports both stdio and SSE transport protocols, allowing for flexible integration across various development and deployment workflows.
Our verdict
With a security score of 44/100, this server is classified as high risk. The rating reflects that it is community-maintained rather than vendor-official and its authentication, read-only mode, and OAuth implementations remain unreviewed. Users should exercise caution and ensure they have validated the tool's access controls before deploying it in sensitive database environments.
- Analyzes index health and database replication lag
- Provides context-aware SQL generation based on schema
- Zero direct dependencies minimize supply chain surface area
- Supports both stdio and SSE transport protocols
- Community-maintained status lacks formal vendor verification
- Authentication and read-only modes are currently unreviewed
- Repository has not received commits in over 180 days
Tools
| Tool | Description | Risk |
|---|---|---|
| list_schemas | Lists all database schemas available in the PostgreSQL instance. | low |
| list_objects | Lists database objects (tables, views, sequences, extensions) within a specified schema. | low |
| get_object_details | Provides information about a specific database object, for example, a table's columns, constraints, and indexes. | low |
| execute_sql | Executes SQL statements on the database, with read-only limitations when connected in restricted mode. | high |
| 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. | low |
| get_top_queries | Reports the slowest SQL queries based on total execution time using pg_stat_statements data. | low |
| analyze_workload_indexes | Analyzes the database workload to identify resource-intensive queries, then recommends optimal indexes for them. | low |
| analyze_query_indexes | Analyzes a list of specific SQL queries (up to 10) and recommends optimal indexes for them. | low |
| 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. | low |
| analyze_query_workload | Analyzes slow queries in the workload based on execution count and mean execution time to identify index tuning targets. | low |
Compatibility
| Client | Local | Docker | Remote | Read-only |
|---|---|---|---|---|
| ChatGPT | ||||
| Claude Desktop | ||||
| Cursor | ||||
| VS Code | ||||
| Windsurf |
Frequently asked questions
›What are the environment prerequisites for running the Postgres MCP server?
You need valid database access credentials and either Docker or Python 3.12 or higher installed on your system.
›Does the server support different transport methods?
Yes, it supports both Standard Input/Output (stdio) and Server-Sent Events (SSE) transports for flexible deployment.
›How can I restrict SQL execution capabilities?
The server includes configurable access control, which allows you to enable read-only mode and use safe SQL parsing for production environments.
›Are there specific requirements for using the Docker installation method?
The server automatically handles hostname remapping for 'localhost' to work from inside the container, supporting host.docker.internal on MacOS and Windows, or the appropriate host address on Linux.
Alternatives
Changelog
- NewPostgreSQL MCP v0.3.0
2025-05-16
- NewPostgreSQL MCP v0.2.1
2025-04-17
- ImprovedPostgreSQL MCP v0.2.0
2025-04-16
- ImprovedPostgreSQL MCP v0.1.1
2025-04-08
Badge
Maintain this server? Add the live badge to your README.