프로토타입 · 미리 보기: 공식 레지스트리의 모든 서버를 담고 있으며 30분마다 동기화해요. 리뷰와 계정 기능은 다음 단계에서 열려요.
PopNx MCPAI를 쓰는 사람을 위한 MCP 서버 · 쉬운 말로 설명해요

PostgreSQL

제작자: antonorlov버전 0.3.1i★ –i내 컴퓨터에서 실행
레지스트리 이름io.github.antonorlov/mcp-postgres-server

설치

개요

제작자가 쓴 설명(영어 원문)

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

PopNx MCP의 세 기둥

이 세 가지는 절대 하나의 점수로 합치지 않아요. 의견, 측정, 인기는 서로 다른 것이니까요.

할 수 있는 일

이 서버는 아직 쉬운 말로 된 요약을 쓰지 못했어요. 아래는 레지스트리에서 읽어 온 사실이에요.

  • 연결 방식: 내 컴퓨터에서 실행
  • 전송 방식: stdio
  • 카테고리: 데이터베이스 및 데이터셋
  • 입력해야 할 값: DATABASE_URL, PG_PASSWORD, PG_SSH_PASSPHRASE, PG_SSH_PASSWORD

설치

쓰고 있는 AI 앱을 고른 다음 설정을 복사하세요.

설치하기 전에

  • 기본 점검: 1개 중 1개 통과
  • 내 컴퓨터에서 내 사용자 계정의 권한(파일, 네트워크, 앱)으로 실행돼요.
  • 직접 입력할 값: DATABASE_URL, PG_HOST, PG_PORT, PG_USER, PG_PASSWORD, PG_DATABASE, PG_ALLOW_WRITE, PG_SSLMODE, PG_SSL_CA, PG_ENABLE_RUNTIME_CONNECT, PG_MAX_RESULT_BYTES, PG_STATEMENT_TIMEOUT, PG_CONNECT_TIMEOUT, PG_SSH_HOST, PG_SSH_PORT, PG_SSH_USER, PG_SSH_PRIVATE_KEY, PG_SSH_PASSPHRASE, PG_SSH_AGENT, PG_SSH_PASSWORD, PG_SSH_FINGERPRINT, PG_SSH_KEEPALIVE_INTERVAL

비밀로 표시된 값은 내 계정의 열쇠예요. 절대 다른 사람과 공유하거나 채팅에 붙여 넣지 마세요.

필요한 것

  • npmNode.js 설치(npx 명령어용)

어떤 앱을 쓰세요?

위에서 앱을 고르세요. 기억해 두었다가 다음부터는 버튼에 “…에 설치”라고 표시해요.

Claude Desktop → Settings → Developer → Edit Config를 열고 claude_desktop_config.json에 이 내용을 붙여 넣으세요

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

터미널에서 이 명령어를 실행하세요

claude mcp add postgres --env DATABASE_URL=your-value --env PG_HOST=your-value --env PG_PORT=your-value --env PG_USER=your-value --env PG_PASSWORD=your-value --env PG_DATABASE=your-value --env PG_ALLOW_WRITE=your-value --env PG_SSLMODE=your-value --env PG_SSL_CA=your-value --env PG_ENABLE_RUNTIME_CONNECT=your-value --env PG_MAX_RESULT_BYTES=your-value --env PG_STATEMENT_TIMEOUT=your-value --env PG_CONNECT_TIMEOUT=your-value --env PG_SSH_HOST=your-value --env PG_SSH_PORT=your-value --env PG_SSH_USER=your-value --env PG_SSH_PRIVATE_KEY=your-value --env PG_SSH_PASSPHRASE=your-value --env PG_SSH_AGENT=your-value --env PG_SSH_PASSWORD=your-value --env PG_SSH_FINGERPRINT=your-value --env PG_SSH_KEEPALIVE_INTERVAL=your-value -- npx -y mcp-postgres-server

실행하기 전에 빈 값을 채워 주세요.

Cursor에서 열기

또는 설정을 직접 복사하기

프로젝트의 .cursor/mcp.json 또는 ~/.cursor/mcp.json에 붙여 넣으세요

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

브라우저가 앱을 열지 물어본 다음, 앱이 설정을 보여 주고 확인을 요청해요. 키 값은 비워 두니 직접 입력하세요.

