AUTOMATIONSWITCH
OfficialDatabase

Postgres MCP

by Anthropic

Official MCP server for PostgreSQL. Provides read and write access to PostgreSQL databases with schema introspection, query execution, and transaction support. The reference implementation for database MCP servers.

4,200·14 tools·Released AUG 2025·MIT
npx -y @modelcontextprotocol/server-postgres
Share:

The gold standard for Postgres MCP servers. Explicit transactions, EXPLAIN output, and read-only mode make this the production-safe choice.

Reviewed by M. Nouriel · APR 2026

INSTALL THIS SERVER

Requires authenticationConnection string (DATABASE_URL env var)
{ "mcpServers": { "postgres": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-postgres" ], "env": { "DATABASE_URL": "postgres://user:pw@host:5432/db", "READ_ONLY": "false" } } } }
PrereqNode.js 18+, PostgreSQL connection string

14 TOOLS AVAILABLE

query
Execute a read-only SQL query
Read
execute
Execute a write SQL statement
Write
list_schemas
List all schemas in the database
Read
list_tables
List all tables in a schema
Read
describe_table
Get column details for a table
Read
list_indexes
List indexes on a table
Read

OUR ASSESSMENT

Strengths
  • Explicit transaction tools (BEGIN/COMMIT) as first-class operations
  • EXPLAIN plan output returns as structured JSON
  • Read-only mode via CLI flag, no config surgery needed
  • Fastest cold start in the category at 180ms
  • 14 tools covering schema introspection, queries, and admin operations
Weaknesses
  • Connection-string-only auth, no OAuth flow
  • No built-in branching for reversible migrations
  • Zero BaaS features — this is a database client only
Security Notes

Supports read-only mode via --read-only flag. Credentials passed as DATABASE_URL environment variable or .pgpass file.

Best For

Production Postgres clusters where DBA-governed schemas demand explicit transactions and EXPLAIN plans.

TECHNICAL DETAILS

Language
typescript
Transport
stdio
Clients
Claude DesktopClaude CodeCursorVS CodeWindsurfCline
License
MIT
GitHub
npm
@modelcontextprotocol/server-postgres
Last Release
1.2.4
First Released
AUG 15, 2025

ADOPTION METRICS

// GitHub Stars
4,200
// Weekly Downloads
48,200
// Popularity Rank
#3
Globally
// Get in touch

DISCUSS YOUR
MCP REQUIREMENTS.

Evaluating a server, scoping an internal deployment, or working out whether MCP is the right fit at all. Start the conversation and we will point you at the right piece of the ecosystem.

Discuss Your MCP Requirements →