SERVER

PostgreSQL

Rank #7,593

io.github.antonorlov/mcp-postgres-server

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

2 versions
25 GitHub stars
by antonorlov (2 servers)View repository ↗
First listed
Mar 24, 2025
Last publish date
Sep 14, 2026
PURPOSE

What you can do with PostgreSQL

A small Node.js MCP server (mcp-postgres-server) for querying PostgreSQL, read-only by default with writes opt-in via an environment flag, and with SSL, SSH tunnelling, timeouts and a result-size cap built in.

Suitable tasks
  • Run read-only SELECT, WITH, EXPLAIN and SHOW statements
  • List schemas and tables, describe a table's columns
  • Run INSERT/UPDATE/DELETE or DDL when writes are enabled
  • Reach local, Docker, RDS, Neon or Supabase databases
  • Switch databases at runtime when explicitly enabled
CAPABILITIES AND LIMITATIONS

What PostgreSQL can and cannot do

Capabilities

Six tools: query (one read-only statement), execute (writes, refused unless PG_ALLOW_WRITE=true), list_schemas, list_tables, describe_table and connect_db (registered only with PG_ENABLE_RUNTIME_CONNECT=true). In the default mode each query runs inside BEGIN READ ONLY ... ROLLBACK.

Documented tools
  • query
  • execute
  • list_schemas
  • list_tables
  • describe_table
  • connect_db
Limitations
  • Read-only mode does not stop prompt injection carried in row data; the docs say not to point it at production
  • With PG_ALLOW_WRITE=true the query tool loses its read-only wrapper, so a write sent through query would run
  • One statement per call; multi-statement input is rejected
  • sslmode allow/prefer encrypt without verifying the certificate and do not fall back to plaintext
  • SSH host-key verification is mandatory: PG_SSH_FINGERPRINT must be set or the tunnel refuses to connect
REQUIREMENTS

What you need before using PostgreSQL

DeclaredNo credentialsNo credentials declared

The registry listing declares no required environment variables or authentication. This is declared metadata, not a verified install — the repository README is the authority.

Declared by Glama, last synced Nov 30, 2026. Not independently verified by MCP Toplist.

Runtime
Node.js 20+ via npx -y mcp-postgres-server
Credentials
DATABASE_URL, or PG_HOST, PG_PORT, PG_USER, PG_PASSWORD, PG_DATABASE
Permissions
A least-privilege database role (the server warns on stderr when connected as superuser)
Also needed
PG_SSLMODE / PG_SSL_CA for TLS; PG_SSH_* for tunnelling; PG_ALLOW_WRITE=true to enable writes
Declared in the registry install config
  • DATABASE_URL · optional
  • PG_HOST · optional
  • PG_PORT · optional
  • PG_USER · optional
  • PG_PASSWORD · optional
  • PG_DATABASE · optional
  • PG_ALLOW_WRITE · optional
  • PG_SSLMODE · optional
  • PG_SSL_CA · optional
  • PG_ENABLE_RUNTIME_CONNECT · optional
  • PG_MAX_RESULT_BYTES · optional
  • PG_STATEMENT_TIMEOUT · optional
  • PG_CONNECT_TIMEOUT · optional
  • PG_SSH_HOST · optional
  • PG_SSH_PORT · optional
  • PG_SSH_USER · optional
  • PG_SSH_PRIVATE_KEY · optional
  • PG_SSH_PASSPHRASE · optional
  • PG_SSH_AGENT · optional
  • PG_SSH_PASSWORD · optional
  • PG_SSH_FINGERPRINT · optional
  • PG_SSH_KEEPALIVE_INTERVAL · optional
INSTALLATION AND FIRST TASK

Connect PostgreSQL and confirm it works

  1. Add a server entry running npx -y mcp-postgres-server with DATABASE_URL in env
  2. Create a least-privilege role for the agent and use it in the URL
  3. Leave PG_ALLOW_WRITE unset for read-only; set it to true only when writes are needed
  4. Optionally tune PG_STATEMENT_TIMEOUT (default 30000 ms) and PG_MAX_RESULT_BYTES (default 32768)
