Postgres MCP Server
by Model Context Protocol (reference)
Reference MCP server for Postgres. Read schema, run scoped queries, give agents structured DB access without a dashboard tab.
MCP
Postgres MCP Server
Added 17 May 2026
Overview
The reference Postgres MCP server is part of the modelcontextprotocol/servers monorepo. It teaches the agent the schema, exposes read-only queries by default, and is the cleanest answer when an agent needs to look at production data without anyone copy-pasting a connection string.
Best for
Best for
Teams on raw Postgres (not Supabase) who want agent DB access
Use cases
- Let an agent answer 'what does the schema look like' without a DB GUI
- Run scoped analytical queries in read-only mode
- Use as a starter for your own DB-flavoured MCP server
- Local dev workflow against a Postgres in Docker
How to use
Install
npx -y @modelcontextprotocol/server-postgres postgresql://localhost/mydb Tested with
Claude Desktop
Example client config
{\n "mcpServers": {\n "postgres": {\n "command": "npx",\n "args": ["-y", "@modelcontextprotocol/server-postgres", "postgresql://localhost/mydb"]\n }\n }\n} Notes
Why it matters
Not every team is on Supabase. The reference Postgres MCP is the cleanest answer for the still-very-large set of teams on raw Postgres or RDS.
How teams use it in production
Pin to a read-only role. Wrap with logging. Use a second server, locked tighter, for the rare write path.
What to watch
The line between this server and a richer “agent DBA” surface (explain plans, query suggestions) is closing. Expect a feature-rich fork within a year.
Pros
- Reference quality, kept current with the protocol
- Read-only default keeps blast radius low
- Tiny codebase, easy to fork for tenant scoping
- Pairs cleanly with every MCP-aware client
Cons
- Writes need a different server or explicit opt-in
- Schema introspection cost on huge DBs
- Connection string handling needs hardening for prod
Pairs with
Other entries in the index that connect to this one. Click through to see the chain.
Get the free Developer’s Field Guide
A 27-page field guide to the AI coding workflow with Claude. Claude Code, MCP servers, the prompt patterns that work, and what to delegate. Free.
Enter your work email. We send it straight over, plus a few short notes worth knowing. Unsubscribe any time.
