Skip to main content

pgops

io.github.arzharch/pgops-mcp

v0.1.9Updated Sep 1, 2026stdio · Dockerstdio · PyPI

Safe, audited PostgreSQL operations for AI agents: queries, migrations, EXPLAIN, containers

Install

Needs 1 secret. Replace 1 placeholder with your own values.

Run in your terminal. Replace 1 placeholder.

claude mcp add pgops-mcp -e 'PGOPS_DSN=<your-pgops-dsn>' -e PGOPS_READ_ONLY=0 -e PGOPS_APPROVAL_MODE=0 -e 'PGOPS_AUDIT_LOG=~/.pgops/audit.jsonl' -e PGOPS_DEFAULT_TIMEOUT_MS=5000 -e PGOPS_MAX_TIMEOUT_MS=30000 -e PGOPS_DEFAULT_ROW_LIMIT=100 -- uvx pgops-mcp==0.1.9

Configuration

8 settings, 1 required secret. Snippets use placeholders; keep real values out of shared config.

  • PGOPS_DSN
    Env var· required· secret
    PostgreSQL connection string for the database to operate on.
  • PGOPS_READONLY_DSN
    Env var· optional· secret
    Optional separate DSN for the read-only pool. Use a role with no write grants to enforce read-only at the database rather than only in the server.
  • PGOPS_READ_ONLY
    Env var· optional
    Set to 1 to withhold every mutating tool. Write tools are not registered at all, so an agent cannot call them.Default: 0
  • PGOPS_APPROVAL_MODE
    Env var· optional
    Set to 1 to register container.restart and container.exec. Off by default: Docker socket access is root-equivalent on the host.Default: 0
  • PGOPS_AUDIT_LOG
    Env var· optional
    Path to the append-only JSONL audit log.Default: ~/.pgops/audit.jsonl
  • PGOPS_DEFAULT_TIMEOUT_MS
    Env var· optional
    Statement timeout applied to every query unless a tool call overrides it.Default: 5000
Show 2 more
  • PGOPS_MAX_TIMEOUT_MS
    Env var· optional
    Ceiling a caller-supplied timeout is clamped to.Default: 30000
  • PGOPS_DEFAULT_ROW_LIMIT
    Env var· optional
    Rows returned by query.read when the caller does not specify a limit.Default: 100

Listed in the official MCP Registry since Sep 1, 2026. Mirrored daily; last checked Nov 26, 2026.