Postgres (read-only transactions)
What it does
Drop-in replacement for @modelcontextprotocol/server-postgres that is actually read-only.
- Connects Läuft auf deinem Computer
- Account or key No key needed
- Category Datenbanken & Datensätze
Installation
Wähle die KI-App, die du nutzt, und kopiere die Einstellungen.
3/3 Prüfungen bestanden · Läuft auf deinem Computer · ✓ Befehle geprüft am 13. Nov. 2026
Zuerst: Welche KI nutzt du?
Wähle deine App, dann erscheinen die Schritte unten.
Klappt mit Claude, aber erst etwas vorbereiten
Installiere zuerst Node.js auf deinem Computer (nur einmal) · Nur in der Claude-App für den Computer (Windows oder Mac), nicht im Web oder auf dem Handy
Node.js installieren
Nur einmal; gilt für alle Server, die Node.js brauchen
Einstellungsdatei der Claude-Desktop-App öffnen
SettingsDeveloperEdit Config
Diese Einstellungen einfügen und speichern
{ "mcpServers": { "postgres-safe": { "command": "npx", "args": [ "-y", "postgres-mcp-safe" ] } } }Claude beenden und neu öffnen
Ausprobieren
Nutze Postgres (read-only transactions) und sag mir, was du für mich tun kannst; zeig mir dann eine Sache✓ Wenn Claude sagt, dass es Postgres (read-only transactions) nutzt, oder ein Werkzeug von Postgres (read-only transactions) in der Antwort zeigt, bist du verbunden
Menünamen am 11. Nov. 2026 mit der Hilfe von Anthropic abgeglichen · dein Bildschirm kann je nach App-Version leicht abweichen
ChatGPT kann Postgres (read-only transactions) noch nicht verbinden
Postgres (read-only transactions) läuft auf deinem Computer, aber ChatGPT verbindet nur Server, die im Web laufen
Das kannst du stattdessen tun
A · Eine App nutzen, die Postgres (read-only transactions) verbinden kann
- Installiere zuerst Node.js auf deinem Computer (nur einmal) · Nur in der Claude-App für den Computer (Windows oder Mac), nicht im Web oder auf dem Handy
- Installiere zuerst Node.js auf deinem Computer (nur einmal)
- Installiere zuerst Node.js auf deinem Computer (nur einmal) · Kein Ein-Klick-Button: Einstellungen einfügen und Werte selbst ausfüllen
- Installiere zuerst Node.js auf deinem Computer (nur einmal) · Kein Ein-Klick-Button: Einstellungen einfügen und Werte selbst ausfüllen
B · Andere in Datenbanken & Datensätze, die mit ChatGPT funktionieren
Aus den meistgenutzten derselben Kategorie, nur solche, die per Adresse ohne Schlüssel verbinden
- Supabase✓ ChatGPT
- Appwrite MCP✓ ChatGPT
- Pg Aiguide✓ ChatGPT
Klappt mit Claude Code, aber erst etwas vorbereiten
Installiere zuerst Node.js auf deinem Computer (nur einmal)
Node.js installieren
Nur einmal; gilt für alle Server, die Node.js brauchen
Terminal öffnen
Mac: Command+Leertaste drücken und Terminal tippen · Windows: PowerShell öffnen
Diesen Befehl einfügen und Enter drücken
claude mcp add --scope user postgres-safe -- npx -y postgres-mcp-safe/mcp in Claude Code eingeben
Postgres (read-only transactions) sollte in der Liste als verbunden erscheinen
Ausprobieren
Nutze Postgres (read-only transactions) und sag mir, was du für mich tun kannst; zeig mir dann eine Sache✓ Wenn Claude Code sagt, dass es Postgres (read-only transactions) nutzt, oder ein Werkzeug von Postgres (read-only transactions) in der Antwort zeigt, bist du verbunden
Menünamen am 11. Nov. 2026 mit der Hilfe von Anthropic abgeglichen · dein Bildschirm kann je nach App-Version leicht abweichen
Klappt mit Cursor, aber erst etwas vorbereiten
Installiere zuerst Node.js auf deinem Computer (nur einmal) · Kein Ein-Klick-Button: Einstellungen einfügen und Werte selbst ausfüllen
Node.js installieren
Nur einmal; gilt für alle Server, die Node.js brauchen
MCP-Einstellungsdatei von Cursor öffnen
~/.cursor/mcp.json
Diese Einstellungen einfügen, leere Werte ausfüllen und speichern
{ "mcpServers": { "postgres-safe": { "command": "npx", "args": [ "-y", "postgres-mcp-safe" ] } } }KI-Chat in Cursor im Agent-Modus öffnen
Ausprobieren
Nutze Postgres (read-only transactions) und sag mir, was du für mich tun kannst; zeig mir dann eine Sache✓ Wenn Cursor sagt, dass es Postgres (read-only transactions) nutzt, oder ein Werkzeug von Postgres (read-only transactions) in der Antwort zeigt, bist du verbunden
Menünamen am 11. Nov. 2026 mit der Hilfe von Cursor abgeglichen · dein Bildschirm kann je nach App-Version leicht abweichen
Klappt mit VS Code, aber erst etwas vorbereiten
Installiere zuerst Node.js auf deinem Computer (nur einmal) · Kein Ein-Klick-Button: Einstellungen einfügen und Werte selbst ausfüllen
Node.js installieren
Nur einmal; gilt für alle Server, die Node.js brauchen
MCP-Einstellungsdatei von VS Code öffnen
MCP: Open User Configuration
Diese Einstellungen einfügen, leere Werte ausfüllen und speichern
{ "servers": { "postgres-safe": { "type": "stdio", "command": "npx", "args": [ "-y", "postgres-mcp-safe" ] } } }KI-Chat in VS Code im Agent-Modus öffnen
Ausprobieren
Nutze Postgres (read-only transactions) und sag mir, was du für mich tun kannst; zeig mir dann eine Sache✓ Wenn VS Code sagt, dass es Postgres (read-only transactions) nutzt, oder ein Werkzeug von Postgres (read-only transactions) in der Antwort zeigt, bist du verbunden
Menünamen am 11. Nov. 2026 mit der Hilfe von VS Code abgeglichen · dein Bildschirm kann je nach App-Version leicht abweichen
Für Entwickler: Terminal-Befehle und JSON-Einstellungen
Auf deinem Computer installiert
Claude Code
claude mcp add --scope user postgres-safe -- npx -y postgres-mcp-safeClaude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"postgres-safe": {
"command": "npx",
"args": [
"-y",
"postgres-mcp-safe"
]
}
}
}Cursor (~/.cursor/mcp.json)
{
"mcpServers": {
"postgres-safe": {
"command": "npx",
"args": [
"-y",
"postgres-mcp-safe"
]
}
}
}VS Code (mcp.json)
{
"servers": {
"postgres-safe": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"postgres-mcp-safe"
]
}
}
}Diese Einstellungen werden aus dem Registry-Eintrag des Entwicklers erzeugt. Wenn in der README etwas anderes steht, folge der README.
Auf einen Blick
- Downloads pro Wochei
- 498/Wo.
- Verbindung
- Läuft auf deinem Computer
- Neueste Versioni
- 0.1.3
- Kategoriei
- Datenbanken & Datensätze
- In der Registry veröffentlichti
- 3. Nov. 2026
- Code zuletzt geänderti
- 3. Nov. 2026
- Entwickler
- Poudel0
- Pakete
npm: postgres-mcp-safeoci: ghcr.io/poudel0/postgres-mcp-safe:0.1.3- Registry-Status
- Aktiv
Welche Apps ihn nutzen können
Basierend darauf, wie sich dieser Server verbindet, und auf der eigenen Doku jeder App, geprüft am 10. Nov. 2026.
Laufen auf deinem Computer in
ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatRaycast
Was er kann
Läuft auf deinem Computer; die Tool-Liste erscheint nach der Installation in deiner KI-App.
Basischecksi
Wir prüfen Informationen, die jeder sehen kann; den Code haben wir nicht gelesen. Checks, die nicht zutreffen, werden nicht mitgezählt. · Geprüft am 14. Nov. 2026
- ✓ Bestanden
Entwickler passt zum Repo
Der Registry-Name wurde mit dem GitHub-Konto Poudel0 bestätigt, dem das Repo gehört
- ✓ Bestanden
Wird noch gepflegt
Code zuletzt geändert: vor 11 Tagen
- ✓ Bestanden
Hat eine Lizenz
Nutzt MIT
- – Nicht zutreffend
Endpunkt antwortet
Dieser Server läuft auf deinem Computer; es gibt keinen Endpunkt im Internet
- – Nicht zutreffend
Anmeldung mit OAuth
Läuft auf deinem Computer und nutzt stattdessen lokale Einstellungen
- … Noch nicht geprüft
Keine versteckten Anweisungen in Tool-Beschreibungen
Läuft auf deinem Computer; Tool-Listen können wir nur von Endpunkten im Internet lesen
Diskussion
Fragen, Tipps teilen oder melden, dass etwas nicht geht. Sortiert nach „hilfreich“.
Noch keine Beiträge. Stell die erste Frage oder teile einen Tipp.
Beiträge hier stammen von Nutzern, nicht vom PopNx-Team.
Nutzerbewertungen
Noch keine Bewertungen
Im Vergleich mit anderen in Datenbanken & Datensätzei
- Mehr Sterne als 79 % der anderen 1193 Server in dieser Kategorie
- Neuer in der Registry veröffentlicht als 80 % der anderen 1193 Server in dieser Kategorie
- Basischecks gleich gut wie oder besser als bei 100 % der anderen 1193 Server in dieser Kategorie
Verglichen mit allen aktiven Servern dieser Kategorie in der Registry. Sterne zählen nur, wenn dem Herausgeber das Repo gehört.
Häufige Fragen
Ist Postgres (read-only transactions) sicher?
Er hat 3 von 3 zutreffenden Basischecks bestanden. Den Code haben wir nicht gelesen. Bevor du einen Schlüssel oder Token hinzufügst, sieh nach, welche Zugriffe der Server verlangt, und nutze einen Schlüssel, der nur die Berechtigungen hat, die du brauchst.
Welche Schlüssel oder Codes braucht er?
Die Registry nennt keinen erforderlichen Schlüssel, manche Server bitten dich aber bei der ersten Nutzung, dich anzumelden.
Läuft er auf meinem Computer oder in der Cloud?
Er läuft auf deinem Computer. Deine KI-App startet ihn bei Bedarf, und die Daten laufen nicht über die Server des Entwicklers (außer der Server ruft selbst einen Onlinedienst auf).
Wird er noch gepflegt?
Das GitHub-Repo wurde zuletzt vor 11 Tagen geändert, und die neueste Version (0.1.3) kam vor 11 Tagen in die Registry.
Welche Apps können ihn nutzen?
Apps, die MCP unterstützen, etwa Claude Desktop, Claude Code, Cursor und VS Code. Außerdem brauchst du Node.js, Docker auf deinem Computer.
Was kann ich stattdessen nutzen?
In derselben Kategorie: Dbx, MCP Toolbox for Databases, MCP Toolbox for Databases
Andere in derselben Kategorie
Server derselben Kategorie von anderen Entwicklern, sortiert nach Sternen.
So liest du eine Karte:↓ Downloads pro Wochei★ GitHub-SterneiDrei Säulen: Bewertungen · Checks · NutzungiAktualisiert = neueste Version in der Registry veröffentlichti
MCP Toolbox for Databases
MCP Toolbox for Databases enables your agent to connect to your database.
MCP Toolbox for Databases
MCP Toolbox for Databases enables your agent to connect to your database.
README vom Entwickler
README öffnen
Unverändert aus dem Repo des Entwicklers übernommen. PopNx MCP hat den Inhalt weder geprüft noch empfiehlt es ihn. HTML, Bilder und Skripte wurden entfernt. Links führen von dieser Website weg.
postgres-mcp-safe
A drop-in replacement for the deprecated @modelcontextprotocol/server-postgres, but actually read-only.
Lets AI tools (Claude, Cursor, Zed, ...) query a Postgres database, read its schema and explain queries. Swap the package name in your MCP config and keep everything else.
Migrating from server-postgres
{
"mcpServers": { "postgres": { "command": "npx",
- "args": ["-y", "@modelcontextprotocol/server-postgres", "postgresql://localhost/mydb"]
- "args": ["-y", "postgres-mcp-safe", "postgresql://localhost/mydb"] } }
}
Docker: docker run -i --rm ghcr.io/poudel0/postgres-mcp-safe postgresql://host.docker.internal:5432/mydb. Binaries for Linux, macOS and Windows are on the releases page.
One catch: if your URL logs in as a superuser (like Docker's default postgres user), every call is refused until you either create a read-only role (recommended) or add --allow-superuser before the URL. A superuser can get around a read-only transaction, so we won't pretend otherwise.
The old server's query tool and postgres://.../ /schema resources work the same. See Differences for the small, deliberate changes.
Why
The old server's "read-only" mode can be broken with COMMIT; DROP TABLE ... (Datadog Security Labs, 2025-08-21). A fix was merged upstream but never published, and the package is deprecated with no official successor.
Flags
Flags go before the URL.
| Flag | Default | |
|---|---|---|
--timeout | 30s | Time limit per call. |
--max-rows | 1000 | Rows returned per call. Extra rows are cut off with a note. |
--max-bytes | 262144 | JSON bytes returned per call, and the max size of a single row. |
--allow-explain-analyze | off | Lets explain run EXPLAIN ANALYZE, which executes the query. |
--allow-superuser | off | Allows a superuser role, or a member of one. Read-only is then not guaranteed. |
Each call opens a fresh connection (that's part of the safety model). Against a remote database over TLS that costs a few round trips: about 0.5 s per call at 50 ms latency. On Postgres 17+ you can save one round trip by adding sslnegotiation=direct to the URL.
Limits can't be turned off; 0 is an error. The URL can also be a keyword DSN (host=db dbname=app), and the standard PG* environment variables (PGPASSWORD, ...) are read as libpq would.
Tools
| Tool | Input | |
|---|---|---|
query | sql | One read-only statement. Returns a JSON array of rows. |
list_tables | schema? | Tables and views with schema and type. |
describe_table | table, schema? (public) | Columns, constraints and indexes. |
explain | sql, analyze? | Query plan. analyze needs --allow-explain-analyze. |
How read-only is enforced
Postgres enforces it, not a SQL parser. Every call:
- Opens a fresh connection (no session state survives a call) and starts a
READ ONLYtransaction. - Sends your SQL as a single protocol-level *Parse* message. Postgres rejects more than one statement there, so
COMMIT; ...fails before anything runs. - Runs it only if Postgres says it returns rows.
COMMIT,SET,DO,COPY,CALL,PREPAREand friends are rejected without running. - Applies
statement_timeout, a client deadline, and row and byte caps. - Closes the connection, which ends the transaction.
The bypass suite runs every known payload against a real database and checks a canary table after each one:
| Payload | Result |
|---|---|
COMMIT; DROP SCHEMA public CASCADE; | Rejected: multiple statements |
COMMIT / SET TRANSACTION READ WRITE / DO $$...$$ / CALL p() | Rejected: returns no rows |
COPY (SELECT 1) TO PROGRAM '...' (as superuser) | Rejected: returns no rows |
DELETE ... RETURNING * / WITH d AS (DELETE ...) SELECT ... | Read-only transaction error |
SELECT nextval('s') | Read-only transaction error |
SELECT set_config('transaction_read_only','off',true) | Error |
SELECT pg_sleep(600), even after set_config('statement_timeout','0') | Cancelled at --timeout |
SELECT pg_advisory_lock(1) | Released when the call ends |
SELECT generate_series(1,10000000) / repeat('x', 10000000) | Capped / rejected, memory stays bounded |
explain with ANALYZE SELECT ... | Syntax error: can't smuggle ANALYZE |
Found a bypass? Open an issue. It becomes a test row before the fix.
Use a read-only role too
This server makes each call read-only at the transaction level. Some things are out of a transaction's reach, and only the database role stops them:
dblink_exec(...)opens a *separate* session that isn't read-only.pg_terminate_backend(...)kills other connections.- A superuser can read server files (
pg_read_file,pg_ls_dir): read-only stops writes, not reads. - A superuser can write server files with
lo_export, even inside a read-only transaction.
So connect as a role that can only read:
CREATE ROLE mcp_ro LOGIN PASSWORD '...';
GRANT pg_read_all_data TO mcp_ro; -- PG 14+; or GRANT SELECT on what it needs ALTER ROLE mcp_ro SET default_transaction_read_only = on;
Because of the last two, the server refuses superuser roles (and members of them) unless you pass --allow-superuser.
Differences from server-postgres
- Errors in a tool call come back as a tool result with
isError: trueand the Postgres message and SQLSTATE, so the model can fix its SQL. The old server sent a JSON-RPC error. resources/readonly shows columns of thepublictable, in column order. The old one mixed in columns from same-named tables in other schemas.- Percent-encoded table names in resource URIs are decoded (the old server never matched them).
- Values are what Postgres prints, typed where it's clear: booleans, numbers (including
bigintandnumeric) andjsonare JSON values; everything else is a string such as"2026-01-02 03:04:05+00","\\x0102"or"{x,y}".NaNis"NaN"(the old server gavenull). - Statements that return no rows (
SET,DO,COPY, ...) are rejected. The old server ran them and returned[].
Development
docker run -d --name pg-mcp-test -e POSTGRES_PASSWORD=postgres -p 127.0.0.1:5434:5432 postgres:17-alpine
export DATABASE_URL='postgresql://postgres:postgres@127.0.0.1:5434/postgres?sslmode=disable' make test # all tests, including the bypass suite make golden # re-record the old server's output (needs npx)
DATABASE_URL must be a superuser: the fixture resets the public schema and creates the mcp_ro role. Use a throwaway database.