mcp servers · featured

PostgreSQL MCP Server

Anthropic's read-only PostgreSQL MCP is archived. Active alternatives: `crystaldba/postgres-mcp` (3.3k stars; PG + plans + index tuning; stdio or SSE), `supabase/mcp` (managed Postgres), and AWS Labs' Aurora DSQL / RDS / postgres-mcp servers. Use a read-only DB user for production.
by Community (Anthropic reference is archived) updated Sep 10, 2026 MIT
← back to shelf
install via your agent of choice
❯ uvx postgres-mcp

## what it does

tl;dr: Anthropic’s @modelcontextprotocol/server-postgres is archived (read-only since 2025-05-29). The original is a one-tool, read-only server over any postgresql:// URL. For new work, crystaldba/postgres-mcp (3.3k stars) is the strongest generic community option; for managed Postgres, supabase/mcp or AWS Labs’ RDS / Aurora DSQL MCPs fit better.

Status of the original

The Anthropic reference lives at modelcontextprotocol/servers-archived/src/postgres. It exposes one tool, query, which runs SQL inside a read-only transaction, and resource templates postgres://<host>/<table>/schema for schema discovery. The npm package still installs; the source is read-only.

Pick one

Use caseServerWhy
Self-hosted PG, want explain plans / tuning / health checkscrystaldba/postgres-mcp9 tools: execute_sql, get_object_details, explain_query, list_objects, list_schemas, get_top_queries, analyze_workload_indexes, analyze_query_indexes, analyze_db_health
Supabase projectsupabase/mcpremote OAuth at https://mcp.supabase.com/mcp; project-scoped tools
AWS RDS / Aurora PostgreSQLuvx awslabs.postgres-mcp-server@latestpart of awslabs/mcp; IAM auth via AWS_PROFILE
Aurora DSQL (serverless PG)uvx awslabs.aurora-dsql-mcp-server@latestAWS Labs; IAM token-auth
Quick stdIO over any postgresql:// URLuvx mcp-server-postgres (archived)Original one-tool, read-only; still works
Embedded pg-mem / local-onlymcp-server-mysql analog (@modelcontextprotocol/server-postgres)n/a — there’s no PG equivalent of the SQLite one

Install — crystaldba/postgres-mcp (default recommendation)

uvx postgres-mcp --access-schema=public --access-mode=unrestricted

Claude Desktop:

{
  "mcpServers": {
    "postgres": {
      "command": "uvx",
      "args": ["postgres-mcp", "--access-schema=public", "--access-mode=unrestricted"],
      "env": {
        "DATABASE_URI": "postgresql://user:pass@localhost:5432/mydb"
      }
    }
  }
}

Flags worth knowing: --access-schema (limit the agent to one schema) and --access-mode=restricted (block any DDL/DML). The server supports both stdio and SSE transports — pass --transport=sse (with --port) to share one server across multiple MCP clients. The README also has an OPT-30K-style prompt budget hint for limiting how much of the schema it introspects.

Install — the archived one (still works)

npx -y @modelcontextprotocol/server-postgres postgresql://user:pass@localhost:5432/mydb
{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres", "postgresql://user:pass@localhost:5432/mydb"]
    }
  }
}

For Docker on the same host as the DB, use host.docker.internal instead of localhost. The original is locked to one tool: query running inside a read-only transaction.

Safety

Any of these servers will execute SQL the model generates. The original is read-only by design; crystaldba/postgres-mcp defaults to restricted mode and you can scope it to one schema. For production:

  1. Use a dedicated, read-only DB user.
  2. Restrict to one schema with --access-schema.
  3. Lock the network path (security group, VPC, or SSH tunnel).
  4. Enable statement logging in postgresql.conf and forward logs.

Gotchas

  • The archived Anthropic package is no longer maintained. Issues stay open but no fixes land.
  • host.docker.internal is macOS/Windows; on Linux, point at the host’s actual IP or run the MCP on the host instead of in a container.
  • Connection-pool exhaustion: each MCP session is one PG connection. Long-lived clients with many parallel tools can hit max_connections.

## compatibility

claude-desktop ✓
claude-code ✓
cursor ✓

## exposed tools

→ unspecified

## embed this badge

cache ✓ in cache.directory
![cached](https://cache.directory/badge/postgres-mcp.svg)