b0yko avatar

pgwarden

b0yko/pgwarden

Gateway access to Postgres as each signed-in user, with database-enforced permissions and approval for writes.

CCM score
82 of 100
GitHub stars
36
tools
4
auth
Secret needed
transport
HTTP
env vars
7
last updated
Nov 21, 2026
View on GitHub

Own this MCP server? Claim it

What it does

  • Reads data with whoami, list_tables, describe_table, and query, each run as the caller's own Postgres role in a read-only transaction
  • Writes are proposed and held until a named approver confirms them; each call and approval lands in a hash-chained audit log
  • Requires OIDC sign-in through your identity provider and a running Postgres 16 or newer; the demo stack runs in Docker
  • Designed for teams that want assistants to query shared databases without one credential shared across everyone

Tools

4 tools

Public tool metadata for what this MCP can expose to an agent.

whoamiShows the signed-in identity and the Postgres role the query runs as.

Shows the signed-in identity and the Postgres role the query runs as.

No parameter schema in public metadata yet.

list_tables

No parameter schema in public metadata yet.

describe_table

No parameter schema in public metadata yet.

query

No parameter schema in public metadata yet.

Configuration

PGWARDEN_CONFIG*default: /etc/pgwarden/pgwarden.yaml

Path to pgwarden.yaml inside the container.

PGWARDEN_TARGET_DSN*

Target Postgres 16+ DSN: host, port and database, no user or password.

PGWARDEN_STATE_DSN*secret

State database DSN, connecting as the pgwarden_app role that `pgwarden db init` creates.

PGWARDEN_ROLE_SECRET_FILE*default: /etc/pgwarden/secrets/role_secret

File with the secret that derives each login role's SCRAM password.

PGWARDEN_SIGNING_KEY_FILE*default: /etc/pgwarden/secrets/signing_key.pem

File with the Ed25519 key that signs access tokens.

PGWARDEN_SESSION_SECRET_FILE*default: /etc/pgwarden/secrets/session_secret

File with the browser session secret.

PGWARDEN_OIDC_CLIENT_SECRET_FILE*default: /etc/pgwarden/secrets/oidc_client_secret

File with the client secret your identity provider issued for pgwarden.

Readme

pgwarden: give AI your database, not the keys

CI Latest release Container image on GHCR Postgres 16 and 18 Python 3.12 Apache-2.0 licence


View the full README on GitHub

Details

Repository
github.com/b0yko/pgwarden
Categories
Databases, Security
Package
ghcr.io/b0yko/pgwarden:0.1.1
Transport
HTTP
Auth
Required
Registry
MCP registry, active

Similar to pgwarden

More Databases