pgbrake

v0.3.0
io.github.lexang/pgbrake Checked 7 hours ago Published 25 days ago

Postgres brake for AI agents: risky SQL waits for approval, UPDATE/DELETE get one-command undo.

Values you need

VariableWhat it is
PGBRAKE_DSNrequired secret Postgres connection string, e.g. postgresql://me@localhost/app

PyPI (uvx) discovery passed

Requires uv (https://docs.astral.sh/uv/)

Run in a terminal
claude mcp add pgbrake -e 'PGBRAKE_DSN=<PGBRAKE_DSN>' -- uvx pgbrake==0.3.0 serve
Add to claude_desktop_config.json
{
  "mcpServers": {
    "pgbrake": {
      "args": [
        "pgbrake==0.3.0",
        "serve"
      ],
      "command": "uvx",
      "env": {
        "PGBRAKE_DSN": "<PGBRAKE_DSN>"
      }
    }
  }
}
Add to ~/.cursor/mcp.json
{
  "mcpServers": {
    "pgbrake": {
      "args": [
        "pgbrake==0.3.0",
        "serve"
      ],
      "command": "uvx",
      "env": {
        "PGBRAKE_DSN": "<PGBRAKE_DSN>"
      }
    }
  }
}
Add to .vscode/mcp.json
{
  "inputs": [
    {
      "description": "PGBRAKE_DSN",
      "id": "pgbrake-dsn",
      "password": true,
      "type": "promptString"
    }
  ],
  "servers": {
    "pgbrake": {
      "args": [
        "pgbrake==0.3.0",
        "serve"
      ],
      "command": "uvx",
      "env": {
        "PGBRAKE_DSN": "${input:pgbrake-dsn}"
      },
      "type": "stdio"
    }
  }
}
Add to ~/.codex/config.toml
[mcp_servers.pgbrake]
command = "uvx"
args = ["pgbrake==0.3.0", "serve"]
env = { "PGBRAKE_DSN" = "<PGBRAKE_DSN>" }

For AI agents

  1. Ask the user for: PGBRAKE_DSN. Never invent or guess these values; secrets go into the client config, not into chat logs.
  2. Pick the user's MCP client and apply the matching config from the first install method (it is the one verified by the smoke test when available).
  3. Restart or reload the client so it starts the server.
  4. Verify: the server should expose these tools: query, execute, undo, list_changes, approval_status.
  5. If it fails, check that the required runtime is installed (uv (https://docs.astral.sh/uv/)) and that the values above are set.

Machine-readable: install.md · manifest.json