Skip to main content
Back to the BigQuery MCP server

MCP Gateway · OpenCode

BigQuery icon

Connect BigQuery to OpenCode

When a pipeline breaks overnight, the first questions are about the warehouse. From the OpenCode terminal, through the Speakeasy MCP Gateway, you can list a project's datasets, find the table a job writes to and spot-check row counts with read-only SQL. The OpenCode plugin reports token and cost totals per turn, and tool output is blocked at the gateway.

Category
Data & analytics
Tools
6
Authentication
OAuth
OpenCode
Terminal

Behind the MCP Gateway

Run BigQuery MCP behind the MCP Gateway

One URL for every agent, sign-in through your IdP, RBAC down to the tool, and every BigQuery call inspected and logged.

Deploy on MCP Gateway

Before you start

What BigQuery needs first

A Google Cloud project administrator with IAM admin access does the BigQuery side of the setup.

  • You need a Google Account that can administer the project and create OAuth credentials.
  • Granting roles needs IAM admin access, such as Project IAM Admin.
  • Billing is optional for initial setup.
  • External apps in Testing allow at most 100 test users, and authorizations expire after seven days.

In BigQuery

  1. Enable the BigQuery API in the project.
  2. Grant each user MCP Tool User, BigQuery Job User, and BigQuery Data Viewer.
  3. Configure the OAuth consent screen as Internal or External.
  4. For External apps, add the BigQuery scope and test users, or publish the app.
  5. Create an OAuth client and copy its credentials.
Full BigQuery setup guide in the docs

Set up

Add BigQuery to OpenCode in 4 steps

  1. 01

    Add BigQuery from the catalog

    An admin finds BigQuery in the MCP Catalog (MCP Gateway > MCP > Catalog) and clicks Add. Speakeasy registers the vendor's server as a remote MCP server and proxies sessions to it. Nothing is copied or re-hosted.

    BigQuery uses OAuth. Servers that support dynamic client registration get their OAuth configuration applied automatically.

    Where MCP-scoped policies are enabled, the install offers a recommended risk policy for the new server that detects secrets and PII and inspects tool requests and responses.

  2. 02

    Choose who can use BigQuery

    Give teams the mcp:connect scope on the BigQuery server through team access or a role. OpenCode connects to the BigQuery server's own URL, and the server's authorization decides who can connect and which tools they can call.

  3. 03

    Connect OpenCode

    Add the server to OpenCode's own mcp config block as a remote server.

    Copy the server's URL from its hosted install page in Speakeasy.

    Add it to the mcp block of your OpenCode config with type set to remote.

    Restart OpenCode and sign in when prompted.

    {
      "mcp": {
        "<server slug>": {
          "type": "remote",
          "url": "<URL from the hosted install page>"
        }
      }
    }
  4. 04

    Sign in and use BigQuery from OpenCode

    The first time OpenCode connects, it opens a browser so the person can sign in to Speakeasy through your identity provider.

    BigQuery needs its own OAuth grant, so each person connects it once. Until they do, BigQuery calls fail while the rest of the gateway keeps working.

    From then on, BigQuery's tools appear in OpenCode, limited to what the person's access allows, and every call lands in the gateway's tool logs.

OpenCode doesn't receive MCP servers from plugins. The observability package is installed separately, from a ZIP or with speakeasy-hooks install --provider=opencode, and the device agent can maintain it.

Use cases

What OpenCode users do with BigQuery

Take stock of a project's datasets

OpenCode lists every dataset in the Google Cloud project and reads the metadata for each, a quick inventory when you inherit a pipeline.

list_dataset_idsget_dataset_info

Find the table a job writes to

Given a job's target dataset, OpenCode lists its tables and reads the one that matches, so you can see what the failing step expects.

list_table_idsget_table_info

Spot-check rows after a rerun

Once the job reruns, ask OpenCode to count today's rows and look for duplicates with a read-only query before you close the alert.

execute_sql_readonly

Tools

6 tools

Each BigQuery tool can be allowed or denied per team and role at the MCP Gateway before OpenCode sees it.

list_dataset_ids

List BigQuery dataset IDs in a Google Cloud project.

get_dataset_info

Get metadata information about a BigQuery dataset.

list_table_ids

List table ids in a BigQuery dataset.

get_table_info

Get metadata information about a BigQuery table.

execute_sql_readonly

Run a read-only SQL query in the project and return the result. Prefer this tool over execute_sql if possible.

execute_sql

Run a SQL query in the project and return the result. Prefer the execute_sql_readonly tool if possible.

Control

What Speakeasy can see and stop in OpenCode

The gateway covers every client the same way. The rest depends on what OpenCode exposes to Speakeasy.

Tool logs

Gateway

Every BigQuery call is logged with the person and the client that made it.

Access by role

Gateway

People reach only the BigQuery tools their team or role allows.

Request and response blocking

Gateway

A risk policy scoped to BigQuery can reject a tool request before it reaches the server, or withhold a result from OpenCode. MCP-scoped policies are enabled per organization.

Prompt and tool-call blocking

OpenCode

The OpenCode plugin sends each prompt and tool call to Speakeasy, which allows or denies it before it runs.

Usage telemetry

OpenCode

Token and cost totals flow through the plugin, reported per turn.

Device agent

OpenCode

The device agent installs and maintains the observability package.

  • OpenCode has no OpenTelemetry exporter, so session data comes through the plugin.
  • Tool output is blocked at the gateway rather than in OpenCode's hooks.

Questions

Frequently asked questions

Is OpenCode blocked from writing to BigQuery?
Only if your role denies execute_sql. The OpenCode plugin sends each tool call to Speakeasy, which allows or denies it before it runs.
Does BigQuery MCP setup need billing enabled?
Billing is optional for initial setup. The project still needs the BigQuery API enabled and an OAuth client created.
How do OpenCode users get BigQuery?
An admin adds BigQuery from the Speakeasy MCP Catalog and grants access by team or role. Add the server to OpenCode's own mcp config block as a remote server. Each person then sees only the BigQuery tools their access allows.
Are BigQuery calls from OpenCode logged?
Yes. BigQuery calls go through the MCP Gateway, which logs each tool call and attributes it to the person and the client that made it.

Connect more

BigQuery in other clients

AI everywhere.

Control here.