VS Code에서 열기

또는 설정을 직접 복사하기

프로젝트의 .vscode/mcp.json에 붙여 넣으세요

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

브라우저가 앱을 열지 물어본 다음, 앱이 설정을 보여 주고 확인을 요청해요. 키 값은 비워 두니 직접 입력하세요.

이 서버는 내 컴퓨터에서 실행되는데, ChatGPT는 인터넷에 있는 서버에만 연결할 수 있어요. 다른 앱을 고르세요.

선택한 앱은 이 기기의 쿠키에만 저장돼요. 계정은 필요 없어요.

직접 입력할 값

  • DATABASE_URL 비밀 env
    Full connection string (preferred). Supports sslmode in the URL.
  • PG_HOST env
    Database host (fallback when DATABASE_URL is not set).
  • PG_PORT env
    Database port.
  • PG_USER env
    Database user.
  • PG_PASSWORD 비밀 env
    Database password.
  • PG_DATABASE env
    Database name.
  • PG_ALLOW_WRITE env
    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 env
    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 s…
  • PG_SSL_CA env
    Path to a CA certificate file. Setting it by itself implies verify-full.
  • PG_ENABLE_RUNTIME_CONNECT env
    Register the connect_db tool (runtime credential switching).
  • PG_MAX_RESULT_BYTES env
    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 env
    Statement timeout in milliseconds, applied to every session.
  • PG_CONNECT_TIMEOUT env
    Timeout in milliseconds for a single connect attempt (raise it for slow links or SSH tunnels).
  • PG_SSH_HOST env
    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 env
    SSH bastion port.
  • PG_SSH_USER env
    SSH username.
  • PG_SSH_PRIVATE_KEY env
    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 비밀 env
    Passphrase for the private key, if encrypted.
  • PG_SSH_AGENT env
    true to use the ambient agent (SSH_AUTH_SOCK), or an explicit socket path / Windows named pipe.
  • PG_SSH_PASSWORD 비밀 env
    SSH login password. Opt-in; a key or agent takes precedence. Prefer keys, a bastion often disables password auth.
  • PG_SSH_FINGERPRINT env
    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 env
    SSH keepalive interval in ms; the tunnel drops after 3 unanswered keepalives, and the next call reconnects.

이 설정은 제작자의 레지스트리 정보로 만들었어요. README와 다르면 README를 따르세요.

할 수 있는 일

내 컴퓨터에서 실행돼요. 설치하면 AI 앱에 도구 목록이 나타나요.

기본 점검i

누구나 볼 수 있는 정보를 점검했고, 코드는 읽지 않았어요. 해당하지 않는 항목은 개수에서 뺐어요. · 2026년 11월 7일 점검

  • ✓ 통과

    제작자와 저장소 일치

    레지스트리 이름이 GitHub 계정 antonorlov 기준으로 확인되었고, 이 계정이 저장소를 소유하고 있어요

  • … 아직 점검 안 함

    계속 관리되고 있음

    아직 GitHub에서 이 저장소를 읽어 오지 않았어요

  • … 아직 점검 안 함

    라이선스 있음

    아직 GitHub에서 이 저장소를 읽어 오지 않았어요

  • – 해당 없음

    엔드포인트 응답

    내 컴퓨터에서 실행되는 서버라 인터넷 엔드포인트가 없어요

  • – 해당 없음

    OAuth로 로그인

    내 컴퓨터에서 실행되며, 대신 로컬 설정을 사용해요

  • … 아직 점검 안 함

    도구 설명에 숨겨진 지시 없음

    내 컴퓨터에서 실행돼요. 도구 목록은 인터넷 엔드포인트가 있는 서버에서만 읽을 수 있어요

데이터베이스 및 데이터셋 카테고리의 다른 서버와 비교i

  • 이 카테고리의 다른 서버 954개 중 0%보다 스타가 많아요
  • 이 카테고리의 다른 서버 954개 중 38%보다 최근에 레지스트리에 공개됐어요
  • 기본 점검 결과가 이 카테고리의 다른 서버 954개 중 100%와 같거나 더 좋아요

레지스트리에서 이 카테고리의 활성 서버 전체와 비교했어요. 스타는 게시자가 저장소를 소유한 경우에만 세요.

