MCP server for PostgreSQL: local, Docker, RDS, Neon, Supabase, or behind an SSH bastion.
registry version 0.3.1
npm
npx -y mcp-postgres-servernpm
npx -y mcp-postgres-server@0.3.1
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>"
}
}
}
}{
"mcpServers": {
"mcp-postgres-server": {
"command": "npx",
"args": [
"-y",
"mcp-postgres-server@0.3.1"
],
"env": {
"DATABASE_URL": "<YOUR_DATABASE_URL>",
"PG_PASSWORD": "<YOUR_PG_PASSWORD>"
}
}
}
}Format verified against the official Claude Desktop docs ↗.
terminal
claude mcp add --env DATABASE_URL=<YOUR_DATABASE_URL> --env PG_PASSWORD=<YOUR_PG_PASSWORD> mcp-postgres-server -- npx -y mcp-postgres-server
claude mcp add --env DATABASE_URL=<YOUR_DATABASE_URL> --env PG_PASSWORD=<YOUR_PG_PASSWORD> mcp-postgres-server -- npx -y mcp-postgres-server@0.3.1
Format verified against the official Claude Code docs ↗.
.cursor/mcp.json
{
"mcpServers": {
"mcp-postgres-server": {
"command": "npx",
"args": [
"-y",
"mcp-postgres-server"
],
"env": {
"DATABASE_URL": "<YOUR_DATABASE_URL>",
"PG_PASSWORD": "<YOUR_PG_PASSWORD>"
}
}
}
}{
"mcpServers": {
"mcp-postgres-server": {
"command": "npx",
"args": [
"-y",
"mcp-postgres-server@0.3.1"
],
"env": {
"DATABASE_URL": "<YOUR_DATABASE_URL>",
"PG_PASSWORD": "<YOUR_PG_PASSWORD>"
}
}
}
}Format verified against the official Cursor docs ↗.
.vscode/mcp.json
{
"servers": {
"mcp-postgres-server": {
"command": "npx",
"args": [
"-y",
"mcp-postgres-server"
],
"env": {
"DATABASE_URL": "<YOUR_DATABASE_URL>",
"PG_PASSWORD": "<YOUR_PG_PASSWORD>"
}
}
}
}{
"servers": {
"mcp-postgres-server": {
"command": "npx",
"args": [
"-y",
"mcp-postgres-server@0.3.1"
],
"env": {
"DATABASE_URL": "<YOUR_DATABASE_URL>",
"PG_PASSWORD": "<YOUR_PG_PASSWORD>"
}
}
}
}Format verified against the official VS Code docs ↗.
mcp_config.json
{
"mcpServers": {
"mcp-postgres-server": {
"command": "npx",
"args": [
"-y",
"mcp-postgres-server"
],
"env": {
"DATABASE_URL": "<YOUR_DATABASE_URL>",
"PG_PASSWORD": "<YOUR_PG_PASSWORD>"
}
}
}
}{
"mcpServers": {
"mcp-postgres-server": {
"command": "npx",
"args": [
"-y",
"mcp-postgres-server@0.3.1"
],
"env": {
"DATABASE_URL": "<YOUR_DATABASE_URL>",
"PG_PASSWORD": "<YOUR_PG_PASSWORD>"
}
}
}
}Format verified against the official Windsurf docs ↗.
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⭐ 23 stars · 最近更新于 56 天前 · MIT license
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.
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
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.
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.
Any MCP-compatible client can use it, including Claude Desktop, Claude Code, Cursor, VS Code, Windsurf and custom agents.
Publish this server? Link back with a badge on your README or site — copy either snippet.
Markdown
[](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>