pgwarden

● Active

io.github.B0yko/pgwarden

Give AI assistants access to Postgres with per-user permissions and human approval for writes.

Connect this server

One click to install, or copy the config below. Suits: Claude Desktop · Cursor.

Add to Cursor Add to VS CodeClaude Desktop / Claude Code: paste the config below.

Or add it manually — claude_desktop_config.json (Claude Desktop) or .cursor/mcp.json (Cursor):

{
  "mcpServers": {
    "pgwarden": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-p",
        "8080:8080",
        "-v",
        "{config_dir}:/etc/pgwarden:ro",
        "ghcr.io/b0yko/pgwarden:0.1.1"
      ],
      "env": {
        "PGWARDEN_CONFIG": "<your PGWARDEN_CONFIG>",
        "PGWARDEN_TARGET_DSN": "<your PGWARDEN_TARGET_DSN>",
        "PGWARDEN_STATE_DSN": "<your PGWARDEN_STATE_DSN>",
        "PGWARDEN_ROLE_SECRET_FILE": "<your PGWARDEN_ROLE_SECRET_FILE>",
        "PGWARDEN_SIGNING_KEY_FILE": "<your PGWARDEN_SIGNING_KEY_FILE>",
        "PGWARDEN_SESSION_SECRET_FILE": "<your PGWARDEN_SESSION_SECRET_FILE>",
        "PGWARDEN_OIDC_CLIENT_SECRET_FILE": "<your PGWARDEN_OIDC_CLIENT_SECRET_FILE>"
      }
    }
  }
}
One line, from the terminal
Claude Code
claude mcp add --env PGWARDEN_CONFIG='<your PGWARDEN_CONFIG>' --env PGWARDEN_TARGET_DSN='<your PGWARDEN_TARGET_DSN>' --env PGWARDEN_STATE_DSN='<your PGWARDEN_STATE_DSN>' --env PGWARDEN_ROLE_SECRET_FILE='<your PGWARDEN_ROLE_SECRET_FILE>' --env PGWARDEN_SIGNING_KEY_FILE='<your PGWARDEN_SIGNING_KEY_FILE>' --env PGWARDEN_SESSION_SECRET_FILE='<your PGWARDEN_SESSION_SECRET_FILE>' --env PGWARDEN_OIDC_CLIENT_SECRET_FILE='<your PGWARDEN_OIDC_CLIENT_SECRET_FILE>' --transport stdio pgwarden -- docker run -i --rm -p 8080:8080 -v '{config_dir}:/etc/pgwarden:ro' ghcr.io/b0yko/pgwarden:0.1.1
OpenAI Codex CLI
codex mcp add pgwarden --env PGWARDEN_CONFIG='<your PGWARDEN_CONFIG>' --env PGWARDEN_TARGET_DSN='<your PGWARDEN_TARGET_DSN>' --env PGWARDEN_STATE_DSN='<your PGWARDEN_STATE_DSN>' --env PGWARDEN_ROLE_SECRET_FILE='<your PGWARDEN_ROLE_SECRET_FILE>' --env PGWARDEN_SIGNING_KEY_FILE='<your PGWARDEN_SIGNING_KEY_FILE>' --env PGWARDEN_SESSION_SECRET_FILE='<your PGWARDEN_SESSION_SECRET_FILE>' --env PGWARDEN_OIDC_CLIENT_SECRET_FILE='<your PGWARDEN_OIDC_CLIENT_SECRET_FILE>' -- docker run -i --rm -p 8080:8080 -v '{config_dir}:/etc/pgwarden:ro' ghcr.io/b0yko/pgwarden:0.1.1
VS Code
code --add-mcp '{"name":"pgwarden","type":"stdio","command":"docker","args":["run","-i","--rm","-p","8080:8080","-v","{config_dir}:/etc/pgwarden:ro","ghcr.io/b0yko/pgwarden:0.1.1"],"env":{"PGWARDEN_CONFIG":"<your PGWARDEN_CONFIG>","PGWARDEN_TARGET_DSN":"<your PGWARDEN_TARGET_DSN>","PGWARDEN_STATE_DSN":"<your PGWARDEN_STATE_DSN>","PGWARDEN_ROLE_SECRET_FILE":"<your PGWARDEN_ROLE_SECRET_FILE>","PGWARDEN_SIGNING_KEY_FILE":"<your PGWARDEN_SIGNING_KEY_FILE>","PGWARDEN_SESSION_SECRET_FILE":"<your PGWARDEN_SESSION_SECRET_FILE>","PGWARDEN_OIDC_CLIENT_SECRET_FILE":"<your PGWARDEN_OIDC_CLIENT_SECRET_FILE>"}}'