자주 묻는 질문

PostgreSQL, 안전한가요?

해당하는 기본 점검 1개 중 1개를 통과했어요. 코드는 읽지 않았어요. 키나 토큰을 넣기 전에 서버가 어떤 권한을 요구하는지 확인하고, 꼭 필요한 권한만 있는 키를 쓰세요.

어떤 키나 코드가 필요한가요?

입력해야 할 값: DATABASE_URL, PG_PASSWORD, PG_SSH_PASSPHRASE, PG_SSH_PASSWORD

내 컴퓨터에서 실행되나요, 클라우드에서 실행되나요?

내 컴퓨터에서 실행돼요. AI 앱이 필요할 때 실행하고, 데이터는 제작자의 서버를 거치지 않아요(서버 자체가 온라인 서비스를 호출하는 경우는 제외).

아직 관리되고 있나요?

GitHub 저장소는 마지막으로 – 변경됐고, 최신 버전(0.3.1)은 2개월 전 레지스트리에 올라왔어요.

어떤 앱에서 쓸 수 있나요?

Claude Desktop, Claude Code, Cursor, VS Code처럼 MCP를 지원하는 앱에서 쓸 수 있어요. 내 컴퓨터에 Node.js도 있어야 해요.

대신 쓸 수 있는 건 뭐가 있나요?

같은 카테고리에는: Supabase, MongoDB MCP Server, Elasticsearch MCP Server

대안

같은 카테고리에서 다른 제작자가 만든 서버예요. 스타 순으로 정렬했어요.

카드 보는 법:★ GitHub 스타i세 기둥: 리뷰 · 점검 · 사용 정도i업데이트 = 최신 버전을 레지스트리에 공개한 날i

Supabase

제작자: supabase

MCP server for interacting with the Supabase platform

컴퓨터 또는 클라우드★ 2,993Apache-2.0오늘 업데이트
설치

MongoDB MCP Server

제작자: mongodb-js

MongoDB Model Context Protocol Server

내 컴퓨터에서 실행★ 1,157Apache-2.0그저께 업데이트
설치

Elasticsearch MCP Server

제작자: cr7258

MCP server for interacting with Elasticsearch

내 컴퓨터에서 실행★ 315Apache-2.014개월 전 업데이트
설치

제작자의 README

README 열기

제작자의 저장소에서 쓰인 그대로 가져왔어요. PopNx MCP가 검토하거나 보증한 내용이 아니에요. HTML, 이미지, 스크립트는 제거했어요. 링크를 누르면 이 사이트를 벗어나요.

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 tunneling).

Requires Node.js 20 or newer.

Quick start

The preferred way to configure the server is a single DATABASE_URL:

{

"mcpServers": { "postgres": { "type": "stdio", "command": "npx", "args": ["-y", "mcp-postgres-server"], "env": { "DATABASE_URL": "postgres://user:password@localhost:5432/mydb", "PG_ALLOW_WRITE": "false" } } } }

With PG_ALLOW_WRITE set to "false" the server has read-only access to the database. This is the default; set it to "true" only if the model must write.

The same JSON works in any MCP client that speaks stdio: VS Code, Cursor, Claude Code, Codex, Windsurf.

Alternatively, set the individual PG_* variables; they are used when DATABASE_URL is not set:

{

"mcpServers": { "postgres": { "type": "stdio", "command": "npx", "args": ["-y", "mcp-postgres-server"], "env": { "PG_HOST": "your_host", "PG_PORT": "5432", "PG_USER": "your_user", "PG_PASSWORD": "your_password", "PG_DATABASE": "your_database", "PG_ALLOW_WRITE": "false" } } } }

Manual Installation
npm install mcp-postgres-server

Or run directly with:

npx mcp-postgres-server

Connect to your database

Local Postgres:

DATABASE_URL=postgres://mcp_readonly:secret@localhost:5432/mydb

Postgres in Docker: if the database runs in a container with a published port, connect to localhost: as usual. If the *MCP server itself* runs inside a container and the database runs on your host machine, use host.docker.internal instead of localhost:

DATABASE_URL=postgres://mcp_readonly:secret@host.docker.internal:5432/mydb

Amazon RDS:

