Skip to content
Agentmart
Submit a tool

Postgres AIops

Governed PostgreSQL DBA ops: slow-query RCA, bloat/vacuum & blocking-lock analysis; 35 MCP tools.

Connector by AIops-tools · GitHub account verified by the MCP Registry

IndexedMITLocal (stdio)
Write a review

Install

Works with Claude Code, Codex, VS Code, Cursor, Windsurf, Claude Desktop. Read the repository before you give any tool access to your data.

npx agentmarket install connector/aiops-tools-postgres-aiops

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Governed PostgreSQL DBA ops: slow-query RCA, bloat/vacuum & blocking-lock analysis; 35 MCP tools.

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this server can do and what it asks for, from its tool list, install config and code. Checked Oct 25, 2026.

Tools
24 read · 8 write · 3 delete
Secrets
None asked for
Install scripts
None found
Runs as
Python package

Tools by what they do 35

Read from the source code; the running server may list different tools.

Read 24 · Look things up without changing anything.

  • autovacuum_status
  • bloat_and_vacuum_analysis
  • explain_query
  • index_bloat
  • invalid_indexes
  • list_activity
  • list_databases
  • list_extensions
  • list_locks
  • list_roles
  • long_running_queries
  • missing_index_hints
Show 12 more tools
  • overview
  • replication_slots
  • replication_status
  • server_version
  • show_settings
  • slow_query_rca
  • table_bloat
  • table_sizes
  • top_queries
  • undo_list
  • unused_indexes
  • wal_status

Write 8 · Create, change, send or run things.

  • blocking_lock_chain_rca
  • cancel_query
  • create_index
  • reindex
  • run_analyze
  • run_vacuum
  • undo_apply
  • update_setting

Delete 3 · Delete, drop, revoke or wipe things.

  • drop_index
  • reset_query_stats
  • terminate_backend

Network hosts it talks to 3

  • anthropic.com · found in code
  • github.com · found in code
  • glama.ai · found in code

Files it touches

  • ~/.postgres-aiops
  • ~/.postgres-aiops/audit.db
  • ~/.postgres-aiops/secrets.enc
  • ~/.postgres-aiops/undo.db

Tools (35)

