P

PostgreSQL

MCP server · by antonorlov

Databases npm v0.3.1

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

View source ↗ Website ↗ Generate config for multiple servers More servers

Install

registry version 0.3.1

npm
npx -y mcp-postgres-server

Setup by client

Pick your client — the config below is generated for this server (local stdio). Copy respects the “Pin version” switch above.

claude_desktop_config.json

{
  "mcpServers": {
    "mcp-postgres-server": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-postgres-server"
      ],
      "env": {
        "DATABASE_URL": "<YOUR_DATABASE_URL>",
        "PG_PASSWORD": "<YOUR_PG_PASSWORD>"
      }
    }
  }
}

Format verified against the official Claude Desktop docs ↗.

Environment variables

Defined in the server's official registry manifest. Required secrets are shown as <YOUR_…> placeholders in the configs above.

  • DATABASE_URL secret — 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 secret — 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 nee

GitHub

⭐ 23 stars · 最近更新于 56 天前 · MIT license

About this server

MCP PostgreSQL Server A Model Context Protocol (MCP) server for PostgreSQL: local, Docker, RDS, Neon, and Supabase databases. The server is small and auditable, with four runtime dependencies: the MCP SDK, pg , pg connection string , and zod (plus ssh2 , an optional dependency used only for SSH tunn…

Summary from the project README — github.com/antonorlov/mcp-postgres-server

Distributed as npm, listed under Databases. Review our MCP security guide before granting access to real data.

Frequently asked questions

What does the PostgreSQL MCP server do?

MCP PostgreSQL Server A Model Context Protocol (MCP) server for PostgreSQL: local, Docker, RDS, Neon, and Supabase databases. The server is small and auditable, with four runtime dependencies: the MCP SDK, pg , pg connection string , and zod (plus ssh2 , an optional dependency used only for SSH tunn

How do I install PostgreSQL?

Run the install command shown above, then paste the config for your client (Claude Desktop, Claude Code, Cursor, VS Code or Windsurf) into its MCP settings and restart the client.

Is PostgreSQL free to use?

The MCP server itself is free to install. The source is public on https://github.com/antonorlov/mcp-postgres-server. Any third-party service it calls may require its own API key and account.

Which clients support PostgreSQL?

Any MCP-compatible client can use it, including Claude Desktop, Claude Code, Cursor, VS Code, Windsurf and custom agents.

Add this badge

Publish this server? Link back with a badge on your README or site — copy either snippet.

Listed on MCPNav

Markdown

[![Listed on MCPNav](https://mcpnav.net/badge/mcp-postgres-server.svg)](https://mcpnav.net/server/mcp-postgres-server/)

HTML

<a href="https://mcpnav.net/server/mcp-postgres-server/"><img src="https://mcpnav.net/badge/mcp-postgres-server.svg" alt="Listed on MCPNav" height="20"></a>