pgops

io.github.arzharch/pgops-mcp

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

Connect this server

Add this to your MCP client config — claude_desktop_config.json (Claude Desktop) or .cursor/mcp.json (Cursor).Suits: Claude Desktop · Cursor.

{
  "mcpServers": {
    "pgops-mcp": {
      "command": "uvx",
      "args": [
        "pgops-mcp"
      ],
      "env": {
        "PGOPS_DSN": "<your PGOPS_DSN>",
        "PGOPS_READONLY_DSN": "<your PGOPS_READONLY_DSN>",
        "PGOPS_READ_ONLY": "0",
        "PGOPS_APPROVAL_MODE": "0",
        "PGOPS_AUDIT_LOG": "~/.pgops/audit.jsonl",
        "PGOPS_DEFAULT_TIMEOUT_MS": "5000",
        "PGOPS_MAX_TIMEOUT_MS": "30000",
        "PGOPS_DEFAULT_ROW_LIMIT": "100"
      }
    }
  }
}
Environment variables
  • PGOPS_DSNrequiredsecretPostgreSQL connection string for the database to operate on.
  • PGOPS_READONLY_DSNsecretOptional 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_ONLYSet to 1 to withhold every mutating tool. Write tools are not registered at all, so an agent cannot call them.
  • PGOPS_APPROVAL_MODESet to 1 to register container.restart and container.exec. Off by default: Docker socket access is root-equivalent on the host.
  • PGOPS_AUDIT_LOGPath to the append-only JSONL audit log.
  • PGOPS_DEFAULT_TIMEOUT_MSStatement timeout applied to every query unless a tool call overrides it.
  • PGOPS_MAX_TIMEOUT_MSCeiling a caller-supplied timeout is clamped to.
  • PGOPS_DEFAULT_ROW_LIMITRows returned by query.read when the caller does not specify a limit.

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

Category
Developer Tools
Version
0.1.9
Registry
active
Published
9/1/2026
Browse all Developer Tools →

Add the badge to your site

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

pgops — listed on Serverdex

HTML — for your website

<a href="https://serverdex.io/server/io-github-arzharch-pgops-mcp?utm_source=badge"><img src="https://serverdex.io/brand/badge.svg" alt="pgops — 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

[![pgops — listed on Serverdex](https://serverdex.io/brand/badge.svg)](https://serverdex.io/server/io-github-arzharch-pgops-mcp?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.