Postgres connector
Govern database actions through MCP.
z-gateway exposes Postgres tools through its governed MCP runtime. Connection strings are encrypted, policies decide access before execution, high-risk writes can require approvals, and database actions appear beside GitHub actions in runtime sessions.
Setup
- Open Dashboard, Connectors, Database Connectors.
- Add a Postgres-compatible DSN for Neon, Railway, Supabase, or generic hosted Postgres reachable from the deployed runtime.
- Test the connection from the dashboard.
- Assign the database target to an agent. Advanced clients may pass an assigned
databaseConnectionIdto db.* MCP tools. - Assign policies that explicitly allow postgres actions for the agent.
Tools
db.schema.readlists bounded schema/table metadata.db.table.describereturns columns and indexes for one table or view.db.query.readruns a single bounded read-only query with row caps.db.query.explainreturns EXPLAIN output without ANALYZE.db_write_proposeevaluates write SQL with risk scoring, hard blocks unsafe classes, and may require approval before execution.db_delete_safeexecutes DELETE only when a safe table and mandatory WHERE clause are provided.db_update_safeexecutes UPDATE only when safe SET and WHERE fragments are provided.
Risk and approvals
Write-capable database tools run through SQL safety checks, risk scoring, protected-table matching, workspace mode, and policy evaluation. High-risk write proposals can create approval requests instead of executing immediately; the Overview and Approvals pages show those requests without exposing raw SQL in compact summaries.
Current limits
z-gateway is not a transparent Postgres wire proxy. It does not intercept arbitrary Prisma traffic, psql sessions, migration tools, or local database sockets. Agents must use the governed MCP tools above, and the database must be reachable from the deployed server environment.