Syntax from each client's docs (Claude Code: claude mcp add; Codex: codex mcp add; VS Code: code --add-mcp). Placeholders in angle brackets are values you fill in.

Environment variables
  • PGWARDEN_CONFIGrequiredPath to pgwarden.yaml inside the container.
  • PGWARDEN_TARGET_DSNrequiredTarget Postgres 16+ DSN: host, port and database, no user or password.
  • PGWARDEN_STATE_DSNrequiredsecretState database DSN, connecting as the pgwarden_app role that `pgwarden db init` creates.
  • PGWARDEN_ROLE_SECRET_FILErequiredFile with the secret that derives each login role's SCRAM password.
  • PGWARDEN_SIGNING_KEY_FILErequiredFile with the Ed25519 key that signs access tokens.
  • PGWARDEN_SESSION_SECRET_FILErequiredFile with the browser session secret.
  • PGWARDEN_OIDC_CLIENT_SECRET_FILErequiredFile with the client secret your identity provider issued for pgwarden.

A starting point — check the repository for exact arguments and setup. Restart your client after editing the config.

Category
Databases
Version
0.1.1
Registry
active
Published
11/21/2026
Listed in:Official MCP registry ↗how this is checked

Is it safe? Is it maintained?

Serverdex check: Nov 22, 2026

Looks healthy: pgwarden is maintained, open source.

Maintained
Active
Last commit today (Nov 21, 2026), 0 open issues.
Official registry
Active
Published as io.github.B0yko/pgwarden in the official MCP registry, version 0.1.1.
Source
Open source, Apache-2.0
Public repository under the Apache-2.0 licence, 22 stars, 0 forks.
Runs
On your machine
A local Docker package started by your client; it can reach whatever your user account can.
Credentials
7 required
Declared environment variables: PGWARDEN_CONFIG, PGWARDEN_TARGET_DSN, PGWARDEN_STATE_DSN, PGWARDEN_ROLE_SECRET_FILE…. They stay on your machine; the config on this page shows where each goes.
Owner
Unclaimed
Nobody has claimed this page yet; the data above comes from the registry, GitHub and the live check.

Facts only: last commit and licence from GitHub, the entry's status from the official registry, credentials from the live check. Not a code audit — run the security scan on the endpoint yourself.

On GitHub

read Nov 22, 2026
Stars
22
Forks
0
Last push
Nov 21, 2026
License
Apache-2.0

Pythonaccess-controlai-securityaudit-logcloud-rundata-governancedatabase-securityfastapillm-securitymcpmodel-context-protocoloauth2oidcpii-maskingpostgresqlprompt-injectionred-teamingrow-level-securityterraform

From the README

Quickstart · How it works · Results · Limitations · Docs pgwarden is an MCP gateway that lets Claude, ChatGPT, Cursor or any MCP client query Postgres as the person asking. People sign in through your OIDC provider; the gateway connects as their own Postgres role, and the database decides what they see through your grants, row-level security and masking views. Reads are read-only by construction, writes wait for a named approver, and every tool call, sign-in, approval and admin change lands in an append-only, hash-chained audit log. Why let Postgres decide. With one shared credential every user gets the union of everyone's access, and a prompt injection in a support ticket can make an assistant that holds it read a private table (General Analysis, 2025). Guards bolted on outside the database get bypassed: a reference read-only Postgres MCP server was escaped with COMMIT; (Datadog Security Labs, 2025). MacBook Air M5, 24 GB, Docker via colima with 4 CPUs / 6 GB · the commands and caveats are under Results What changes Quickstart Docker with Compose v2 is all the demo needs. Every port binds to 127.0.0.1. If 5432, 8080, 9400, 1025 or 8025 is taken, cp .env.example .env, change the ports there, and devtools/check-ports.sh confirms they are free. Open : the landing page prints the connect commands for MCP Inspector, Claude Code and Cursor.…

