How to Configure Claude Code Bigquery Credentials

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up claude code bigquery credentials through a Model Context Protocol server or local shell tools. Both paths use cloud roles to let the AI agent run queries on your tables. Most teams start by handing the agent a local user account or a broad service key. When those roles have too much power, a bad query can change or delete live data. A careless prompt can also pull private records into the model context. How claude code bigquery credentials work in practice Claude Code reaches outsi

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 credentials through a Model Context Protocol server or local shell tools. Both paths use cloud roles to let the AI agent run queries on your tables. Most teams start by handing the agent a local user account or a broad service key. When those roles have too much power, a bad query can change or delete live data. A careless prompt can also pull private records into the model context.

How claude code bigquery credentials work in practice

Claude Code reaches outside systems and databases in two main ways. The first path uses the Model Context Protocol, also known as MCP. MCP servers give Claude Code access to your tools, databases, and APIs. You point an MCP server at your data warehouse and supply your cloud login details. The agent then sends queries through that server to read schemas and table rows. Anthropic docs advise teams to use a read-only database user in the setup. That way, the queries Claude runs cannot modify data. Their docs also tell you to verify you trust each server before connecting.

The second path uses the built-in Bash tool inside the coding agent. Through the Bash tool, Claude Code runs shell commands on your local machine. In manual mode, the agent asks for your approval before it runs most shell commands. Only a small built-in set of read-only file and git checks run without asking first. When you approve a data warehouse command, the shell tool uses your active local cloud login. Whatever tables your local profile can read or write, the agent can reach too.

What native roles solve and what they leave open

Cloud identity roles are great at deciding who can log in to a project. You can create a service account that only has permission to read specific datasets. Putting that read-only account into your MCP setup stops the agent from dropping tables. It also blocks the agent from altering rows or creating new datasets by mistake. For basic safety against data loss, a strict read-only cloud role works well.

Still, cloud login roles only check who starts the session at the door. They do not inspect what individual queries do while the session is active. A read-only account can still run a huge query that scans terabytes of data. Worse, a read-only role still returns raw text from every column in an allowed table by default. If that table holds emails, phone numbers, card numbers, or national IDs, the query pulls them right back. Those raw values flow straight into the agent session and out to the model provider. Native roles also struggle when an engineer needs a one-time write query reviewed by a peer.

Claude Code Security + Ephemeral Credentials: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Steps to lock down agent database sessions

Start by separating the agent login from your own personal admin account. Never let an MCP server inherit a developer login that holds full project owner rights. Create a dedicated cloud role made just for the coding agent. Grant that role read access only to the non-sensitive datasets the task needs. Keep tables with emails, card numbers, and phone numbers in separate datasets outside that role.

Next, keep Claude Code in manual approval mode when it uses the Bash tool. Read every shell command the agent proposes before you let it run. Check the target dataset and the query text to make sure it looks safe. Finally, add a way to rewrite sensitive fields like national IDs in query results before they reach the agent.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev sits inline in the protocol beside each supported service as an open-source proxy, a sidecar for your database or API. For every query or command an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human approval.

First, hoop.dev guardrails block banned queries before they run or hold risky ones for review, and hoop.dev data masking rewrites matched sensitive values in responses in memory. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

How does Claude Code connect to external databases?

Claude Code reaches databases through Model Context Protocol servers or by running commands through its Bash tool. Both methods rely on the login keys or local profiles you configure on your machine.

Should I give Claude Code a read-only database user?

Yes, official docs recommends using a read-only database user for agent database setups. This stops the queries Claude runs from changing or deleting your data.

Does Claude Code run Bash database commands without asking?

In manual mode, the Bash tool requires your approval before running database commands. It only runs a small built-in set of basic file and git checks without asking.

The query runs. The emails stay hidden.