How to Set Up a MySQL MCP Server With Windsurf

The ops manager messaged me at 9 AM on a Monday: "Do we have a quick way to see which products are running low?" She didn't need a dashboard. She needed an answer, right now. I was already in Windsurf. Instead of switching to a MySQL client, I just asked Cascade. It queried the database, came back with the list, and we were done before my coffee cooled.
This post walks through how to wire that up: Windsurf's Cascade agent talking to your MySQL database through QueryBear's read-only MCP gateway.
Part of the MySQL MCP Server guide.
What you'll need
- A MySQL database (a read replica is strongly recommended)
- A QueryBear account (free tier works)
- Windsurf installed
Why route through a gateway
Handing an agent your raw MySQL URL gives it as much reach as the role you used in that URL. A gateway puts a layer of enforcement in between: a SQL parser that blocks INSERT, UPDATE, DELETE, and DDL; an allowlist of the tables the agent can touch; a column blocklist; a row limit; and a query timeout. Your credentials stay inside QueryBear. The agent only sees what you let it see. The MySQL MCP Server guide goes into more depth on all of this.
Connect QueryBear to your MySQL database
- Open the QueryBear dashboard and click "New connection."
- Select MySQL and paste your database URL. Format is
mysql://user:pass@host/dbname. Use a role withSELECTprivilege only. - In "Allowed tables," pick the tables you want Cascade to see. Inventory, orders, products, that kind of thing. Leave out anything sensitive.
- In "Blocked columns," add fields like
password_hashor any PII you'd rather not end up in an agent's context. Save.
Install the QueryBear MCP server in Windsurf
Open Windsurf, navigate to Settings, then "MCP Servers," then "Add custom server." Paste this configuration:
{
"mcpServers": {
"querybear": {
"serverUrl": "https://mcp.querybear.com/mcp"
}
}
}Windsurf uses serverUrl here, not url. That's different from how Cursor spells it, so if you're copying from another guide, double-check that key name before you save.
Save and let the MCP connection reload. QueryBear should show up in Cascade's available tools.
Ask your first question
In Cascade, just ask:
"Which inventory items are below their reorder threshold?"
Cascade calls get_schema to understand your tables, then generates a query. Here's what it produced:
SELECT item_id, item_name, current_stock, reorder_point
FROM inventory
WHERE current_stock < reorder_point
ORDER BY (reorder_point - current_stock) DESC;Came back with 12 items sorted by how far below threshold they were. Ready to hand to ops.
One MySQL thing to keep in mind: MySQL can do implicit type coercion in WHERE clauses. If current_stock is a VARCHAR for some reason, < reorder_point might not sort the way you expect. If results look off, ask Cascade to cast the column explicitly.
A Windsurf-specific tip
Cascade can chain MCP calls in a single response. A question like "which inventory items are below threshold, and which supplier handles each one?" will trigger get_schema, then run_query with a join, all in one turn. You don't have to prompt it to look at the schema first.
If Cascade's results look stale after you've updated your QueryBear allowlist or added new tables, Windsurf may be serving a cached version of the schema. Hit cmd-shift-R to refresh, and the next MCP call will pull the latest.