DATABASE_URL=postgres://mcp_readonly:secret@mydb.xxxxxx.us-east-1.rds.amazonaws.com:5432/mydb?sslmode=require

Neon:

DATABASE_URL=postgres://mcp_readonly:secret@ep-xxx-xxx.us-east-2.aws.neon.tech/mydb?sslmode=require

Supabase:

DATABASE_URL=postgres://postgres.xxxxxxxx:secret@aws-0-us-east-1.pooler.supabase.com:5432/postgres?sslmode=require

Tools

Tool availability depends on configuration:

ToolAvailable
query, list_schemas, list_tables, describe_tableAlways
executeAlways (refuses writes unless PG_ALLOW_WRITE=true)
connect_dbOnly when PG_ENABLE_RUNTIME_CONNECT=true
1. query

Execute a read-only SQL statement. Accepts SELECT, WITH ... SELECT, EXPLAIN, and SHOW. One statement per call - multi-statement input is rejected by the extended query protocol. In read-only mode (the default) the statement runs as BEGIN READ ONLY, the query, and ROLLBACK - three commands, roughly two network round trips with pipelining - so the database itself refuses any write. With PG_ALLOW_WRITE=true the statement is sent directly, without that wrapper, so a write run through query would execute - use execute for writes. Supports PostgreSQL-style $1, $2 prepared-statement parameters; values are bound by the driver and never spliced into the SQL text.

use_mcp_tool({

server_name: "postgres", tool_name: "query", arguments: { sql: "SELECT * FROM users WHERE id = $1", params: [1] } });

Returns compact JSON: {"rows": [...], "rowCount": n, "returnedRows": n, "truncated": false}. When the serialized rows exceed PG_MAX_RESULT_BYTES, only the rows that fit are returned (returnedRows < rowCount), truncated is true, and a hint suggests adding LIMIT/WHERE or selecting fewer columns.

2. list_schemas

List all schemas in the connected database.

use_mcp_tool({

server_name: "postgres", tool_name: "list_schemas", arguments: {} });

3. list_tables

List tables in the connected database. Accepts an optional schema parameter (defaults to 'public').

// List tables in the 'public' schema (default)

use_mcp_tool({ server_name: "postgres", tool_name: "list_tables", arguments: {} });

// List tables in a specific schema use_mcp_tool({ server_name: "postgres", tool_name: "list_tables", arguments: { schema: "my_schema" } });

4. describe_table

Get the structure of a specific table (columns, types, nullability, defaults, primary keys). Accepts an optional schema parameter (defaults to 'public').

