Back to MCP Servers

BigQuery MCP Server

Fully managed remote MCP server from Google Cloud that lets AI agents discover BigQuery datasets, inspect schemas, and execute SQL queries via OAuth.

Analytics by Google Cloud OAuth2 active
Overview

The BigQuery MCP server is a fully managed, Google-hosted remote MCP endpoint that exposes BigQuery resources and SQL execution to AI agents and LLM clients. Instead of self-hosting an MCP server or wiring up custom BigQuery SDK calls, clients connect directly to https://bigquery.googleapis.com/mcp and authenticate with Google Cloud credentials over OAuth 2.0. Access is gated by IAM, so existing BigQuery roles, deny policies, and audit logging continue to apply.

The server exposes a small, focused tool set for data discovery and querying: listing datasets and tables in a project, retrieving schema and metadata, and executing SQL in either read-only or read-write modes. It is compatible with any MCP-compliant client, including Gemini CLI, Claude (custom connectors), ChatGPT, Cursor, VS Code, and the Google Agent Development Kit (ADK).

Notable features include optional Model Armor screening for prompt and response safety, fine-grained IAM authorization on a per-tool basis, and centralized Cloud audit logs. Practical limits to be aware of: queries time out after 3 minutes, results are capped at 3,000 rows, and Google Drive backed external tables are not supported.

Tools

Tool Description
list_dataset_ids List all dataset IDs available in a BigQuery project.
list_table_ids List table IDs within a specified BigQuery dataset.
get_dataset_info Retrieve metadata for a BigQuery dataset, including labels, location, and description.
get_table_info Retrieve schema and metadata for a BigQuery table, including column names, types, and partitioning.
execute_sql Run a SQL query against BigQuery with read-write capability (DML/DDL allowed where IAM permits).
execute_sql_readonly Run a read-only SQL query against BigQuery. DML, DDL, and Python UDFs are blocked.
Setup Guide

Prerequisites

  • A Google Cloud project with billing enabled
  • The BigQuery API enabled on the project
  • An IAM principal granted the following roles:
    • roles/mcp.toolUser
    • roles/bigquery.jobUser
    • roles/bigquery.dataViewer

Enable the required APIs:

gcloud services enable bigquery.googleapis.com --project=YOUR_PROJECT_ID

Authenticate with Application Default Credentials:

gcloud auth application-default login

Gemini CLI

Create ~/.gemini/extensions/bigquery/gemini-extension.json:

{
  "name": "BigQuery",
  "version": "1.0.0",
  "mcpServers": {
    "bigquery_mcp": {
      "httpUrl": "https://bigquery.googleapis.com/mcp",
      "authProviderType": "google_credentials",
      "oauth": {
        "scopes": ["https://www.googleapis.com/auth/bigquery"]
      },
      "timeout": 30000,
      "headers": {
        "x-goog-user-project": "YOUR_PROJECT_ID"
      }
    }
  }
}

Claude (custom connector) and ChatGPT

These clients require you to first create OAuth 2.0 client credentials in the Google Cloud console (Desktop app type for Claude, Web application type for ChatGPT), then add a custom connector pointing at:

  • MCP server URL: https://bigquery.googleapis.com/mcp
  • OAuth scope: https://www.googleapis.com/auth/bigquery
  • Provide your generated Client ID and Client Secret.

VS Code

Use the Command Palette: MCP: Add Server..., select HTTP, enter https://bigquery.googleapis.com/mcp, and either supply OAuth credentials or attach a bearer token via headers using Application Default Credentials.

Notes and limits

  • Query timeout: 3 minutes
  • Result cap: 3,000 rows
  • Google Drive external tables are not supported
  • In read-only mode, DML, DDL, and Python UDFs are blocked
Use Cases
  • Conversational data exploration: let an agent introspect a BigQuery project, surface dataset and table schemas, and answer ad hoc analytical questions in natural language.
  • Build internal analytics copilots that translate plain-English questions into SQL and run them safely against BigQuery using execute_sql_readonly.
  • Power forecasting and reporting agents that combine get_table_info with parameterized SQL to generate weekly business summaries.
  • Trigger downstream workflows (emails, tickets, Slack messages) when a BigQuery query result crosses a threshold, orchestrated by an MCP-enabled agent.
  • Use Gemini CLI or the Agent Development Kit (ADK) to prototype multi-step data agents without writing BigQuery client code.
Example Prompts
  • "List all datasets in project acme-analytics and show me the schema of the orders table."
  • "Run a read-only SQL query to count daily active users in acme-analytics.events.app_events over the last 30 days."
  • "Find the top 10 customers by revenue in the sales.transactions table for Q1 2026."
  • "Summarize the partitioning and clustering setup for every table in the warehouse dataset."
  • "Check yesterday's checkout funnel conversion rate in BigQuery and email me if it dropped below 3%."
Pros
  • Official, fully managed remote server from Google Cloud, no infrastructure to run.
  • Reuses existing BigQuery IAM, deny policies, and Cloud audit logging for governance.
  • Supports both read-only and read-write SQL execution, with optional Model Armor for prompt safety.
  • Works out of the box with Gemini CLI, Claude, ChatGPT, Cursor, VS Code, and the ADK.
Limitations
  • Hard limits of 3 minute query timeout and 3,000 row result cap make it unsuitable for large data extracts.
  • No support for Google Drive backed external tables.
  • Currently in Preview (as of early 2026), so APIs and tool surface may change.
Alternatives