Read the full README on GitHub →

The most-starred Databases servers in the index, with their live-check result.

ServerStarsLast pushLive check
Dbx30,677Nov 2026Local / not checked
MCP Toolbox for Databases16,897Nov 2026Local / not checked
MCP Toolbox for Databases16,897Nov 2026Local / not checked
Finance Database9,648Nov 2026Working
DBHub3,868Nov 2026Local / not checked

pgwarden: questions people ask

Is pgwarden a remote or a local MCP server?
According to its entry in the official MCP registry, pgwarden ships as a local package (Docker) that your client starts on your machine.
Does pgwarden need an API key?
Its registry entry declares 7 required environment variables: PGWARDEN_CONFIG, PGWARDEN_TARGET_DSN, PGWARDEN_STATE_DSN, PGWARDEN_ROLE_SECRET_FILE…. The config on this page shows where each goes.
Is pgwarden safe to use?
Looks healthy: pgwarden is maintained, open source. In detail — maintained: Active; official registry: Active; source: Open source, Apache-2.0; runs: On your machine; credentials: 7 required. Serverdex check of Nov 22, 2026. This is a reading of the repository, the registry entry and the live check, not a code audit; run the Serverdex security scan on the endpoint before trusting it with real data.
Is pgwarden still maintained?
Active: the repository's last commit today. Last push Nov 21, 2026, 22 GitHub stars, Apache-2.0 licence. Read from GitHub on Nov 22, 2026.
How do I add pgwarden to Claude, Cursor or VS Code?
Copy the config in "Connect this server" into your client's MCP config file (claude_desktop_config.json, ~/.cursor/mcp.json or .vscode/mcp.json), or use the one-click Add to Cursor / Add to VS Code buttons and the one-line commands for Claude Code and Codex; then restart the client.
Browse all Databases →

Add the badge to your site

Show visitors that pgwarden is listed here — it’s also the link we check for a free listing.

pgwarden — listed on Serverdex

HTML — for your website

<a href="https://serverdex.io/server/io-github-b0yko-pgwarden?utm_source=badge"><img src="https://serverdex.io/brand/badge.svg" alt="pgwarden — listed on Serverdex" width="123" height="40" loading="lazy"></a>

Recommended. A dofollow link from your own domain is the one that counts for search engines, and it's the link we check for a free listing.

Markdown — for your README

[![pgwarden — listed on Serverdex](https://serverdex.io/brand/badge.svg)](https://serverdex.io/server/io-github-b0yko-pgwarden?utm_source=badge)

Nice for visibility, but GitHub marks README links nofollow, so it doesn't pass authority. Use the HTML badge on your site as well.

Add to CursorAdd to VS CodeOpen in Claude Code

Install buttons — for your README

[![Add to Cursor](https://serverdex.io/brand/install-cursor.svg)](https://serverdex.io/install/cursor/io-github-b0yko-pgwarden) [![Add to VS Code](https://serverdex.io/brand/install-vscode.svg)](https://serverdex.io/install/vscode/io-github-b0yko-pgwarden) [![Open in Claude Code](https://serverdex.io/brand/install-claude-code.svg)](https://serverdex.io/install/claude-code/io-github-b0yko-pgwarden)

One click opens Cursor or VS Code with this server's config prefilled; the Claude Code button lands on the one-line command. The links point at Serverdex, so when your config changes the buttons keep working.

Install buttons — HTML for your docs

<a href="https://serverdex.io/install/cursor/io-github-b0yko-pgwarden"><img src="https://serverdex.io/brand/install-cursor.svg" alt="Add to Cursor — via Serverdex" width="140" height="28"></a>
<a href="https://serverdex.io/install/vscode/io-github-b0yko-pgwarden"><img src="https://serverdex.io/brand/install-vscode.svg" alt="Add to VS Code — via Serverdex" width="147" height="28"></a>
<a href="https://serverdex.io/install/claude-code/io-github-b0yko-pgwarden"><img src="https://serverdex.io/brand/install-claude-code.svg" alt="Open in Claude Code — via Serverdex" width="180" height="28"></a>

Same buttons as plain links for a docs page or website.

Prefer a live badge with the score, stars and live check? Score badge (links to a page that explains the number and back to this listing).