mcpbeat Sign in

PostgreSQL MCP Server

by antonorlov Your server? Claim it
local only

PostgreSQL runs on your own machine — the client starts it, so there is no endpoint to ping. 2 861 installs a week from npm. Last commit 16 Sep 2026.

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

Installs per day peak 605 · avg 247 · +43% w/w
a month agotoday
2 861
Installs / week
npm · mcp-postgres-server
22
Stars
0 open issues
16 Sep 2026
Last commit
0 releases in 90 days
MIT
License
TypeScript

What the code does

We read the source, 19 h ago · rules 3dff92dd89df

Capabilities

What this server is able to do. For an MCP server this is often the job itself — a terminal server runs commands because that is what it is for. Listed so you know what you are plugging in, not as an accusation.

Touches key and credential files server.json:138
          "description": "Path 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).",

Is this your server and something here is wrong? Tell us — corrections are free and do not require a plan.

This code can reach further than it looks

We found places where it runs commands, builds paths or queries from values it is given. None of that is a flaw by itself — it becomes one when the code changes, and code changes quietly between releases. We re-read it on every one.

Three servers free · no card

Connect this server

This server runs on your own machine — install it with the package manager and the client starts it for you. Package name taken from the official registry entry.

run in your terminal
claude mcp add mcp-postgres-server -- npx -y mcp-postgres-server
~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "mcp-postgres-server": {
      "args": [
        "-y",
        "mcp-postgres-server"
      ],
      "command": "npx"
    }
  }
}
~/.codex/config.toml
[mcp_servers.mcp-postgres-server]
command = "npx"
args = ["-y", "mcp-postgres-server"]
.cursor/mcp.json
{
  "mcpServers": {
    "mcp-postgres-server": {
      "args": [
        "-y",
        "mcp-postgres-server"
      ],
      "command": "npx"
    }
  }
}
.vscode/mcp.json
{
  "mcpServers": {
    "mcp-postgres-server": {
      "args": [
        "-y",
        "mcp-postgres-server"
      ],
      "command": "npx"
    }
  }
}

This one needs environment variables set before it will start: DATABASE_URL (Full connection string (preferred). Supports sslmode in the URL.), PG_HOST (Database host (fallback when DATABASE_URL is not set).), PG_PORT (Database port.), PG_USER (Database user.), PG_PASSWORD (Database password.), PG_DATABASE (Database name.), PG_ALLOW_WRITE (When 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_SSLMODE (TLS 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_CA (Path to a CA certificate file. Setting it by itself implies verify-full.), PG_ENABLE_RUNTIME_CONNECT (Register the connect_db tool (runtime credential switching).), PG_MAX_RESULT_BYTES (Byte 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_TIMEOUT (Statement timeout in milliseconds, applied to every session.), PG_CONNECT_TIMEOUT (Timeout in milliseconds for a single connect attempt (raise it for slow links or SSH tunnels).), PG_SSH_HOST (SSH 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_PORT (SSH bastion port.), PG_SSH_USER (SSH username.), PG_SSH_PRIVATE_KEY (Path 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_PASSPHRASE (Passphrase for the private key, if encrypted.), PG_SSH_AGENT (true to use the ambient agent (SSH_AUTH_SOCK), or an explicit socket path / Windows named pipe.), PG_SSH_PASSWORD (SSH login password. Opt-in; a key or agent takes precedence. Prefer keys, a bastion often disables password auth.), PG_SSH_FINGERPRINT (Pinned 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_INTERVAL (SSH keepalive interval in ms; the tunnel drops after 3 unanswered keepalives, and the next call reconnects.). The author declared them in the registry entry; get the values from the project itself.

Alternatives to PostgreSQL

same job, measured the same way
PostgreSQL MCP Server
by musaddiq-dev

Python MCP server for PostgreSQL database inspection and querying

77 installs/wk local only
Neon
by neon

Official Neon MCP server for managing Neon projects and Lakebase Postgres databases.

answering
Metabase AI Assistant
by enessari

MCP Server for Metabase - 111 tools for SQL generation, dashboards & PostgreSQL

55 installs/wk local only
I
DB MCP Server
by stucchi

Database MCP server for MySQL, PostgreSQL, MongoDB, and SQLite with SSH tunneling support.

245 installs/wk local only
I
Postgres Connector
by martymarkenson

MCP server for querying PostgreSQL databases

30 installs/wk local only
Docker MCP Server
by hypnosis

Docker for AI agents — containers, compose stacks, logs and databases, locally or over SSH.

225 installs/wk local only
MCP Sqlite Tools
by spences10

MCP server for local SQLite database operations

138 installs/wk local only
Dbmcp
by haymon

Database MCP server for MySQL, MariaDB, PostgreSQL & SQLite with PII redaction and write-prevention

local only

PostgreSQL — questions

Answers built from our own checks of this server.

Why is there no uptime for PostgreSQL?
PostgreSQL runs on your own machine over stdio — there is no network address to reach, so uptime cannot be measured for it by anyone. What can be measured is adoption: the npm package mcp-postgres-server was installed 2 861 times last week.
How do I connect PostgreSQL?
Copy the ready config from this page — we generate it for Claude Code, Claude Desktop, Codex, Cursor and VS Code, each with the file path that client actually reads. It runs locally, so the command pulls mcp-postgres-server straight from npm; nothing to host, nothing to sign up for.
How many people use PostgreSQL?
The npm package mcp-postgres-server was installed 2 861 times in the last week. Week over week that is +43%. We show installs rather than GitHub stars on purpose: a star is a bookmark, an install is someone actually running it.
Is PostgreSQL open source?
Yes — it is published under the MIT licence, written in TypeScript and 22 stars on GitHub. The source link is on this page, so you can read exactly what it does with your data before you connect it.