Pgbot: A 5.9 MB read-only Postgres tool for humans and agents

Source: pgbot.dev
47 points by sashash 10 hours ago on hackernews | 9 comments

Open source · Go · FREE

Nobody reads database metrics. pgbot does.

Connect your Postgres. Get answers, not dashboards: what's healthy, what's broken, and what to fix first.

$ curl -fsSL https://pgbot.dev/install | sh

pgbot

Works with any cloud:

Supabase AWS RDS Neon DigitalOcean pgrun

How it connects

Two paths to the same place: connect directly over the wire, or run the agent next to a database that never leaves your network.

                             pgbot.dev
                                 │
             ┌───────────────────┴───────────────────┐
             │                                       │
 Direct PostgreSQL access                       pgBot agent
             │                                       │
   Supabase · Neon · RDS                    Docker · Kubernetes
 PlanetScale · public DBs                  Private servers · VPC
             │                                       │
             └───────────────────┬───────────────────┘
                                 ▼
                            PostgreSQL

Features

Connect any PostgreSQL database and get visibility into performance, queries, health, schema, and changes — with AI-powered explanations.

01

See database health in real time

Monitor connections, locks, transactions, cache hit ratio, replication, WAL, and overall database health.

02

Understand query performance

Track slow queries, regressions, throughput, query latency, and expensive SQL using PostgreSQL statistics.

03

Inspect tables and indexes

Analyze table growth, index usage, unused indexes, missing indexes, vacuum activity, and storage patterns.

04

Get AI-powered insights

Ask pgBot questions in plain English and get summaries, explanations, and recommendations based on real database signals.

05

Works with any PostgreSQL

Connect directly to public databases or use the pgBot Agent for private environments like Docker, Kubernetes, and internal servers.

06

Built for secure production use

Read-only access, open-source agent, and support for private deployments without exposing your database publicly.

MCP — use pgbot as an agent tool

pgbot mcp speaks the Model Context Protocol on stdio, so an AI agent can call pgbot as a read-only tool. It exposes deterministic tools only — inspect (full findings as JSON) and unused_indexes — and lets the connected model do the explaining. No Gemini key involved: the agent reasons over the same findings the CLI computes.

Add it to any MCP client (Claude Desktop/Code, Cursor, …)

{
  "mcpServers": {
    "pgbot": {
      "command": "pgbot",
      "args": ["mcp"],
      "env": { "DATABASE_URL": "postgres://pgbot_ro@host:5432/db" }
    }
  }
}

Read-only by construction

With DATABASE_URL set, the agent calls inspect with no arguments; or it can pass connection_string per call to reach several databases. pgbot never writes, so there's nothing an agent can break through it.

Tools, prompts, and resources

It also exposes a diagnose prompt — a one-click "inspect and give me a prioritized diagnosis" workflow — and a pgbot://baselines resource listing the databases pgbot has local history for.

Core features

  • +PostgreSQL health monitoring
  • +Query performance analysis
  • +Slow query and regression detection
  • +Locks and blocking query insights
  • +Table and index analytics
  • +Vacuum and autovacuum visibility
  • +Database growth tracking
  • +AI root-cause analysis
  • +AI-powered recommendations
  • +Direct connection or agent-based private access

Why pgBot

Not just metrics. Context.

pgBot helps you understand what changed and why it matters.

Not just dashboards. Explanations.

Ask questions in plain English and get actionable answers.

Not just for hosted Postgres.

Use pgBot with Supabase, Neon, RDS, Docker, Kubernetes, and private servers.

Not just observability. An AI DBA.

Get insights that help you find issues faster and make better decisions.

Point it at a database.

Read-only by default. Nothing leaves your infrastructure unless you say so.

pgbot 550