npm package
claude mcp add mcp-postgres-server -e "DATABASE_URL=<your DATABASE_URL>" -e "PG_HOST=<your PG_HOST>" -e "PG_PORT=<your PG_PORT>" -e "PG_USER=<your PG_USER>" -e "PG_PASSWORD=<your PG_PASSWORD>" -e "PG_DATABASE=<your PG_DATABASE>" -e "PG_ALLOW_WRITE=<your PG_ALLOW_WRITE>" -e "PG_SSLMODE=<your PG_SSLMODE>" -e "PG_SSL_CA=<your PG_SSL_CA>" -e "PG_ENABLE_RUNTIME_CONNECT=<your PG_ENABLE_RUNTIME_CONNECT>" -e "PG_MAX_RESULT_BYTES=<your PG_MAX_RESULT_BYTES>" -e "PG_STATEMENT_TIMEOUT=<your PG_STATEMENT_TIMEOUT>" -e "PG_CONNECT_TIMEOUT=<your PG_CONNECT_TIMEOUT>" -e "PG_SSH_HOST=<your PG_SSH_HOST>" -e "PG_SSH_PORT=<your PG_SSH_PORT>" -e "PG_SSH_USER=<your PG_SSH_USER>" -e "PG_SSH_PRIVATE_KEY=<your PG_SSH_PRIVATE_KEY>" -e "PG_SSH_PASSPHRASE=<your PG_SSH_PASSPHRASE>" -e "PG_SSH_AGENT=<your PG_SSH_AGENT>" -e "PG_SSH_PASSWORD=<your PG_SSH_PASSWORD>" -e "PG_SSH_FINGERPRINT=<your PG_SSH_FINGERPRINT>" -e "PG_SSH_KEEPALIVE_INTERVAL=<your PG_SSH_KEEPALIVE_INTERVAL>" -- npx -y mcp-postgres-server

Replace each placeholder with your own value before saving.

First successful task

Ask the agent "what tables are in the public schema?" so it calls list_tables.

Expected: A list of tables in public; a follow-up write through query fails because of the READ ONLY transaction.

ALTERNATIVES

When to choose another server

  • Postgres MCP#996

    You want health checks and index tuning on top of restricted SQL.

  • DBHub#46

    You also connect to MySQL, SQL Server, Oracle or SQLite.

  • PostgreSQL Database Management Server#9,093

    You need tiered administration tools (roles, RLS, import/export), not just queries.

Compared side by side in PostgreSQL MCP servers.

Other servers by antonorlov
View all antonorlov servers →
MAINTENANCE AND EVIDENCE

What changed, and when this was checked

First listed
Mar 24, 2025
Latest version published
Sep 14, 2026
Version history
2 versions tracked (below)
Requirements evidence
Declared by Glama, last synced Nov 30, 2026. Not independently verified by MCP Toplist.
Profile checked
Oct 9, 2026 against README
Ranking data as of
Nov 30, 2026
Registry sightings

Do you maintain PostgreSQL? to show as its verified maintainer and add your own summary, sign-in details and links. The rest of this page is read from the registry listings and from MCP Toplist's own connection check.

VERSIONS

Available versions (2)

0.3.0 · Sep 14, 20260.3.1 · Sep 14, 2026Sep 14, 2026Sep 14, 2026
VersionPublished
0.3.1Sep 14, 2026
0.3.0Sep 14, 2026
STANDING
#7,593of 199,637 active serversTop 5%

Ranks ahead of 192,044 of 199,637 servers on MCP Toplist.

Recent momentum
+13GitHub stars since Apr 27 (+108%)
BADGE

Show your rank

Maintain this server? Add the live rank badge to your README — it updates automatically as the leaderboard changes.

MCP Toplist: Top 5% of 199,637
Markdown
[![MCP Toplist](https://mcptoplist.com/badge/io.github.antonorlov%2Fmcp-postgres-server.svg)](https://mcptoplist.com/server/io.github.antonorlov%2Fmcp-postgres-server)
HTML
<a href="https://mcptoplist.com/server/io.github.antonorlov%2Fmcp-postgres-server"><img src="https://mcptoplist.com/badge/io.github.antonorlov%2Fmcp-postgres-server.svg" alt="MCP Toplist: Top 5% of 199,637" /></a>

Variants: append ?metric=score or ?metric=stars to the image URL.

FAQ

Frequently asked questions

Who maintains PostgreSQL?
PostgreSQL is maintained by antonorlov, which publishes 2 MCP servers (3 total versions) tracked on MCP Toplist.
Is PostgreSQL listed on the Official MCP Registry?
Yes — PostgreSQL is listed on the Official MCP Registry, alongside Glama, PulseMCP and mcp.so.
How many versions does PostgreSQL have?
MCP Toplist tracks 2 versions of PostgreSQL, most recently published on Sep 14, 2026.
Where can I find the source code for PostgreSQL?
The source code for PostgreSQL is hosted at github.com/antonorlov/mcp-postgres-server.
Used in projects

Do you run this server?

Community projects list the MCP servers behind real agents and apps. Publish yours and this page will link to it.

EXPLORE