PostgreSQL is the most popular open-source database, and connecting Claude to your Postgres instance enables powerful data exploration and query assistance. MCP servers provide secure, controlled database access. Here are the best options for PostgreSQL integration.
Recommended MCP Servers
Postgres MCP Pro
crystaldba/postgres-mcp
All-in-one PostgreSQL server with index tuning, query optimization, health checks, and safe SQL execution.
Key Features
- Index tuning recommendations
- EXPLAIN plan analysis
- Database health monitoring
- Safe read-only mode
Installation
pip install postgres-mcpPostgres MCP Pro is the premium choice for PostgreSQL. Beyond basic queries, it offers index tuning, query plan analysis, and health monitoring. Essential for serious database work where performance matters.
Postgres MCP (Anthropic)
anthropics/mcp-server-postgres
Official Anthropic PostgreSQL server for schema inspection and query execution.
Key Features
- Schema exploration
- Query execution
- Official Anthropic support
- Simple configuration
Installation
npx @modelcontextprotocol/server-postgresThe official Postgres MCP from Anthropic provides straightforward database access. Explore schemas, run queries, and analyze data with minimal setup. Perfect for developers who need reliable database connectivity.
Supabase MCP
supabase-community/supabase-mcp
Official Supabase integration providing PostgreSQL access through the Supabase platform.
Key Features
- Supabase project integration
- OAuth authentication
- Read-only mode available
- Zero local setup
Installation
Remote server: https://mcp.supabase.com/mcpIf your PostgreSQL runs on Supabase, this is the easiest path. Just add the remote server URL, authenticate with OAuth, and you're connected. No credentials to manage, no local setup required.
Quick Comparison
| MCP | Stars | Best For | Pros | Cons |
|---|---|---|---|---|
| Postgres MCP Pro | >1.5k | Performance tuning | Index optimization | More features to learn |
| Postgres MCP | >2k | General access | Official, simple | Basic features |
| Supabase MCP | >2k | Supabase projects | Zero setup | Supabase only |
Getting Started
To connect to PostgreSQL with Claude Code:
For any PostgreSQL, use the official server:
npx @modelcontextprotocol/server-postgres postgresql://user:pass@host:5432/dbFor Supabase, just add the remote server URL to your config.
For performance work, install Postgres MCP Pro:
pip install postgres-mcp
Example prompt: "Connect to my database and show me the schema for the users table."