Disposable Postgres for autonomous coding loops

Real databases. Zero shared-state drama.

PGSandbox MCP gives agents a private Postgres playground for migrations, bug repros, seeded demos, and SQL validation — with TTLs and cleanup built in.

npm install -g pgsandbox-mcp
pgsandbox-mcp setup \
  --client codex \
  --admin-url "$PGSANDBOX_ADMIN_DATABASE_URL"
pgsandbox-mcp doctor
agentmcppostgresttl cleanup

Why it exists

The safe path should be the fastest path.

Isolated by default

Every task gets its own database and scoped role, instead of touching a shared dev database.

No control plane

Point it at any reachable Postgres admin connection: local, Docker, VPS, or private dev host.

Agent-native

Expose database creation, SQL execution, schema inspection, and cleanup through MCP tools.

Start in minutes

Install, register, verify.

Use an admin connection for a Postgres instance you control. PGSandbox creates task databases and limited roles under a predictable prefix.

export PGSANDBOX_ADMIN_DATABASE_URL="postgres://postgres:postgres@localhost:5432/postgres"
npm install -g pgsandbox-mcp
pgsandbox-mcp setup --client codex --admin-url "$PGSANDBOX_ADMIN_DATABASE_URL"
pgsandbox-mcp doctor

MCP tool surface

Everything an agent needs to prove database work.

create_databaserun_sqldescribe_schemaget_connection_stringlist_databasescleanup_expireddelete_database

Built for local-first validation

Give agents a real Postgres sandbox before they ship.

Start with npm or Homebrew, then wire it into Codex, Cursor, VS Code, or Claude Desktop.