Skip to main content
MCP server CX Codex

pgwarden — Claude Code MCP server: Postgres access control

pgwarden is a Claude Code MCP server that connects assistants to Postgres using individual OIDC identities, database-level permissions, and human write approval.

Apache-2.0 ★ 36 updated 2026-11-21

Open on GitHub

What pgwarden does

The gateway proxies client queries to Postgres under each user's mapped login role. Row-level security, permissions, and masked views are evaluated directly by the database engine instead of external middleware filters.

Reads execute inside single-statement read-only transactions. Write requests trigger an email with a signed review link, requiring explicit approval from an assigned reviewer before a single run. Tool calls and admin actions are recorded in an append-only hash chain.

Running the demo stack locally requires Docker Compose v2. Direct integration requires Postgres 16 or 18.

What it helps with

  • Postgres access control
  • enforce database permissions per identity
  • require human approval for writes
  • track assistant queries in an audit chain

Example prompts for the agent

  • List all database tables available to my account
  • Run a select query on the customers table
  • Propose a write query to update user status

How to install pgwarden

Install

The MCP registry has no launch command for it: see the repository README

Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more

Questions about pgwarden

How to install pgwarden in Claude Code?

Launch the service using docker compose up -d and open http://localhost:8080 to view the generated connection command for Claude Code.

What does pgwarden do?

It maps incoming user logins to dedicated database roles so assistants query Postgres under individual credentials rather than a shared superuser.

What is required to run pgwarden?

You need Docker with Compose v2 or container image ghcr.io/b0yko/pgwarden:0.1.1, alongside Postgres 16 or 18.

Similar MCP servers

All MCP servers for Data and databases →

Project sponsors

Companies that keep this analytics open