The command line interface for PgBeam, a multi-tenant PostgreSQL proxy platform for safe database access by AI agents.
PgBeam sits in the Postgres wire protocol between an agent and your database. It issues scoped agent credentials, enforces a policy on every statement (read-only, table and column allowlists, PII masking, query budgets, kill switch), and records a full audit trail. It also serves a hosted MCP endpoint, pools connections, and caches queries. This CLI drives all of that from the terminal, against the same API the dashboard uses.
Using PgBeam needs an account. The CLI on its own does not talk to your database; it talks to the PgBeam control plane at api.pgbeam.com.
npm, for a Node install (Node 20.19 or newer):
npm install -g @pgbeam/cliOr run it without installing:
npx @pgbeam/cli --helpHomebrew, for a self-contained native binary with no Node runtime needed:
brew install sferarc/pgbeam/pgbeamOr the install script, which downloads the same native binary:
curl -fsSL https://pgbeam.com/install | shVerify:
pgbeam --versionpgbeam auth loginLogin takes an API key, which you generate in the dashboard under Settings, API Keys. The key is checked against the API before it is stored, and credentials live in a local profile under ~/.config/pgbeam/. --profile <name> keeps several of them side by side.
Non-interactive callers can skip the profile entirely and set PGBEAM_API_KEY in the environment, which is the same variable the Terraform, Crossplane, and Pulumi providers read.
pgbeam --help # the full tree
pgbeam <command> --help # a command, its flags, and worked examplesEvery command takes --json for machine-readable output.
Projects and databases
pgbeam projectscreate, list, inspect, update projects, and see per-project usagepgbeam link/pgbeam unlinkpin the current directory to a project, so later commands need no--projectpgbeam dbconnect a database to a project and update its connection settingspgbeam replicasmanage read replicaspgbeam domainsmanage custom proxy domainspgbeam cache-rulesset query cache rulespgbeam brancheslist and discard ephemeral database sandbox branchespgbeam env pullwrite a project's connection details into a.envfile
Agents, policy, and audit
pgbeam agentscreate, inspect, rotate, enable, disable, and revoke scoped agent credentials, read their usage, and emit an MCP client configpgbeam policiescreate and update policy profiles, lint them, dry-evaluate a statement against one, and replay past traffic through a candidate policypgbeam annotationsdescribe tables and columns so connected agents know what they are looking atpgbeam auditlist, inspect, and export the statement audit log, including per-session viewspgbeam approvalslist, approve, and reject statements held for human reviewpgbeam anomalieslist, acknowledge, and resolve anomaly alertspgbeam honeytokensmanage decoy relationspgbeam webhooksmanage event and audit webhook endpointspgbeam migrations lintflag unsafe DDL before you run it
Account and platform
pgbeam authlog in and out, list and switch profiles, show statuspgbeam whoamishow the credential in effect and where it came frompgbeam orgslist and switch organizations, show the plan and usagepgbeam analyticsmetrics, insights, plans, and spend limitspgbeam account exportexport everything the account holdspgbeam platformproxy regions and healthpgbeam apicall any API route directly, and list or inspect the routespgbeam mcprun an MCP server over stdio, exposing the CLI's own surface to an agentpgbeam doctordiagnose an installation end to endpgbeam updateupdate a native binary install in place
| Variable | Effect |
|---|---|
PGBEAM_API_KEY |
API key to use, instead of a stored profile |
PGBEAM_PROFILE |
Named profile to use |
PGBEAM_API_URL |
API base URL, default https://api.pgbeam.com |
PGBEAM_NO_UPDATE_CHECK |
Suppress the background check for a newer CLI |
NO_COLOR |
Disable colored output, same as --no-color |
Full command reference at pgbeam.com/docs/cli.
This repository is a read-only mirror of a directory in PgBeam's monorepo, kept in sync automatically. Pull requests opened here are synced back, so they are welcome; expect the merge to land through that sync rather than directly.
Apache-2.0