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. Secret.
MCP_STATEMENT_TIMEOUT
No
Server-side statement timeout, e.g. `5s`. A question that would pin the database is cancelled by PostgreSQL, not by hope.
MCP_ALLOW_TABLES
No
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
No
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.
DATABASE_URL
Yes
Connection string for a role that cannot write. Secret.
Tools show up when the registry metadata or the repository README lists them. GitHub enrichment fills this in when a token is configured.
About
Secure read-only PostgreSQL MCP server in Rust — a maintained alternative to the deprecated @modelcontextprotocol/server-postgres. Blocks writes at the AST, not with regexes.
FAQ
What is PostgreSQL (hardened, read-only)?
Read-only PostgreSQL over MCP. Writes refused at the parsed SQL, plus a READ ONLY transaction.
How do I install PostgreSQL (hardened, read-only)?
Pick a client above and copy the generated config. Cursor and VS Code also have a deep link when the server can run locally or remotely.
Is PostgreSQL (hardened, read-only) official?
No. Registry-listed is not the same as vendor-official. Read the methodology for the difference.
How is the trust score calculated?
This listing scores 31 (Limited). The formula is published on the methodology page.