This guide walks through connecting PostgreSQL to Claude Desktop (Anthropic’s macOS/Windows chat app) using QueryBear’s managed MCP server. End result: any Claude Desktop conversation can query your Postgres database safely — perfect for non-technical teammates.Documentation Index
Fetch the complete documentation index at: https://docs.querybear.com/llms.txt
Use this file to discover all available pages before exploring further.
What you’ll need
- A QueryBear account (sign up free)
- A PostgreSQL database (any version 12+)
- Claude Desktop installed and signed in
Step 1: Create a read-only PostgreSQL role
Run this as a Postgres superuser:Step 2: Add the connection to QueryBear
In the QueryBear dashboard → Connections → New connection → PostgreSQL:- Host — e.g.
db.example.comor your RDS endpoint - Port —
5432 - Database
- User —
querybear - Password — from Step 1
- SSL mode —
require
Step 3: Add QueryBear to Claude Desktop
Step 4: Verify
Start a new conversation in Claude Desktop:“What QueryBear tools do you have, and what connections are available?”You should see
list_connections, get_schema, run_query, and your Postgres connection.
Try it
“Look up user with id 1842 — show their plan, signup date, and last 5 logins. Use the production connection.”Claude calls
get_schema, joins the relevant tables, queries Postgres through QueryBear, and answers.
Postgres + Claude Desktop gotchas
- OAuth scope is per Claude Desktop install, so if you have Claude on multiple machines, each authorizes separately.
- For non-technical users, set up a default connection in QueryBear so Claude doesn’t need
list_connectionsevery time. - Block PII columns aggressively — anything Claude reads goes to Anthropic’s API. Block
email,address,phone,ssnat the QueryBear level if those are in your DB. - Audit log is essential when sharing access. The QueryBear dashboard logs every query, with timestamp and originating client.
Related
- PostgreSQL MCP server — Postgres-specific deep dive
- Claude Desktop client — Claude Desktop overview
- Security model — what the gateway protects against