A Model Context Protocol (MCP) server for PostgreSQL database analysis, query optimization, and health monitoring.
postgres-mcp has well-structured tool definitions with clear naming (verb_noun pattern) and comprehensive descriptions (avg 180 chars). All 9 tools have input schemas with typed parameters and descriptions. However, output schemas are not documented, LLMs cannot predict response structure for planning. Parameter descriptions lack format constraints (e.g., 'query' accepts any SQL but should clarify restrictions in restricted mode). Error handling is basic: tools return error strings but do not guide recovery or categorize errors as retryable/user-fixable. No tool annotations (readOnlyHint/destructiveHint) despite clear risk levels. Missing pagination guidance for list_* tools.
Run database health checks across one or more dimensions. Pass 'all' or omit 'checks' to run every check. Available checks: index, connection, vacuum, sequence, replication, buffer, constraint.
Recommend indexes for a specific query using HypoPG simulation. Requires HypoPG extension.
Analyse the current query workload (from pg_stat_statements) and recommend indexes using the Database Tuning Advisor (DTA) greedy algorithm. Requires pg_stat_statements and HypoPG extensions.
Execute a SQL statement and return results as JSON. In restricted mode only read-only SELECT statements are permitted. In unrestricted mode any SQL may be executed, including DDL and DML.
Generate an EXPLAIN plan for a SQL query. Optionally use ANALYZE for actual run-time stats, or supply hypothetical CREATE INDEX statements (requires HypoPG) to simulate index impact without modifying the schema.
Get detailed information about a table or view: columns, indexes, constraints, and row estimates.
Output schemas not documented. LLMs cannot predict response structure (fields, types, nesting) for downstream planning or data extraction. All 9 tools lack documented return types.
execute_sql parameter 'query' lacks format constraints. Description does not clarify SQL restrictions in restricted mode (SELECT-only) vs unrestricted mode (DDL/DML allowed). LLMs cannot infer valid input without explicit constraints.
No tool annotations (readOnlyHint, destructiveHint, idempotentHint). Tools are marked with Risk levels (READ_ONLY, WRITE) in metadata but not exposed via MCP tool annotations. Agents cannot determine safety without reading descriptions.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | D | 59 | 2026-07-28+ | v2 |
Return the slowest or most resource-intensive queries from pg_stat_statements. Requires the pg_stat_statements extension.
List tables, views, and sequences within a schema.
List all non-system schemas in the database, including their owners.
Error handling returns plain error strings without recovery guidance. E.g., 'pg_stat_statements extension not found' does not suggest 'Install pg_stat_statements or call analyze_db_health instead.' Agents cannot self-correct.
list_* tools (list_schemas, list_objects) lack pagination parameters (limit, offset, cursor). No guidance on result limits. Large schemas could return thousands of objects, exhausting context window.