An MCP server that lets AI assistants safely explore, query, and manage any PostgreSQL database. Zero setup, auto-discovery, production-safe.
PGAutoPilot demonstrates solid tool design with 16 well-named, verb-prefixed tools covering database operations. All tools have descriptions (avg ~180 chars, within baseline 194). Input schemas are present with type definitions and parameter descriptions. However, output schemas are not documented in the provided source, and some parameter descriptions lack format constraints or validation guidance. Error handling descriptions exist but lack recovery guidance patterns. Tool composition is strong, each tool has a single responsibility and clear chaining via database/table parameters.
Groups rows by specified columns and computes aggregates (sum, avg, min, max, count). Useful for analytics and reporting.
Creates a backup of the connected database using pg_dump. Requires explicit user confirmation. The backup is saved to the server's backup directory (default: ./backups).
Counts rows in a table, optionally filtered by a where clause.
Inserts a new row into a table. Requires a JSON object of column values. Supports dry-run mode to preview the operation without writing.
Lists all databases configured in pgautopilot.json for multi-database mode, including each database's connection status (connected, not connected, or error), host, port, schema, and read-only setting. This tool is only meaningful in multi-database mode — in single-database mode it returns a message indicating only one database is configured. When to use: - As the first call when the user wants to work with a specific named database. - To discover which databases are available before calling db_use_database. - To verify that all configured databases are reachable. Returns: an array of database entries with name, connection summary, status (connected | not connected | error), and readonly flag. Databases that failed to connect at startup will show 'not connected' and will be lazily connected on first use.
Output schemas not documented. Tool descriptions state what is returned (e.g., 'returns JSON object with status, database, mode') but formal output schema definitions are not visible in source. LLMs cannot reliably plan downstream tool calls without knowing response field names and types.
Parameter format constraints missing. Parameters like 'where', 'select', 'orderBy', 'data', 'create', 'update' accept JSON strings but descriptions do not specify format, structure, or validation rules. E.g., 'where' says 'JSON filter object' but does not document the filter DSL syntax (contains, equals, gt, lt, etc.).
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | D | 52 | 2026-07-28+ | v2 |
Provides a high-level overview of the connected PostgreSQL database: all tables with approximate row counts, foreign key relationships between tables, and a summary of indexes and constraints. Use this tool to understand the database schema at a glance before diving into specific tables.
Switches the default database for subsequent tool calls. After switching, all tools that accept an optional 'database' parameter will use this database when the parameter is omitted. The target database must be listed in pgautopilot.json. This is an idempotent operation — calling it with the same database name has no effect. When to use: - After calling db_list_databases, when the user wants to work with a specific database. - When switching between production and analytics databases mid-session. Behavioral notes: - The target database is lazily connected on first use if not already connected. - If the target database is unreachable, the switch succeeds but subsequent tools will return a connection error with guidance. - This does NOT affect other MCP sessions or connections — only the current session. Returns: confirmation with the new default database name and its connection details.
Deletes one or more rows from a table. Requires a where clause to select rows. Supports dry-run mode. Requires confirmAll: true to delete all rows when where is '{}'.
Analyzes a SQL SELECT query using PostgreSQL's EXPLAIN command. Returns execution plan details including estimated costs, actual timing (if ANALYZE is enabled), and buffer usage statistics. Useful for query optimization and performance debugging.
Finds and returns a single row matching the given filter. Returns null if no match is found.
Queries a table with optional filtering, selection, ordering, and pagination. Returns up to 50 rows by default (max 500). Use this for exploratory queries and data retrieval.
Reports whether the MCP server is ready to run database tools and which database it is connected to. Use this tool first if you suspect a configuration problem. When the server is not configured (e.g. DATABASE_URL is missing or invalid), this tool returns a detailed explanation of exactly what to fix, including the expected .env file location and connection string format. In multi-database mode, it lists every configured database with its connection status. This tool never modifies anything — it is purely informational. When to use: - At the start of a session to verify the server is connected and healthy. - When any other tool returns a connection error, to diagnose the root cause. - When the user asks about the current server configuration or connected database. Returns: a JSON object with 'status' (ready|not_configured), 'database' (connection summary), 'mode' (read-only or read-write), and 'readonly' flag. Errors include actionable guidance.
Executes a raw SQL statement. SELECT queries (must end with LIMIT) are allowed by default. Non-SELECT statements (INSERT, UPDATE, DELETE, DDL) require confirmed: true, ALLOW_RAW_WRITES on the server, and a server that is not read-only.
Returns detailed schema information for a single table: column names, types, constraints (primary key, unique, not null, foreign keys), default values, and indexes. Use this before querying a table to understand its structure.
Updates one or more rows in a table. Requires a where clause to select rows and a data object with new values. Supports dry-run mode. Requires confirmAll: true to update all rows when where is '{}'.
Inserts a new row or updates an existing row (upsert). Requires a where clause that matches a unique constraint, a create object for insertion, and an optional update object for updates.
Error recovery guidance incomplete. Tool descriptions mention errors (e.g., 'connection error', 'invalid input') but do not provide actionable recovery steps. E.g., raw_query says 'requires confirmed: true' but does not explain what error message the LLM will see if confirmed is false, or how to interpret it.
Numeric parameter bounds not specified. 'take' parameter in find_many and aggregate states 'max 500' but no minimum is documented. 'skip' has no bounds. Unbounded numeric parameters allow LLMs to pass absurd values (negative skip, take=999999) that may cause performance issues.
Dry-run and confirmation patterns not consistently applied. create, upsert, update, delete support dryRun and confirmAll, but find_many, find_first, count, aggregate do not. Inconsistent safety patterns across similar tools increase cognitive load for LLM planning.