Postgres

Community
modelcontextprotocol

Archived reference server for read-only Postgres queries.

Formerly part of the official monorepo, now kept in servers-archived. Introspects schema and runs SELECT queries with configurable row and timeout limits. Community forks have picked up maintenance.

63k5.2k62/100

What it does

  • Introspects tables, columns, indexes, and foreign keys on connect
  • Executes SELECT statements only, writes are rejected before the query reaches Postgres
  • Applies a per-statement row cap and a configurable statement_timeout
  • Supports a database and schema allow-list via a JSON config file
  • Surfaces EXPLAIN for planner-level debugging without exposing pg_stat_statements
  • Streams large result sets as paginated tool responses so a single query cannot flood context

Best for

Read-only analytics agentsSchema explorationAd-hoc report generationAnswering questions over a replica
About Postgres

Postgres is a MCP server categorised under database, official, postgres, sql. Formerly part of the official monorepo, now kept in servers-archived. Introspects schema and runs SELECT queries with configurable row and timeout limits. Community forks have picked up maintenance.

How to install

Pick your MCP client from the Install panel on this page to get a one-click install link (Cursor, VS Code) or a ready-to-paste configuration for Claude Desktop, Claude Code, Gemini, Codex, Windsurf, and other MCP-compatible clients. No local setup required for remote servers.

License

Postgres is released under the MIT license. This is a permissive open-source license, so you can freely use, modify, and distribute it — subject to its terms.

No reviews yet

Be the first to leave a review after using this server in production.

README

The Postgres server was one of the original reference implementations. When the monorepo trimmed its maintained set the code moved to modelcontextprotocol/servers-archived; the @modelcontextprotocol/server-postgres package is still installable but has not received a release in over a year. Useful as a minimal, well-audited starting point — production users should evaluate a maintained fork before depending on it for anything critical. What it does: - Introspects tables, columns, indexes, and foreign keys on connect - Executes SELECT statements only, writes are rejected before the query reaches Postgres - Applies a per-statement row cap and a configurable statement_timeout - Supports a database and schema allow-list via a JSON config file - Surfaces EXPLAIN for planner-level debugging without exposing pg_stat_statements - Streams large result sets as paginated tool responses so a single query cannot flood context Example: Point it at a reporting replica with READ_ONLY=1 and an analyst agent can answer "which enterprise customers used feature X at least three times in the last 30 days" by composing JOINs across the introspected schema, with no risk of an accidental UPDATE reaching the primary. Setup: Connection via a standard postgres:// URL passed as the first argument. Create a dedicated read-only role (REVOKE INSERT/UPDATE/DELETE) and connect as that role for defence in depth, rather than trusting the server's own write-block alone. Transport: stdio. No HTTP or SSE variant. Notes: Because upstream maintenance has stopped, the soft-reliability score here is capped. Known gap: the introspection path does not surface inherited-partition parents distinctly from their children, which confuses agents reasoning about partitioning. Active forks on GitHub patch this but ship under different package names.

Alternatives

SQLite
database
free

Archived Python reference server for local SQLite.

officialsqlitesql
68/10063kpython
Filesystem
file system
Verified

Scoped file access with configurable allow-lists.

officialfilesystemnode
94/10063ktypescript
GitHub
version control
Verified

GitHub's own MCP server for issues, PRs, and code search.

officialgithubgit
92/10023kgo
Time
productivity
free

Time-zone math and conversions.

officialtimetimezone
91/10063kpython