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.
We read the source, 19 h ago · rules 3dff92dd89df
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.
"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.
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.
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.
claude mcp add mcp-postgres-server -- npx -y mcp-postgres-server
{
"mcpServers": {
"mcp-postgres-server": {
"args": [
"-y",
"mcp-postgres-server"
],
"command": "npx"
}
}
}
[mcp_servers.mcp-postgres-server]
command = "npx"
args = ["-y", "mcp-postgres-server"]
{
"mcpServers": {
"mcp-postgres-server": {
"args": [
"-y",
"mcp-postgres-server"
],
"command": "npx"
}
}
}
{
"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.
Python MCP server for PostgreSQL database inspection and querying
Official Neon MCP server for managing Neon projects and Lakebase Postgres databases.
MCP Server for Metabase - 111 tools for SQL generation, dashboards & PostgreSQL
Database MCP server for MySQL, PostgreSQL, MongoDB, and SQLite with SSH tunneling support.
MCP server for querying PostgreSQL databases
Docker for AI agents — containers, compose stacks, logs and databases, locally or over SSH.
MCP server for local SQLite database operations
Database MCP server for MySQL, MariaDB, PostgreSQL & SQLite with PII redaction and write-prevention
Answers built from our own checks of this server.