This guide walks through connecting PostgreSQL to Windsurf (Codeium’s AI-first code editor) using QueryBear’s managed MCP server. End result: Windsurf’s Cascade agent can query your Postgres database while it codes.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+)
- Windsurf installed
Step 1: Create a read-only PostgreSQL role
Step 2: Add the connection to QueryBear
In the QueryBear dashboard → Connections → New connection → PostgreSQL, with the credentials from Step 1.Step 3: Add QueryBear to Windsurf
Step 4: Verify
In Cascade:“What QueryBear tools do you have? List my connections.”You should see
list_connections, get_schema, run_query, and your Postgres connection.
Try it
“I’m refactoring the subscription cancellation flow. Pull the schema forCascade callssubscriptions,subscription_events, andusers. Then count cancellations in the last 30 days by reason.”
get_schema for each table, writes a join + group-by query, and runs it through QueryBear.
Postgres + Windsurf gotchas
serverUrlnoturl. This is the #1 reason Windsurf doesn’t see the MCP server. Cursor usesurl; Windsurf usesserverUrl.- Cascade multi-steps. It often calls
get_schema→run_query→get_schema→run_query. This is normal and produces better answers. - Ask for the plan first. For risky reads, “outline the queries you’d run first” gives you a preview before Cascade executes.
- OAuth is per-install. If you use Windsurf on multiple machines, authorize each.
Related
- PostgreSQL MCP server — Postgres-specific deep dive
- Windsurf client — Windsurf overview
- Security model — what the gateway protects against