← Guides·Connect AI to your data

Connect AI to your data

Connect BigQuery to Claude: connector, roles and cost caps

Add Google’s BigQuery connector to Claude or run MCP Toolbox on your machine, with read-only roles and a cap on what each query can scan.

David PombarSwiss army knife at Trackingplan
7 min read · 1583 words

TL;DR To connect BigQuery to Claude, add the Google Cloud BigQuery connector from Claude’s directory: Google built it, it talks to Google’s remote MCP server, and you sign in with your Google account. If your organization can’t use the directory, add the same server as a custom connector with an OAuth client you create, or run Google’s open-source MCP Toolbox on your machine. Whichever you pick, set it up read-only and cap the bytes it can scan before the first question.

BigQuery is the easy platform in this series. Google publishes the server, Anthropic lists it, and the sign-in is your normal Google account. The work is on the Google Cloud side: which identity Claude uses, what that identity can write, and how much a curious question can scan.

This guide is part of a series on connecting AI assistants to marketing data. It covers the three routes into Claude, the roles, and cost control. Whether a raw MCP connection is the right tool, or a data agent with your context behind it, is covered in BigQuery agents in your code.

A technician crouching in front of an open server rack in a data center, with a laptop on the floor plugged into the rack
The connection is the quick part. What the account on the other end can touch takes longer. Image: Derrick Coetzee, Wikimedia Commons, CC0

Pick a route

Diagram of three ways to connect BigQuery to Claude: the Google Cloud BigQuery connector from Claude’s directory, the same remote server added as a custom connector with your own OAuth client, and MCP Toolbox running locally over stdio. A band below says to use a separate read-only identity and a cap on bytes scanned before the first question.
The first two use Google’s hosted server. The third runs on your computer.
RouteWhere it worksBest for
Directory connectorclaude.ai, Desktop, mobile, Claude CodeMost people
Custom connector, your OAuth clientSameOrganizations that can’t use the directory listing
MCP ToolboxClaude Desktop, Claude CodeAnalysts who want a bytes cap and a read-only switch

Before any route: the Google Cloud side

Google’s setup page for the remote server sets three conditions.

  1. The API is on. The remote MCP server is enabled with the BigQuery API, which new projects have by default.
  2. The identity has three roles on the project: MCP Tool User (roles/mcp.toolUser) to call tools, BigQuery Job User (roles/bigquery.jobUser) to run queries, and BigQuery Data Viewer (roles/bigquery.dataViewer) to read tables.
  3. The scope is BigQuery. The server authenticates with OAuth 2.0 and the scope https://www.googleapis.com/auth/bigquery.

Google recommends a separate identity for agents. Use one: a Google account or group whose only grants are the read roles on the datasets you want Claude to see. Claude inherits that identity’s permissions, nothing more and nothing less.

Route 1: the directory connector

Claude’s directory lists Google Cloud BigQuery, marked Made by Google and Anthropic verified. It connects to https://bigquery.googleapis.com/mcp. Anthropic’s connector guide gives the steps:

  1. In claude.ai or the desktop app, open Customize > Connectors > Discover.
  2. Search for BigQuery and select Connect to Claude.
  3. Sign in with the Google identity from the previous section and approve.

The connector then shows as Connected. It works on the web, desktop and mobile, and in Claude Code when you sign in with your Claude account. On Team and Enterprise plans, an Owner enables it for the organization first, and each member still signs in as themselves.

The listing shows five tools: list_dataset_ids, get_dataset_info, list_table_ids, get_table_info and execute_sql. The first four read metadata. The last one runs SQL, and Google’s page notes it’s the only one that isn’t read-only.

Route 2: the same server, with your own OAuth client

If your organization won’t enable the directory listing, or wants the sign-in tied to its own Google Cloud project, add the server by URL. Google’s remote servers don’t register clients on their own, so you create one. Google’s client setup page has the Claude values:

  1. In the Google Cloud console, go to Google Auth Platform > Clients > Create client.
  2. Set Application type to Web application.
  3. Add https://claude.ai under Authorized JavaScript origins and https://claude.ai/api/mcp/auth_callback under Authorized redirect URIs.
  4. Select Create and copy the client secret. It’s shown once.

Then, in Claude, go to Customize > Connectors > Add > Add custom connector, enter a name and https://bigquery.googleapis.com/mcp, and select Continue. Under OAuth client, choose Use your own OAuth client and paste the ID and secret, then Add and Connect. On Team, only Owners and Primary Owners add custom connectors. Free accounts get one.

