Skip to content
Grok

PostgreSQL for Grok

io.github.antonorlov/mcp-postgres-server

MCP server for PostgreSQL: local, Docker, RDS, Neon, Supabase, or behind an SSH bastion.

client:Grok transport:stdio runtime:npm

Install PostgreSQL in Grok

.mcp.json (in your project root)

Held in this page only — never stored, logged, or sent anywhere but back to your screen.

{
  "mcpServers": {
    "mcp-postgres-server": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "mcp-postgres-server"
      ],
      "env": {
        "DATABASE_URL": "<DATABASE_URL>",
        "PG_HOST": "<PG_HOST>",
        "PG_PORT": "<PG_PORT>",
        "PG_USER": "<PG_USER>",
        "PG_PASSWORD": "<PG_PASSWORD>",
        "PG_DATABASE": "<PG_DATABASE>",
        "PG_ALLOW_WRITE": "<PG_ALLOW_WRITE>",
        "PG_SSLMODE": "<PG_SSLMODE>",
        "PG_SSL_CA": "<PG_SSL_CA>",
        "PG_ENABLE_RUNTIME_CONNECT": "<PG_ENABLE_RUNTIME_CONNECT>",
        "PG_MAX_RESULT_BYTES": "<PG_MAX_RESULT_BYTES>",
        "PG_STATEMENT_TIMEOUT": "<PG_STATEMENT_TIMEOUT>",
        "PG_CONNECT_TIMEOUT": "<PG_CONNECT_TIMEOUT>",
        "PG_SSH_HOST": "<PG_SSH_HOST>",
        "PG_SSH_PORT": "<PG_SSH_PORT>",
        "PG_SSH_USER": "<PG_SSH_USER>",
        "PG_SSH_PRIVATE_KEY": "<PG_SSH_PRIVATE_KEY>",
        "PG_SSH_PASSPHRASE": "<PG_SSH_PASSPHRASE>",
        "PG_SSH_AGENT": "<PG_SSH_AGENT>",
        "PG_SSH_PASSWORD": "<PG_SSH_PASSWORD>",
        "PG_SSH_FINGERPRINT": "<PG_SSH_FINGERPRINT>",
        "PG_SSH_KEEPALIVE_INTERVAL": "<PG_SSH_KEEPALIVE_INTERVAL>"
      }
    }
  }
}

Grok Build reads Claude Code's .mcp.json and Claude Desktop's config unchanged, so a server you have already set up there needs nothing new. The Grok web app and X integration do not take custom servers. Grok docs

PostgreSQL in other clients