MCP ConfigsMay 14, 2026·2 min read

pg-mcp-server — Postgres MCP Server (Read-Only)

Connect LLMs to PostgreSQL via MCP with pg-mcp-server: run via npx, default stdio transport, and keep writes disabled unless explicitly enabled.

Agent ready

This asset can be read and installed directly by agents

TokRepo exposes a universal CLI command, install contract, metadata JSON, adapter-aware plan, and raw content links so agents can judge fit, risk, and next actions.

Native · 94/100Policy: allow
Agent surface
Any MCP/CLI agent
Kind
Mcp
Install
Npx
Trust
Trust: Established
Entrypoint
npx --yes pg-mcp-server --transport stdio
Universal CLI install command
npx tokrepo install 251c0dd6-bd54-5c52-932a-42bf25b34b3e
Intro

Connect LLMs to PostgreSQL via MCP with pg-mcp-server: run via npx, default stdio transport, and keep writes disabled unless explicitly enabled.

Best for: Developers who want controlled Postgres access for agents (read-only by default)

Works with: Any MCP client that can run stdio or streamable HTTP; requires DATABASE_URL

Setup time: 6-15 minutes

Key facts (verified)

  • GitHub: 176 stars · 15 forks · pushed 2025-11-03.
  • License: MIT · owner avatar + repo URL verified via GitHub API.
  • README-backed entrypoint: npx --yes pg-mcp-server --transport stdio.

Main

  • Keep writes off: README documents DANGEROUSLY_ALLOW_WRITE_OPS=false by default; start with read-only query + schema inspection.

  • Pick the transport your client supports: stdio is the default; HTTP mode serves a Streamable HTTP endpoint at /mcp (PORT defaults to 3000).

  • Use the provided resources (postgres://tables, postgres://table/{schema}/{table}) to keep prompts short and structured.

Source-backed notes

  • README provides an MCP client config snippet that runs npx --yes pg-mcp-server --transport stdio with DATABASE_URL set.
  • README lists env vars: DATABASE_URL, DANGEROUSLY_ALLOW_WRITE_OPS (default false), DEBUG, and PG_SSL_ROOT_CERT.
  • README documents tools/resources including query plus postgres://tables and postgres://table/{schema}/{table}.

FAQ

  • Can it connect over HTTP?: Yes. README says HTTP mode serves /mcp on PORT (default 3000).
  • Is it safe to enable writes?: Only if you understand the risk. Keep writes disabled until you have guardrails and allowlists.
  • Do I need a global install?: No. README supports running via npx --yes ... without installing globally.
🙏

Source & Thanks

Source: https://github.com/ericzakariasson/pg-mcp-server > License: MIT > GitHub stars: 176 · forks: 15

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets