Skip to main content

PostgreSQL MCP Server: Connect a Database to Claude (2026)

Connect Claude to PostgreSQL for schema inspection and read-only queries. Covers the archived official server, recommended alternatives, and safe setup.

ByUpdated

The PostgreSQL MCP server connects Claude to a database so it can inspect the schema and run read-only queries. One important caveat: the official reference server (@modelcontextprotocol/server-postgres) has been moved to the archived repository and is no longer actively maintained. So this guide covers both using the archived official server and the better-maintained alternatives.

🟢 Model references match the current lineup · model notice · Fable subscription
🟢 Model references match the current lineup · Claude Opus 5.5 / Claude Sonnet 5 / Claude Haiku 4.5 (higher tier: Claude Fable 5.1). This notice changes only when Anthropic ships a new model.

Fable 5 and 5.1 subscription (updated September 7, 2026): Claude Fable 5.1, released September 1, 2026, is the current Fable model and Fable 5 is now legacy. Plan terms are the same for both — Max and Team Premium plans include Fable at up to 50% of the weekly usage limit; Pro and Team Standard use usage credits (

🟢 Model references match the current lineup · Claude Opus 5.5 / Claude Sonnet 5 / Claude Haiku 4.5 (higher tier: Claude Fable 5.1). This notice changes only when Anthropic ships a new model.
0/M input, $50/M output tokens). The one-time
🟢 Model references match the current lineup · Claude Opus 5.5 / Claude Sonnet 5 / Claude Haiku 4.5 (higher tier: Claude Fable 5.1). This notice changes only when Anthropic ships a new model.
00 credit applied only to the Fable 5 transition and is not offered for 5.1. Some coding and debugging requests may be answered by an Opus model due to a security classifier (both models). See the Fable 5.1 guide and the Fable 5 availability guide for details.

PostgreSQL MCP — 4 stepsPostgreSQL MCP — 4 steps1. Read-only userleast privilege2. Connection stringpostgresql://…3. Registernpx or Docker4. Queryschema · read queries

What you can do

This server provides read-only access — it exposes your table structures (schema) as resources and runs queries for reading. It is meant for "let Claude understand my DB and answer questions about it," not for changing data.

Option 1 — The archived official server (use with care)

The package is @modelcontextprotocol/server-postgres, and you pass a connection string as an argument. A claude_desktop_config.json example:

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

Replace the last argument postgresql://localhost/mydb with your own connection string. Note that because this server is archived, its security and compatibility updates may have stopped — keep that in mind.

You can find actively maintained database MCP servers in the registries and directories covered in where to find MCP servers. And if you use managed Postgres, consider a vendor-provided server (such as Supabase's official MCP), which is generally safer.

Staying safe — databases need extra care

DB connections are sensitive, so: first, create and connect with a read-only, least-privilege account. Second, the connection string contains a password, so keep it from being exposed (MCP connector security). Third, prefer a copy or read replica over your production database.

Three safety rules for DB access① Least privilegeCreate a separateread-only, least-privilegeaccount and use only it② Protect the stringThe connection stringholds the password —keep the config private③ Prefer replicasPoint at a copy or readreplica before touchingproductionThis server is read-only — it is not for changing data

Troubleshooting

If the server does not appear or you get connection errors, see the troubleshooting guide. Connection-string format, firewalls, and permissions are common causes.

Looking for more connectors? Browse the connector directory to search and filter common connectors by use case.

For other servers see Filesystem server and GitHub MCP server; for picks by use case see recommended MCP servers; for the full map see the connector & MCP catalog. The official source is modelcontextprotocol/servers-archived (postgres).

Written July 2026; re-checked September 9, 2026 — npm @modelcontextprotocol/server-postgres is at 0.6.2 (2026-07-03) and carries a "Package no longer supported" deprecation notice. The official PostgreSQL reference server lives in the archived repo and may no longer be maintained. Check the official docs and registry for setup and alternatives. This is an unofficial guide.

Was this helpful?

Keep reading