Skip to main content

PostgreSQL (hardened, read-only)

io.github.Eszetael/postgres-mcp-hardened

v0.1.12Updated Nov 24, 2026stdio · npmstdio · Docker

Read-only PostgreSQL over MCP. Writes refused at the parsed SQL, plus a READ ONLY transaction.

Install

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

Run in your terminal. Replace 1 placeholder.

claude mcp add postgres-mcp-hardened -e 'DATABASE_URL=<your-database-url>' -- npx -y [email protected]

The registry lists extra launch arguments or environment variables for this server that could change what runs. They are left out here; check its repository before adding any.

Configuration

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

  • DATABASE_URL
    Env var· required· secret
    Connection string for the role the server connects as. Use a role that cannot write — the server refuses writes twice, but a read-only role is the layer that does not depend on us being correct. `--print-setup-sql` prints the SQL that creates one.
  • MCP_STATEMENT_TIMEOUT
    Env var· optional
    Server-side statement timeout, e.g. `5s`. A question that would pin the database is cancelled by PostgreSQL, not by hope.
  • MCP_ALLOW_TABLES
    Env var· optional
    Comma-separated allowlist. A table off the list is refused by name, and hiding it inside a CTE, a view or a join does not help.
  • MCP_AUDIT_LOG
    Env var· optional
    Path to the tamper-evident audit log. Entries are chained by hash and survive a restart; `--verify-audit` checks the chain against an off-host anchor.
  • MCP_ADDR
    Env var· optional
    Address to bind, default 127.0.0.1:8080.

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