How to Configure Claude Code Bigquery Permissions
You set up claude code bigquery permissions by creating a read-only database user. Then you link that user to the agent through a Model Context Protocol server. Many teams start by handing the agent a developer key with broad admin rights. That fast shortcut lets a single bad prompt drop tables or read private rows. How claude code bigquery permissions work in practice Claude Code reaches outside systems in two main ways. First, it talks to data sources through Model Context Protocol servers.
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 permissions by creating a read-only database user. Then you link that user to the agent through a Model Context Protocol server. Many teams start by handing the agent a developer key with broad admin rights. That fast shortcut lets a single bad prompt drop tables or read private rows.
How claude code bigquery permissions work in practice
Claude Code reaches outside systems in two main ways. First, it talks to data sources through Model Context Protocol servers. The official docs state that MCP servers give the agent access to databases and APIs. Second, the agent runs shell commands through its built-in Bash tool.
When you link an MCP server for database queries, the server needs a login key. The vendor docs advise using a read-only database user in your login string. This rule makes sure the queries the agent runs cannot change or delete data. You also must check that you trust each MCP server before you use it.
If the agent uses its Bash tool instead, it inherits your local cloud login. In Manual mode, the Bash tool asks for your approval before running most commands. Only a small built-in list of safe read-only file and git checks run without asking. Still, once you approve a database command, cloud roles decide what that command can do.
Steps to scope down your cloud role
Start by making a separate cloud service account just for the coding agent. Never let the agent share your personal login or an admin key. Give this new account a role that only allows running jobs and reading tables. Remove any rights to create, change, or delete tables and datasets.
Next, limit which datasets this service account can see. Grant read rights on one test dataset instead of the whole cloud project. Keep tables with customer emails, phone numbers, or card numbers out of this allowed group. Pass the restricted account details to your chosen MCP server setup.
Finally, test the setup by asking the agent to list tables and read a sample row. Check that the agent fails if you ask it to write or delete a row. Keep the Bash tool in Manual mode so you review every shell command first.
Claude Code Security + BigQuery IAM: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What native roles solve and what they miss
Cloud roles and read-only users do a good job at login time. They prove who is logging in and block write commands across the whole dataset. If the agent tries to drop a table, the cloud database rejects the request.
Still, static cloud roles leave a large gap once the session starts. A read-only role cannot see what an individual query does in flight. If an allowed table holds emails, phone numbers, or national IDs, the query reads them. The raw results go straight back into the model prompt window.
Native roles also put a static key file on the developer machine. Anyone or any local script on that laptop can read that file. You also lack a single log that ties each SQL statement to the specific developer. You need controls that inspect queries and mask sensitive fields in results.
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 a database?
The agent connects to databases through Model Context Protocol servers or runs CLI tools via its Bash tool. The vendor docs highlight querying databases as a main MCP use case.
Why should I use a read-only user for the agent?
The official docs advise using a read-only user in your login string so queries cannot alter data. This prevents an unexpected prompt or model error from deleting tables or changing rows.
Does the Bash tool run database commands without asking?
No, in Manual mode the Bash tool requires your approval before running shell commands. Only a small built-in set of local read-only commands can run without a prompt.
Related guides
In this post