How to Configure Claude Code Bigquery Read Only Access
You set up claude code bigquery read only access with a restricted cloud role. Then you pass those read credentials to an MCP server or shell tool. Teams often start by reusing a developer account for speed. Broad permissions let an AI agent change tables or drop datasets by mistake. Scoping the cloud role down to read actions stops write queries at the database. How claude code bigquery read only access works Claude Code reaches external systems and databases through two main paths. The firs
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You set up claude code bigquery read only access with a restricted cloud role. Then you pass those read credentials to an MCP server or shell tool. Teams often start by reusing a developer account for speed. Broad permissions let an AI agent change tables or drop datasets by mistake. Scoping the cloud role down to read actions stops write queries at the database.
How claude code bigquery read only access works
Claude Code reaches external systems and databases through two main paths. The first path uses the Model Context Protocol, also known as MCP. MCP servers give Claude Code access to your tools, databases, and APIs. Querying databases is a standard use case in the official docs. The vendor guide recommends a read-only user so queries cannot change data. You also must verify that you trust each MCP server before you use it.
The second path uses the built-in Bash tool to run local shell commands. In Manual mode, the Bash tool asks for approval before it runs commands. Only a small built-in list of safe local read commands skips this prompt. When the agent runs a cloud CLI command, it uses local cloud credentials. If those credentials belong to an admin, the agent gets admin power.
To lock this down, you create a dedicated cloud identity for the agent. You grant that identity permissions to run jobs and read table rows only. You leave out permissions that create, update, or delete tables and datasets. Next, you link this restricted identity to your MCP server or shell session. Now BigQuery blocks any write statement that the agent tries to run.
What native read roles solve and what they miss
Native cloud roles do a great job of blocking changes to your data. When the agent sends an update or delete query, BigQuery rejects the request. Your tables stay safe from accidental drops or bad schema edits. This setup answers the question of who can log in and read tables.
Still, cloud roles do not inspect what each read query does in flight. A read-only user can still read every column in an allowed table by default. If a table holds emails, phone numbers, or card numbers, the query returns them. The raw values flow back into the agent context and prompt history. Cloud roles work at the table or dataset level, not inside live results.
Auditor Read-Only Access + Claude Code Security: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Static credentials on a laptop also create a key management task for teams. Engineers store service account keys or long-lived tokens in local config files. If a developer shares a config file, those credentials can leak. Cloud roles also cannot ask a human to approve one risky read query. They either allow all reads on a table or block the table full stop.
Why query-level controls matter for AI agents
AI coding agents write and run SQL faster than human engineers. An agent exploring a schema might pull thousands of rows to test a fix. When sensitive fields sit in those rows, they enter the model prompt right away. Teams need a way to rewrite sensitive fields in query results before delivery. Masking emails, phone numbers, and national IDs in flight keeps prompts clean. It lets the agent read table structure and test logic without pulling raw secrets.
Add runtime guardrails and masking beside your databases and APIs
Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits inline in the protocol beside the service as an open-source proxy, a sidecar for your database or API. On every production query an agent or human runs, hoop.dev decides whether to pass, mask, block, or escalate it for review.
Before a query runs, hoop.dev guardrails check the statement against your rules, an AI Analyzer you configure can score intent or hold risky calls for human approval, and hoop.dev data masking rewrites sensitive fields in responses in memory. Explore the MIT-licensed project on GitHub.
Frequently asked questions
How does Claude Code run queries against BigQuery?
Claude Code reaches databases through an MCP server or through its Bash tool. Both methods use the cloud credentials that you provide in your local setup.
Why should I avoid using my personal cloud login for Claude Code?
Personal logins often have broad rights to edit tables or read all datasets. Using a dedicated read-only role stops the agent from changing or deleting production data.
Does a BigQuery read-only role hide sensitive columns from the agent?
No, a standard read role allows full select queries on permitted tables. Any emails, phone numbers, or card numbers in those tables return in the results.
Related guides
In this post