r/bigquery • • Oct 22 '26

Google BigQuery MCP

BigQuery is known for being potentially expensive, so you learn to be careful with it.

At the same time, it’s 2026. Writing queries by hand with no AI involved feels like an anachronism. Most people I know can’t imagine their work without Claude or Codex anymore.

The link between BigQuery and an AI agent is MCP. Google offers its own hosted server, there’s the Google's MCP Toolbox, and open-source alternatives keep appearing. Google’s own solutions seems like the obvious default.

Then I found out you can’t set `maximumBytesBilled` using Google hosted server (this one https://docs.cloud.google.com/bigquery/docs/reference/mcp) and in https://github.com/googleapis/mcp-toolbox maximumBytesBilled default is unlimited.

I was surprised at first. Then I thought about it from Google’s perspective. Why would they limit how much you spend? :-)

So we give an LLM access to a potentially expensive resource and hope it behaves. We all know how that goes (“You’re absolutely right!”). At best, we rely on a prompt or a skill that says “always dry-run” and “don’t spend more than X”.

In a lot of companies I’ve seen, people build their own local MCP servers that sit between the agent and `bq`, the BigQuery CLI. That’s a reasonable solution. Vibe-coding one takes two prompts in Claude Code. The job is mostly hard cost limits and rejecting statements containing `DROP`, `DELETE` or `UPDATE` words. Primitive, but it works.

We make Querylab.io, a free BigQuery IDE, so we went a bit further and put a local MCP server in our desktop app.

Everything the app already does to keep your BigQuery work under control is available to the agent too:

Cost limits -> maximum GB per query, plus daily, weekly and monthly budgets.

Billing model routing -> automatically selects on-demand or reservations, whatever is cheaper.

SQL-aware guardrails -> our parser understands what a statement actually does, so write restrictions and rules like “don’t touch this dataset” don’t have to rely on regexp.

Limits the agent can inspect -> it can check its own limits before writing SQL and ask you to lift a limit for a single query, rather than inventing workarounds when all it needs is your approval. And you can take over in app, review before run etc.

Because it’s local there’s nothing to host. It authenticates through the app, and the way we’d recommend is your existing gcloud default credentials.

How do you connect BigQuery to your Claude Code, or Codex, or whatever you use?

0 Upvotes

10 comments sorted by

7

u/no-middle-name Oct 22 '26

You think writing queries without AI is unusual? I think you need to put the AI down and touch grass.

→ More replies (1)

5

u/captain_obvious_here Oct 22 '26

We make Querylab.io, a free BigQuery IDE

No offense, but do people really give access to their data warehouse to a random free online tool?!

0

u/querylabio Oct 22 '26

Fair question! If you want maximum privacy, use the desktop app.

Unlike many online tools, Querylab Desktop doesn’t send your BigQuery credentials to our servers. Google authentication happens locally, and credentials are stored in your OS keychain.

If you already use the Google Cloud CLI to authenticate, Querylab can use those credentials directly without copying them anywhere.

The web app is also designed to keep your data private: queries and results go directly between your browser and BigQuery, never through our servers. The only difference is that we store a refresh token so you don’t have to sign in every time.

So if you want the strongest privacy guarantees, go with the desktop app. Your BigQuery credentials stay on your machine.

The IDE is free, but we also offer an enterprise solution for companies that need additional controls and support.

Honestly, what would convince you? Open-source code, an independent security audit, or something else?

5

u/captain_obvious_here Oct 22 '26

Honestly, what would convince you?

I work in a context that makes 3rd-party apps a huge no-no. So I'm not a good example of a customer for you.

But honestly, even if I was working on more casual data, I would have a hard time trusting a 3rd-party app with my data.

And even if you happen to be a great and respectful partner, there's so much you can do to prove me your application won't ever be taken advantage of by bad people.

All this aside, your UI looks pretty cool :)

0

u/querylabio Oct 22 '26

That’s fair, and thanks for the kind words about the UI!

Out of curiosity, would making Querylab open source make a difference for you? It’s something we’re considering.

4

u/captain_obvious_here Oct 23 '26

It won't here, because my company has all the BQ tooling we need. But it's a pretty common thing for many companies to pick an Open Source project and build upon it (with respect to the license). And to hire consulting for that matter (which is the part you'd want to push).

Also, not sure why your comments are being downvoted. Be sure that's not me.

1

u/querylabio Oct 23 '26

Thanks for you support!

2

u/lakeland_nz Oct 22 '26

I think you're looking at the wrong leaver.

Assume that the query is wrong. Assume it has a bug creating a cartesian product or otherwise blowing your slots. This isn't really an AI thing - it happens routinely in human-written code too.

So, set QueryUsagePerDay (and potentially also maximum_bytes_billed). Then a wrong query will be killed, and you get to debug it.

Also learn to use the query explainers.

1

u/querylabio Oct 22 '26

Exactly. But a bytes-billed limit won’t protect you from a query that consumes a lot of slots without reading much data. It’s less of a concern with on-demand pricing, but on reservations, you will pay for that. And that’s why we’re also adding slot consumption limits to Querylab.

BTW, we have a simplified query execution plan that’s worth checking out.

Do you think it would be useful to give AI agents access to it so they could analyze a query after it fails and help figure out what went wrong?