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

> Source: <https://pgbot.dev/>
> Published: 2026-08-25 18:30:57+00:00

# Postgres intelligence for AI agents & apps.

Nobody reads database metrics. pgbot does.

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

[pgbot](https://github.com/pgrundev/pgbot)

## 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.

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

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

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

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

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

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.

```
{
  "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.
