Skip to main content
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.

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 dashboardConnectionsNew connectionPostgreSQL, with the credentials from Step 1.

Step 3: Add QueryBear to Windsurf

1

Open Windsurf Settings

SettingsMCP ServersAdd custom server.
2

Paste the config

Note: Windsurf uses serverUrl, not url.
3

Save and authorize

The first time Cascade uses QueryBear, an OAuth browser tab opens. Approve.

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 for subscriptions, subscription_events, and users. Then count cancellations in the last 30 days by reason.”
Cascade calls get_schema for each table, writes a join + group-by query, and runs it through QueryBear.

Postgres + Windsurf gotchas

  • serverUrl not url. This is the #1 reason Windsurf doesn’t see the MCP server. Cursor uses url; Windsurf uses serverUrl.
  • Cascade multi-steps. It often calls get_schemarun_queryget_schemarun_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.