pg_replication_status
Replication slots, connected replicas, and current WAL position.
How to use it
Project documentation lists pg_replication_status for the Postgres MCP MCP server. Add the server to your MCP client (Claude Desktop, Cursor, Windsurf and others), then check which tools your installed version makes available. Tool availability can depend on configuration and credentials. A server handshake does not verify this tool’s behavior. See the full listing for setup details.
Install Postgres MCP
npx -y @yawlabs/postgres-mcp@latestOther tools in Postgres MCP (22)
Rolled-up DBA lints in one call: sequence-exhaustion candidates, wraparound risk for both counters (per-database and per-table age(relfrozenxid) against autovacuumfreezemaxage, and mxidage(relminmxid) against autovacuummultixactfreezemaxage -- a lock-heavy workload can exhaust multixacts while xids
Kind, columns, PK, outgoing FKs, incoming FKs (referencedby), CHECK / UNIQUE / EXCLUDE constraints, indexes, and partition parent/children for a relation. Generated and identity columns are flagged (generated, identity, generationexpression) so an agent doesn't try to write to them. Constraints carr
EXPLAIN or EXPLAIN ANALYZE for a SQL statement. Text or JSON output. Planner options: buffers (on by default with analyze), settings, verbose, wal, costs, timing, plus genericplan (PG16+, plan a parameterized query with no values) and memory / serialize (PG17+). Optional hypotheticalindexes (require
Server version, database size, connections against maxconnections, active queries with wait events and transaction age, pgstatdatabase rollup (deadlocks, temp files, cache hit ratio), table count.
Recommend indexes for a workload and prove each one pays for itself first. Takes statements you pass or the top N from pgstatstatements, harvests candidate columns from what the planner reports as filters / join keys / sort keys (no SQL parser - every token is intersected with the real pgattribute c
Who is blocking whom right now (blocked PID, blocker PID, lock type, queries).
I/O observability: pgstatio read/write/extend/fsync counts, bytes and times per backend type and context (PG16+), plus in-flight async I/O handles from pgaios and the active iomethod (PG18+).
Cancel a running query or terminate a backend connection. Requires ALLOWWRITES=1.
List installed extensions (pgvector, postgis, pgstatstatements, etc.) with versions.
List functions, procedures, and aggregates in a schema with signatures and return types.
Database roles with login/superuser/createdb flags and group memberships.
List non-system schemas.
List tables (and optionally views) in a schema with estimated row counts. Paginated via limit/offset.
List views and materialized views in a schema, including their SQL definitions.
Run a SQL query. Writes gated by the role in DATABASEURL first, ALLOWWRITES second. Supports parameterized queries via params. Result fields include dataTypeName (e.g. int4, jsonb) alongside dataTypeID.
Run a SQL statement with no persistent data changes - always inside BEGIN READ ONLY, regardless of ALLOWWRITES. The recommended tool for read access, and the one to auto-allow; pair it with a least-privileged role (why).
Find columns by name pattern across all user schemas. Case-insensitive, supports SQL LIKE wildcards.
Tables with heavy sequential scans - missing-index candidates. Returns the statsreset window alongside the rows, since the counters mean nothing without it. lastseqscan / lastidxscan on PG16+.
Tables with high dead-tuple ratios - VACUUM candidates.
Who has SELECT/INSERT/UPDATE/DELETE/etc. on a table or whole schema.
Top N queries by total/mean execution time. Requires the pgstatstatements extension. Returns statsreset (from pgstatstatementsinfo, a different clock from the other stats tools) and dealloc on extension 1.9+ - a non-zero dealloc means entries were evicted past pgstatstatements.max, so the ranking is
Non-unique, non-primary indexes with low scan counts - drop candidates. Also returns statsreset: a recently reset counter makes every index look unused, which is how a load-bearing index gets dropped. lastidxscan on PG16+.