Skip to main content

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.

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

CREATE ROLE querybear LOGIN PASSWORD 'choose-a-strong-one';
GRANT CONNECT ON DATABASE your_db TO querybear;
GRANT USAGE ON SCHEMA public TO querybear;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO querybear;
ALTER DEFAULT PRIVILEGES IN SCHEMA public
  GRANT SELECT ON TABLES TO querybear;

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

{
  "mcpServers": {
    "querybear": {
      "serverUrl": "https://mcp.querybear.com/mcp"
    }
  }
}
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.