Skip to content

BigQuery

Diskret connects to Google’s managed BigQuery MCP server (https://bigquery.googleapis.com/mcp). It is switched on together with the BigQuery API, so there is nothing to deploy. Each user signs in with their own Google account, and BigQuery’s IAM decides which projects and datasets they can see.

Time: about 15 minutes. Who: someone who can grant IAM roles in the Google Cloud project that holds the data, and a Diskret admin.

Scope Why Required
https://www.googleapis.com/auth/bigquery List datasets and tables, read their metadata and run queries Yes

This scope reads “view and manage your data in BigQuery”. It is the only scope the server offers, so IAM roles are what keep access read-only (step 2): with BigQuery Data Viewer and no editor role, a user cannot change tables, whatever the AI asks for.

Tool What it does In Diskret
list_dataset_ids List datasets Open
list_table_ids List tables in a dataset Open
get_dataset_info Read a dataset’s metadata Open
get_table_info Read a table’s metadata and schema Open
execute_sql_readonly Run a query; DML, DDL and Python UDFs are refused Open
execute_sql Run any SQL, including statements that change data Keep closed

Query results are free-form: the AI chooses the columns, aliases and joins, so a result has no fixed field paths for Diskret’s field rules to match. Diskret therefore scans every value in every result and pseudonymises what it finds. That works, but it is the weakest setup Diskret offers, so keep the data the AI can reach small:

  • Grant BigQuery Data Viewer on the datasets users need, not on the whole project.
  • Prefer datasets without personal data: aggregated reporting tables, or views that leave out names, email addresses and phone numbers.
  • Keep raw exports (CRM leads, form submissions, user-level analytics) in datasets the AI cannot read.
  • The BigQuery API is enabled in the project (it is by default in new projects). Enabling it needs the Owner or Service Usage Admin role.
  • You have an OAuth client in Google Cloud. If you already set up Google Workspace, reuse that client.
  • Turn off any direct BigQuery connector in Claude once Diskret is set up. See Recommended Claude settings.

Open the Google Cloud console, select the project that holds the data, go to APIs & Services → Library and check that the BigQuery API (bigquery.googleapis.com) is enabled. The MCP server comes with it.

Grant these to each user, or better to a Google group the users belong to:

Role Where Why
MCP Tool User (roles/mcp.toolUser) Project Call MCP tools
BigQuery Job User (roles/bigquery.jobUser) Project Run queries
BigQuery Data Viewer (roles/bigquery.dataViewer) Each dataset users need Read the data

Do not grant BigQuery Data Editor, BigQuery Admin or Owner to users who query through AI.

Cost: queries are billed to the project named in the query’s project_id, at your normal BigQuery prices. A query runs for at most three minutes and returns at most 3,000 rows.

If you reuse the Google Workspace client, only add the scope:

  1. Go to Google Auth Platform → Data Access, click Add or Remove Scopes, paste https://www.googleapis.com/auth/bigquery under Manually add scopes, click Add to Table, then Update, then Save.

If you need a new client, follow steps 2 and 3 of the Google Workspace guide: an Internal consent screen, then a Web application client with Diskret’s Redirect URI under Authorized redirect URIs. Copy the Client ID and Client secret.

  1. In Diskret, go to Connectors → New connector. Type: MCP server.
  2. Choose the Owner unit, name it BigQuery, slug bigquery, and set the URL to https://bigquery.googleapis.com/mcp.
  3. Under Authentication, choose Sign in with OAuth, and under Whose credential choose Personal (each user connects their own).
  4. Paste the Client ID and Client secret. Under Scope, enter https://www.googleapis.com/auth/bigquery.
  5. Save, then click Check sign-in. Diskret shows the authorization server it found and the scope it will ask for.
  6. Under Tools and access, open the read tools and execute_sql_readonly for the units that need them. Keep execute_sql closed.
  7. Optional: to limit which Google Cloud projects each unit can query, set Scope argument to project_id and allow the project ids per unit under Scope. Nothing is allowed until a scope is set.

Each user then goes to My connections, clicks Connect and signs in to Google. Queries run with that user’s own IAM roles and appear in BigQuery’s job history and audit logs under their name.

  • Access: add or remove users in the Google group from step 2. Removing BigQuery Data Viewer on a dataset takes effect on the next query.
  • Revoke access: remove the connector in Diskret, or delete the OAuth client in Google Cloud (this also cuts off every other connector that uses it). Users can revoke their own access with Revoke under My connections.
Error Likely cause Fix
Permission denied on mcp.tools.call The user lacks MCP Tool User Grant roles/mcp.toolUser on the project
Permission denied on bigquery.jobs.create The user lacks BigQuery Job User Grant roles/bigquery.jobUser on the billing project
Access denied on a table The user lacks BigQuery Data Viewer on that dataset Grant roles/bigquery.dataViewer on the dataset, if the user should see it
invalid_scope The scope is missing on the consent screen Add it under Data Access
Query cancelled It ran longer than three minutes Narrow the query, or query a smaller or pre-aggregated table
Result seems cut off Results stop at 3,000 rows Aggregate in SQL instead of returning raw rows
Query on a Drive-backed table fails External tables on Google Drive are not supported Query a native table instead