How to Configure Codex Bigquery MCP Server

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up a codex bigquery mcp server by linking your coding agent to BigQuery. You must use a strict cloud role that limits what the agent can read. Many teams start by giving the agent their own personal cloud login. Others create a shared service account with broad project owner rights. This quick approach creates big risks when an agent runs bad queries. How the codex bigquery mcp server setup works Coding agents use the Model Context Protocol to talk to outside databases and tools. The

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 a codex bigquery mcp server by linking your coding agent to BigQuery. You must use a strict cloud role that limits what the agent can read. Many teams start by giving the agent their own personal cloud login. Others create a shared service account with broad project owner rights. This quick approach creates big risks when an agent runs bad queries.

How the codex bigquery mcp server setup works

Coding agents use the Model Context Protocol to talk to outside databases and tools. The server acts as a bridge between the coding agent and your cloud data. When you ask the agent a question, it picks a tool from the server. Then the server sends a SQL query to BigQuery using your cloud key.

To set this up well, you first create a dedicated cloud service account. You give this account a role that only lets it read specific data tables. You never give the agent rights to drop tables or change schemas. Next, you point the local server setup to this limited cloud key. You also set a query size limit in your cloud project settings. This stops the agent from scanning huge tables and running up huge bills. Now the coding agent can inspect table layouts and run safe test queries.

Where native cloud permissions fall short

Native cloud roles do a good job of controlling who can log in. They also limit which datasets and tables a service account can reach. A read-only role stops the agent from deleting rows or breaking production tables. Still, cloud roles only check access at the table or column level.

Once a table is open, the agent can read every row inside it. The cloud role does not inspect what individual SQL statements do in flight. If a table holds customer emails or phone numbers, the query pulls them back. Those raw values go straight into the coding agent context window. A static cloud key also sits on the developer machine as a plain file. Anyone or any local process with file access can take that key. Static roles cannot ask a human to approve one risky query in real time. They also cannot mask card numbers or national IDs inside query results on the fly.

BigQuery IAM + Kubernetes API Server Access: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Steps to tighten agent database access

Teams can reduce risk by changing how they manage agent database sessions. First, remove personal user logins from all local agent tool setups. Every agent should use its own restricted identity with clear audit logs. Second, scope dataset rights down to only the tables needed for the task. Do not grant project-wide read roles when one test dataset is enough.

Third, watch query logs to see what SQL the coding agent writes. Agents often write wide queries that pull more columns than the task needs. Fourth, rotate service account keys often so old credentials do not stay active. Even better, move away from local key files stored on developer laptops. Put runtime checks in place so sensitive fields get rewritten before reaching the model.

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

Should a coding agent use a read-write role for BigQuery?

No, you should give the agent a read-only role for your data tables. This stops the model from changing rows or deleting tables by mistake.

What happens if the agent queries a table with private user data?

Standard cloud roles return all rows from any table the account can read by default. Without data masking, emails and phone numbers go right into the model prompt.

How can teams stop an agent from running costly BigQuery scans?

You can set maximum bytes billed limits on the cloud project or user. You can also limit the agent to small sample tables during coding tasks.

The query runs. The emails stay hidden.