PostgreSQL
by github.com/antonorlov · v0.3.1 · updated Sep 14, 2026
MCP server for PostgreSQL: local, Docker, RDS, Neon, Supabase, or behind an SSH bastion.
Run it locally
Install the package and point your AI client at it.
npm
npx -y [email protected]Environment variables
DATABASE_URLsecretFull connection string (preferred). Supports sslmode in the URL.
PG_HOSTDatabase host (fallback when DATABASE_URL is not set).
PG_PORTDatabase port.
PG_USERDatabase user.
PG_PASSWORDsecretDatabase password.
PG_DATABASEDatabase name.
PG_ALLOW_WRITEWhen true, execute performs writes and reads are sent directly. Off (default) is read-only: execute refuses writes and each read runs in a READ ONLY transaction.
PG_SSLMODETLS mode. require/allow/prefer encrypt without verifying the certificate; verify-ca/verify-full verify it (supply a CA via PG_SSL_CA). Unlike libpq, allow/prefer do not fall back to plaintext, so a server without TLS needs disable.
PG_SSL_CAPath to a CA certificate file. Setting it by itself implies verify-full.
PG_ENABLE_RUNTIME_CONNECTRegister the connect_db tool (runtime credential switching).
PG_MAX_RESULT_BYTESByte budget for a query result sent to the model. Whole rows are kept while they fit; over the budget returnedRows < rowCount and truncated is true.
PG_STATEMENT_TIMEOUTStatement timeout in milliseconds, applied to every session.
PG_CONNECT_TIMEOUTTimeout in milliseconds for a single connect attempt (raise it for slow links or SSH tunnels).
PG_SSH_HOSTSSH bastion host. Setting it enables tunneling: the server reaches the database only through an SSH tunnel to this host. Needs the ssh2 optional dependency.
PG_SSH_PORTSSH bastion port.
PG_SSH_USERSSH username.
PG_SSH_PRIVATE_KEYPath to a private key file. If unset, auth falls back like ssh: a running agent (SSH_AUTH_SOCK), then a default key (~/.ssh/id_ed25519, id_rsa, id_ecdsa).
PG_SSH_PASSPHRASEsecretPassphrase for the private key, if encrypted.
PG_SSH_AGENTtrue to use the ambient agent (SSH_AUTH_SOCK), or an explicit socket path / Windows named pipe.
PG_SSH_PASSWORDsecretSSH login password. Opt-in; a key or agent takes precedence. Prefer keys, a bastion often disables password auth.
PG_SSH_FINGERPRINTPinned host-key fingerprint (SHA256:...). Host-key verification is mandatory and set only this way: without it the tunnel refuses to connect. Get it with ssh-keygen -lF host.
PG_SSH_KEEPALIVE_INTERVALSSH keepalive interval in ms; the tunnel drops after 3 unanswered keepalives, and the next call reconnects.
More from github.com/antonorlov
More MCP servers
Rftools
github.com/antonpogrebenko-public
257 RF & electronics calculators + 14 simulation tools for AI agents.
Cold Leads
github.com/anttka4cz
B2B outreach CRM for AI agents: contacts, verification, approved campaigns, replies, follow-ups.
Weather Mcp
github.com/antuelle78
A simple MCP server for getting weather information.
Mcp Server Chart
github.com/antvis
A Model Context Protocol server for generating charts using AntV.
WineAuction
github.com/antyser
Wine prices: retail, auction and restaurant references; check any quoted price.
Fantasy Premier League
github.com/anubabajide
Research and manage a Fantasy Premier League team from any MCP-capable agent.