Read from the source code; the running server may differ. Descriptions are the server’s own words; hidden characters are shown as [U+…].

  • autovacuum_status

    [READ] Per-table dead tuples, mods-since-analyze, and last (auto)vacuum times. Args: limit: Number of tables to inspect (default 50). target: Target name from config; omit for the default.

  • bloat_and_vacuum_analysis

    [READ] Rank tables needing vacuum from dead-tuple ratio + autovacuum recency. Pass 'tables' (as from table_bloat) for pure/offline analysis, or omit to pull the worst dead-tuple tables live. Each recommendation cites its numbers. Args: tables: Injected table-bloat rows; if omitted, pulled live. limit: How many tables to pull when not injected (default 50). target: Target name from config; omit for the default.

  • blocking_lock_chain_rca

    [READ] Build the wait-for tree from blocking pairs and name the root blocker. Pass 'pairs' (as from the live blocking-pairs read) for pure/offline analysis, or omit to pull the current blocking graph live. Args: pairs: Injected blocking pairs {blockedPid, blockingPid, ...}; if omitted, pulled live from pg_blocking_pids. target: Target name from config; omit for the default.

  • cancel_query

    [WRITE][risk=high] Cancel a backend's running query (pg_cancel_backend). No inverse. Captures the backend's pid + query for audit; a cancel has no undo. Pass dry_run=True to preview. Refuses this tool's own backend pid — the query it would cancel is this very call. Enforced under dry_run too. Args: pid: Backend process id (from list_activity). dry_run: If True, preview without cancelling. target: Target name from config; omit for the default.

  • create_index

    [WRITE][risk=medium] Create an index. Reversible: undo drops the created name. Supports CONCURRENTLY (non-blocking build). The created name is returned so the harness records an undo that drops exactly this index. Pass dry_run=True to preview. Alternatively pass ``definition`` (a captured pg_get_indexdef statement — this is how drop_index's undo descriptor replays) INSTEAD of table/columns. Args: table: Table to index (optionally schema-qualified). Required unless ``definition`` is given. columns: Column names to index. Required unless ``definition`` is given. name: Index…

  • drop_index

    [WRITE][risk=high] Drop an index. Reversible: captures pg_get_indexdef first. Before dropping, the exact index definition is captured so the harness records an undo that recreates it. Pass dry_run=True to preview. Args: name: Index name (optionally schema-qualified). concurrently: Drop with CONCURRENTLY (no table lock). dry_run: If True, preview without dropping. target: Target name from config; omit for the default.

  • explain_query

    [READ] Return the JSON execution plan for ``sql`` (EXPLAIN). analyze=False (default) plans without executing; analyze=True runs the statement to collect real timing — only use it for read-only SQL. Args: sql: A single SQL statement to EXPLAIN. analyze: If True, execute the statement to gather real row counts/timing. target: Target name from config; omit for the default.

  • index_bloat

    [READ] Coarse index-bloat estimate (all inputs returned for transparency). Args: limit: Number of indexes to inspect, largest first (default 50). target: Target name from config; omit for the default.

  • invalid_indexes

    [READ] Invalid indexes (failed CONCURRENTLY builds) and duplicate indexes. Args: target: Target name from config; omit for the default.

  • list_activity

    [READ] Current sessions (pg_stat_activity) with per-state counts. Flags idle-in-transaction backends (open transactions holding resources). Args: state: Optional exact state filter (active, idle, 'idle in transaction'). include_idle: Include plain idle backends (default True). target: Target name from config; omit for the default.

  • list_databases

    [READ] Databases with owner, encoding and on-disk size (largest first). Args: target: Target name from config; omit for the default.

  • list_extensions

    [READ] Installed extensions and whether a newer version is available. Args: target: Target name from config; omit for the default.

  • list_locks

    [READ] Held/awaited locks joined to their owning backend and object. Args: target: Target name from config; omit for the default.

  • list_roles

    [READ] Roles and their attributes (superuser/login/replication/…). Args: target: Target name from config; omit for the default.

  • long_running_queries

    [READ] Active queries running at least ``min_seconds``, oldest first. Args: min_seconds: Minimum age in seconds (default 60). target: Target name from config; omit for the default.

Show 20 more tools
  • missing_index_hints

    [READ] Tables with heavy sequential scans and few index scans (index hints). Args: min_seq_scan: Minimum cumulative sequential scans to flag (default 1000). min_live_tup: Minimum live tuples for a table to qualify (default 10000). target: Target name from config; omit for the default.

  • overview

    [READ] One-shot cluster health snapshot. Version + uptime, connections by state, idle-in-transaction count, the longest-running query, the worst dead-tuple table, and standby replay lag — each section captured defensively so one failing probe does not sink the rest. Args: target: Target name from config; omit for the default.

  • reindex

    [WRITE][risk=medium] REINDEX an index/table/schema (rebuild in place, no undo). Rebuilds physical index storage; there is no inverse. Pass dry_run=True to preview. Args: target_name: The index/table/schema name to reindex. kind: INDEX, TABLE, or SCHEMA (default INDEX). concurrently: Rebuild with CONCURRENTLY. dry_run: If True, preview without rebuilding. target: Target name from config; omit for the default.

  • replication_slots

    [READ] Replication slots, flagging inactive slots that retain WAL. Args: target: Target name from config; omit for the default.

  • replication_status

    [READ] Connected standbys and their replay lag (pg_stat_replication). Args: target: Target name from config; omit for the default.

  • reset_query_stats

    [WRITE][risk=medium] Reset pg_stat_statements accumulators (irreversible). The counters cannot be restored, so no undo is recorded. Pass dry_run=True to preview. Args: dry_run: If True, preview without resetting. target: Target name from config; omit for the default.

  • run_analyze

    [WRITE][risk=medium] ANALYZE a table to refresh planner statistics. No undo; captures prior stats for audit. Pass dry_run=True to preview. Args: table: Table name (optionally schema-qualified). dry_run: If True, preview without running. target: Target name from config; omit for the default.

  • run_vacuum

    [WRITE][risk=medium] VACUUM a table (optionally FULL/ANALYZE). Records prior stats. No undo (a vacuum has no inverse); the prior dead-tuple/last-vacuum stats are captured for the audit trail. VACUUM FULL takes an exclusive lock. Pass dry_run=True to preview. Args: table: Table name (optionally schema-qualified, e.g. public.orders). full: Run VACUUM FULL (rewrites the table, exclusive lock). analyze: Also refresh planner statistics (VACUUM ANALYZE). dry_run: If True, preview without running. target: Target name from config; omit for the default.

  • server_version

    [READ] Server version, uptime, recovery state, and data directory. Args: target: Target name from config; omit for the default.

  • show_settings

    [READ] Configuration parameters from pg_settings. Args: pattern: Optional case-insensitive substring to filter setting names (e.g. 'work_mem', 'autovacuum'). target: Target name from config; omit for the default.

  • slow_query_rca

    [READ] RCA for the worst pg_stat_statements entry, with cause + action. Picks the statement with the greatest total execution time and maps its numbers (mean time, cache-hit ratio, temp spill, calls) — plus an optional EXPLAIN plan — to cited causes and concrete actions. Pass 'statements' for pure/offline analysis, or omit to pull the top statements live. Args: statements: Injected pg_stat_statements rows (as from top_queries); if omitted, the worst statements are pulled live. explain_sql: Optional SQL to EXPLAIN so plan node types feed the RCA. limit: How many statements…

  • table_bloat

    [READ] Dead-tuple bloat proxy per table (dead / (live + dead)), worst first. Args: limit: Number of tables to inspect (default 50). target: Target name from config; omit for the default.

  • table_sizes

    [READ] Largest tables by total relation size (table + indexes + TOAST). Args: limit: Number of tables to return, largest first (default 20). target: Target name from config; omit for the default.

  • terminate_backend

    [WRITE][risk=high] Terminate a backend (pg_terminate_backend). No safe inverse. Captures the backend's pid + query for the audit trail; a terminate cannot be undone, so no undo is offered. Pass dry_run=True to preview. Refuses this tool's own backend pid — including under dry_run, which must report a refusal rather than preview a call that will be refused. Args: pid: Backend process id (from list_activity). dry_run: If True, preview without terminating. target: Target name from config; omit for the default.

  • top_queries

    [READ] Top statements from pg_stat_statements by a whitelisted metric. Args: order_by: One of total_time, mean_time, calls, rows, io. limit: Number of statements to return (1..200, default 20). target: Target name from config; omit for the default.

  • undo_apply

    [WRITE][risk=medium] Apply a recorded undo by dispatching its inverse tool. The inverse runs through its own governed tool, so its risk tier and audit row are recorded there. Pass dry_run=True to preview the inverse call without executing it. A token can only be applied once. Args: undo_id: The undoId from undo_list (or an ``_undo_id`` in a write result). dry_run: If True, preview the inverse tool + params without running it. target: Passed through to the inverse tool when it accepts a target.

  • undo_list

    [READ] List recorded, not-yet-applied undo tokens (most recent first). Each entry names the original tool, the inverse tool that ``undo_apply`` would run, and a human note. Use the ``undoId`` with ``undo_apply``. Each entry carries ``effectVerified``. False means the original write lost its response, so the change it reverses is PROBABLE, not confirmed — check the live state before applying, and do not report the result as a restore of a state that may never have been reached. Args: limit: Max rows to return (default 50). target: Unused (undo state is host-local); accepted for CLI u…

  • unused_indexes

    [READ] Non-unique, non-primary indexes with zero scans (drop candidates). Args: min_size_bytes: Only report indexes at least this large (default 0). target: Target name from config; omit for the default.

  • update_setting

    [WRITE][risk=medium] ALTER SYSTEM SET (or RESET) a parameter. Reversible. Writes postgresql.auto.conf; most parameters need SELECT pg_reload_conf() (or a restart for postmaster-context settings) to take effect — reported but NOT performed automatically. The prior state is captured so the harness records an undo. Pass dry_run=True to preview. reset=True issues ALTER SYSTEM RESET, dropping the parameter's auto.conf entry so postgresql.conf or the built-in default applies again. That is the recorded inverse when the parameter had no auto.conf entry to begin with: writing the prior value back wo…

  • wal_status

    [READ] WAL position, level, size settings and archiver health. Args: target: Target name from config; omit for the default.

Signals

Stars
0
Forks
0
Open issues
0
Weekly downloads
185
Last commit
Oct 15, 2026 (13 days ago)
Last release
Oct 15, 2026 (13 days ago)
Last package publish
Oct 15, 2026 (13 days ago)

From GitHub (fetched Oct 24, 2026) and the package registry.

Details

Registry name
io.github.AIops-tools/postgres-aiops
Version
0.12.0
Auth
No auth
Packages
pypi postgres-aiops
License
MIT
First seen
Oct 24, 2026
Last checked
Oct 25, 2026

More from AIops-tools

Cite this page

Postgres AIops MCP server. Agent Mart. https://agentmart.dev/connectors/aiops-tools-postgres-aiops (last updated 2026-10-25)