use_mcp_tool({

server_name: "postgres", tool_name: "describe_table", arguments: { table: "users", schema: "my_schema" // optional } });

5. execute - requires PG_ALLOW_WRITE=true

Execute an INSERT, UPDATE, DELETE, or DDL statement. Always registered, but in read-only mode (the default) it refuses with an error naming PG_ALLOW_WRITE and changes nothing - the statement never reaches the database. With PG_ALLOW_WRITE=true it runs: same $1, $2 parameter handling as query, one complete statement per call, and the connecting role governs what it may do. Returns {"rowCount": n, "command": "INSERT"}.

use_mcp_tool({

server_name: "postgres", tool_name: "execute", arguments: { sql: "INSERT INTO users (name, email) VALUES ($1, $2)", params: ["John Doe", "john@example.com"] } });

6. connect_db - requires PG_ENABLE_RUNTIME_CONNECT=true

Connect to a different PostgreSQL database at runtime using provided credentials. Not registered by default - prefer configuring credentials through the environment so they never pass through model-visible arguments. Session limits (statement_timeout, idle_in_transaction_session_timeout) are re-applied after every reconnect; read-only reads enforce read-only in their own BEGIN READ ONLY transaction.

use_mcp_tool({

server_name: "postgres", tool_name: "connect_db", arguments: { host: "localhost", port: 5432, user: "your_user", password: "your_password", database: "your_database" } });

Configuration reference

VariableDefaultDescription
DATABASE_URL-Full connection string (preferred). Supports ?sslmode= in the URL.
PG_HOST-Database host (fallback when DATABASE_URL is not set)
PG_PORT5432Database port
PG_USER-Database user
PG_PASSWORD-Database password
PG_DATABASE-Database name
PG_ALLOW_WRITEfalseWhen 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-disable \allow \prefer \require \verify-ca \verify-full. require/allow/prefer encrypt without verifying the certificate; verify-ca/verify-full verify (supply a CA via PG_SSL_CA). Unrecognized values fail at startup. Limitation: unlike libpq, allow/prefer do not fall back to plaintext (node-postgres has no opportunistic SSL), 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_CONNECTfalseRegister the connect_db tool (runtime credential switching)
PG_MAX_RESULT_BYTES32768Byte budget for a query result sent to the model. Whole rows are kept while they fit; over the budget returnedRows < rowCount and truncated: true (if not even the first row fits, returnedRows is 0 with a hint). ~32 KiB ≈ 8k tokens; lower it for strict clients, raise it if your client allows more.
PG_STATEMENT_TIMEOUT30000Statement timeout in milliseconds, applied to every session
PG_CONNECT_TIMEOUT10000Timeout in milliseconds for a single connect attempt (raise it for slow links or SSH tunnels)

To reach a database only accessible through a bastion, see SSH tunneling (adds PG_SSH_* variables).

Features

  • Read-only by default; writes are an explicit opt-in (PG_ALLOW_WRITE=true)
  • Read-only enforced by the engine (BEGIN READ ONLY), never by client-side SQL parsing
  • Data access behind a small typed interface; the pg driver never leaks past it
  • DATABASE_URL support with SSL (sslmode=disable|allow|prefer|require|verify-ca|verify-full, custom CA)
  • Prepared-statement parameters: $1-style placeholders, bound by the driver
  • Result size cap (byte budget) with an explicit truncated flag instead of flooding the model's context
  • Session statement timeout plus a client deadline; transaction poolers may not preserve session settings
  • Errors returned as readable tool results with SQLSTATE-based hints, so the model can self-correct
  • Survives dropped connections - reconnects lazily instead of crashing
  • Optional SSH tunneling (PG_SSH_*) with mandatory host-key verification, loaded only when configured
  • MCP tool annotations (read-only / destructive hints) per spec 2025-11-25
  • Multi-schema support for database operations

Security

Full details, including the threat model and disclosure process, are in SECURITY.md. The short version:

  1. A least-privilege database role is the real boundary. The MCP works with existing credentials; creating or changing roles is not required. A dedicated role is what actually guarantees writes are impossible. On PostgreSQL 14+, the following is a starting point:
   CREATE ROLE mcp_readonly LOGIN PASSWORD 'change-me';

GRANT CONNECT ON DATABASE your_database TO mcp_readonly; GRANT pg_read_all_data TO mcp_readonly; -- adds read privileges ALTER ROLE mcp_readonly SET default_transaction_read_only = on; -- read-only by default

(On PostgreSQL 13 or older, grant SELECT explicitly instead of pg_read_all_data - see SECURITY.md.) The server warns on stderr if you connect as a superuser. Read grants do not revoke existing privileges, and defaults remain mutable; available functions, ownership and inherited privileges also matter.

  1. The engine enforces read-only. There is no client-side SQL parsing. In read-only mode every read runs in a rolled-back BEGIN READ ONLY transaction, so PostgreSQL itself - which alone knows what a function, view, or rule does - refuses any write with SQLSTATE 25006 and reverts any session change the statement made. The extended protocol rejects multi-command strings.

Honest framing: the read-only transaction is defense-in-depth on top of the role, not a replacement for it. Read-only mode stops a confused or prompt-injected model from *writing* to your database; it does not stop prompt injection carried in the row data a query returns. Don't point this server at production - use a replica, a snapshot, or a tightly scoped role. See SECURITY.md.

SSH tunneling

Set PG_SSH_HOST (plus auth and host-key verification) to reach a database that is only accessible through a bastion (an SSH jump host). The connection string / PG_* fields then describe the database as seen from the bastion:

{

"mcpServers": { "postgres": { "type": "stdio", "command": "npx", "args": ["-y", "mcp-postgres-server"], "env": { "DATABASE_URL": "postgres://mcp_readonly:secret@db.internal:5432/mydb?sslmode=verify-full",

앞부분만 보여 드려요. 나머지는 저장소에서 읽어 보세요

PopNx에게 묻기