In Claude Code, the command takes the client directly. Anthropic’s Claude Code docs say to register http://localhost:PORT/callback as the redirect URI for this flow:

claude mcp add --transport http \
  --client-id YOUR_CLIENT_ID --client-secret --callback-port 8080 \
  bigquery https://bigquery.googleapis.com/mcp

Run /mcp inside Claude Code to sign in.

Route 3: MCP Toolbox on your machine

MCP Toolbox for Databases is Google’s open-source server, in Google’s mcp-toolbox repository. It runs locally, uses your Application Default Credentials, and adds tools the remote server lacks: forecast, analyze_contribution, search_catalog and ask_data_insights. Google’s Toolbox setup page covers the install; for Claude Desktop, the config goes under Settings > Developer > Edit Config.

What makes it worth the extra setup is two environment variables listed in the Toolbox repository’s docs:

In Claude Code, after gcloud auth application-default login:

claude mcp add --env BIGQUERY_PROJECT=your-project \
  --env BIGQUERY_READONLY=true \
  --env BIGQUERY_MAXIMUM_BYTES_BILLED=10000000000 \
  --transport stdio bigquery \
  -- npx -y @toolbox-sdk/server --prebuilt bigquery --stdio

That cap is 10 GB a query. Pick yours from the size of the tables Claude will read.

Read-only and cost control

Three controls, from the server outwards.

Results are capped at 3,000 rows, and queries stop after three minutes by default. Ask for aggregates, not raw events.

What to ask once it’s connected

GA4 export tables are where most marketing teams start. The traps in that schema are in inside the GA4 BigQuery export. If you’d rather query GA4’s own reports than the export, connect GA4 to Claude instead.

AskWhat it uses
“List the datasets in my-project and describe the tables in analytics_123456.”list_dataset_ids, get_table_info
“Which columns hold traffic source and campaign in events_*? Don’t query yet.”get_table_info
“Purchases and revenue by day for the last 14 days. Filter on _TABLE_SUFFIX and show me the SQL first.”execute_sql_readonly
“Sessions by source and medium, this week against last week.”execute_sql_readonly
“Find days in the last 30 where purchases fell by more than a third.”execute_sql_readonly

Asking for the SQL before the result is a habit worth keeping. It shows you the date filter, and that filter sets the bill.

Before you trust the answers

Claude reads your tables. It doesn’t read the hits that filled them. If the checkout tag lost its value parameter in last Tuesday’s release, if a consent change dropped one country, or if purchase fires twice on one payment method, the export holds those rows, and Claude sums them into a confident revenue trend.

Trackingplan watches the hits, the dataLayer, the consent state and the pixels on real traffic, before any of it reaches BigQuery, and flags missing properties and duplicate fires when they start. An AI agent can only reason about what it can see. Its agent answers inside Claude too, as the Ask Trackingplan tool through the plan’s MCP endpoint, next to the BigQuery connector. Which question goes to which is covered in warehouse agent or tracking agent.

FAQ

Is there an official BigQuery connector for Claude?

Yes. Claude’s directory lists Google Cloud BigQuery, made by Google and marked Anthropic verified. It points at Google’s remote MCP server, https://bigquery.googleapis.com/mcp, and you sign in with your Google account. That identity needs MCP Tool User, BigQuery Job User and BigQuery Data Viewer on the project.

Can Claude change or delete data in BigQuery?

It can if the identity it uses has write roles, because the execute_sql tool runs any statement those roles allow. Give the identity only BigQuery Data Viewer and Job User, set execute_sql to Blocked in Claude’s tool permissions or deny it with an IAM policy, and in MCP Toolbox set BIGQUERY_READONLY to true.

How do I limit what Claude’s BigQuery queries cost?

Google doesn’t document a per-query bytes setting for the remote server, so cap the identity with BigQuery’s custom quota for query usage per day per user. If you run MCP Toolbox, set BIGQUERY_MAXIMUM_BYTES_BILLED: a query over the limit fails before it runs and costs nothing.

Do I need a paid Claude plan to connect BigQuery?

No. Directory connectors are available on every plan, and custom connectors too, with Free limited to one. On Team and Enterprise an Owner has to enable the connector first. MCP Toolbox runs locally in Claude Desktop or Claude Code.

David PombarSwiss army knife at Trackingplan

Read more from David, a Senior Product Strategist with 18+ years in digital product development and an atypical error detection knack.

Trackingplan

See everything. Miss nothing.

Your implementations audited around the clock with real-time, real-user data. Real-time alerts about errors or changes in your data, campaigns, pixels, privacy and consent. Let AI flag issues before they cost you.