Open sourceLocal-first Postgres MCP server
Safe Postgres for coding agents.
PGSandbox gives each agent task an isolated database, then cleans it up when the work is done.
Paste it into Codex, Cursor, VS Code, or Claude Desktop. Your agent handles setup and verification.
- Local-first
- Runs on your machine. No hosted account required.
- Isolated per task
- One database and one scoped login for each agent job.
- Tracked cleanup
- TTL limits and metadata keep deletion bounded to owned resources.
What it does
A database sandbox for work that needs proof.
Your agent gets real Postgres behavior without access to a shared developer database or long-lived task state.
- 01Create
- PGSandbox creates a temporary database, a restricted login role, and an expiry time.
- 02Prove
- Your agent runs migrations, SQL, seed commands, schema checks, or a backend reproduction.
- 03Delete
- PGSandbox removes the tracked database and role after the task, or when the TTL expires.
What it’s for
Use real Postgres without risking shared state.
PGSandbox is for engineering tasks where static analysis is not enough and the agent needs a database to verify its work.
- 01Test database migrations
- Apply schema changes to a real Postgres test database before they reach shared development or staging.
- 02Validate SQL and query plans
- Run generated SQL, inspect schemas, and check query plans against the database engine that will execute them.
- 03Reproduce backend bugs
- Build the failing state in isolation, test the fix, and delete the database when the investigation ends.
- 04Seed product demos
- Give screenshots, local demos, and acceptance tests realistic data without polluting a shared environment.
- 05Clone realistic test data
- Restore an existing Postgres source into a tracked, disposable database for higher-confidence validation.
Designed for local agent work
Small enough to understand. Strict where it matters.
- Leaves your existing Postgres alone
- The managed local runtime uses its own data directory and a separate high port instead of taking over port 5432.
- Separates lifecycle access from query access
- Admin connections manage databases. Agent SQL runs through the sandbox’s restricted role.
- Bounds agent output and lifetime
- Row limits, result truncation, positive TTLs, and ownership metadata keep experiments contained.
Agent-assisted setup
Let your agent handle the setup.
One prompt tells your agent how to install PGSandbox, configure its MCP client, and verify the complete create-query-delete workflow.
Ready for your coding agent.