bigquery-mcp
Practical MCP server for large BigQuery datasets. Supports vector search. Keep LLM context small while staying fast and allowing only safe read-only actions.
Install / Use
claude mcp add pvoo -- npx -y github:pvoo/bigquery-mcpIf the server publishes to npm under a different name, use that package instead — check the repo README.
MCP Server
Model Context Protocol server
Quality Score
Category
AI & Machine LearningSupported Platforms
Tags
Our assessment of bigquery-mcp
bigquery-mcp scores 80/100 on our quality scale, 771st of 947 AI & Machine Learning skills we index.
Its MCP Server is 13 KB long, well organised into 52 sections with 23 code examples: a thorough specification that gives an agent plenty to work with.
It has 10 GitHub stars, so there is little community track record yet; judge it on its content.
Maintenance, license and trust
- The repository was last updated about 5 months ago. That is recent enough to be usable, but agent tooling moves fast, so check the instructions against your agent's current version.
- Our last check on 2026-09-29 found the source still online.
- It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 95/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful.
AI review by kimi-k2.7-code on 2026-09-28. Automated pattern scan on 2026-09-24. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.
bigquery-mcp compared with similar skills
All 4 of these similar skills score higher than bigquery-mcp; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| bigquery-mcp (this skill)by pvoo | 80 | 10 | 5mo ago | MCP Server |
| claude-memby thedotmack | 100 | 108.0k | today | CLAUDE.md |
| Agent-Reachby Panniantong | 100 | 107.3k | 7d ago | CLAUDE.md |
| Understand-Anythingby Egonex-AI | 100 | 89.4k | 5d ago | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 78.5k | 1d ago | CLAUDE.md |
Frequently asked questions
- How do I install bigquery-mcp?
- Run
claude mcp add pvoo -- npx -y github:pvoo/bigquery-mcp. The install tabs above show the steps for each supported agent. - Which AI agents does bigquery-mcp work with?
- It is written for Claude Code, Claude Desktop, Cursor and Windsurf, as a MCP Server file. Other agents that read the same format can often use it too.
- Is bigquery-mcp safe to use?
- Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful. It is MIT-licensed and scores 95/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is bigquery-mcp still maintained?
- The repository was last updated about 5 months ago. That is recent enough to be usable, but agent tooling moves fast, so check the instructions against your agent's current version.
Skill content
View source on GitHub🗂️ BigQuery MCP Server
Practical MCP server for navigating BigQuery datasets and tables by LLMs. Designed for larger projects with many datasets/tables, optimized to keep LLM context small while staying fast and safe.
- Minimal by default: list datasets and tables names; fetch details only when asked
- Navigate larger projects: filter by name, request detailed metadata/schemas on demand
- Quick table insight: optional schema, column descriptions and fill-rate to help an agent decide relevance fast
- Safe to run: read-only query execution with guardrails (SELECT/WITH only, comment stripping)
- Supports vector search: Use bigquery as your vector store. See Vector Search section for full setup instructions.
Quick Start
Prerequisites: Python 3.10+ and uv package manager
🚀 Quick Setup
Option 1: Direct from PyPI (Recommended)
# 1. Authenticate
gcloud auth application-default login
# 2. Run server
uvx bigquery-mcp --project YOUR_PROJECT --location US
Option 2: Clone locally (development setup)
# 1. Clone and setup
git clone https://github.com/pvoo/bigquery-mcp.git
cd bigquery-mcp
# 2. Configure environment
cp .env.example .env
# Edit .env with your project and location
# 3. Run or inspect
make run # Start server
make inspect # Open MCP inspector
🔧 MCP Client Configuration
Option 1: PyPI package (Recommended) Simplest setup using the published PyPI package:
{
"mcpServers": {
"bigquery": {
"command": "uvx",
"args": [
"bigquery-mcp",
"--project", "your-project-id",
"--location", "US"
]
}
}
}
Option 2: Local clone (for development)
# Clone first
git clone https://github.com/pvoo/bigquery-mcp.git
{
"mcpServers": {
"bigquery": {
"command": "uv",
"args": ["--directory", "/absolute/path/to/bigquery-mcp", "run", "bigquery-mcp"],
"env": {
"GCP_PROJECT_ID": "your-project-id",
"BIGQUERY_LOCATION": "US"
}
}
}
}
🧪 Test Your Setup
# Test with MCP inspector
npx @modelcontextprotocol/inspector uvx bigquery-mcp --project YOUR_PROJECT --location US
🔧 Configuration Options
All configuration can be set via CLI arguments or environment variables. CLI arguments take precedence.
Required Parameters
--project YOUR_PROJECT # Google Cloud project ID
--location US # BigQuery location (US, EU, etc.)
Optional Parameters
# Dataset Access Control
--datasets dataset1 dataset2 # Restrict to specific datasets (default: all datasets)
# Query & Result Limits
--list-max-results 500 # Max results for basic list operations (default: 500)
--detailed-list-max 25 # Max results for detailed list operations (default: 25)
--max-bytes-billed 109951162777 # Max bytes billed per query job (~USD 0.50/query)
# Table Analysis
--sample-rows 3 # Sample data rows returned in get_table (default: 3)
--stats-sample-size 500 # Rows sampled for column fill rate calculations (default: 500)
# Authentication
--key-file /path/to/key.json # Service account key file (default: ADC)
Environment Variables
All CLI options have corresponding environment variables:
export GCP_PROJECT_ID=your-project
export BIGQUERY_LOCATION=US
export BIGQUERY_ALLOWED_DATASETS=dataset1,dataset2
export BIGQUERY_LIST_MAX_RESULTS=500
export BIGQUERY_LIST_MAX_RESULTS_DETAILED=25
export BIGQUERY_MAX_BYTES_BILLED=109951162777
export BIGQUERY_SAMPLE_ROWS=3
export BIGQUERY_SAMPLE_ROWS_FOR_STATS=500
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json
Vector Search Configuration
See Vector Search section for full setup instructions.
--embedding-model project.dataset.model
--embedding-tables dataset.table1 dataset.table2
--distance-type COSINE
🛠️ Tools Overview
This MCP server provides 5 BigQuery tools optimized for LLM efficiency:
📊 Smart Dataset & Table Discovery
list_datasets- Dual mode: basic (names only) vs detailed (full metadata)list_tables- Context-aware table browsing with optional schema detailsget_table- Complete table analysis with schema and sample data
🔍 Safe Query Execution
run_query- Execute SELECT/WITH queries only, with cost tracking, safety validation, and a default per-query billing cap of about USD 0.50. Use LIMIT clause in queries to control result size.
🔮 Vector Search (Optional)
vector_search- Dual-mode tool: discover embedding tables (no query_text) or perform semantic similarity search (with query_text)
Key Features:
- ✅ Minimal by default - 70% fewer tokens in basic mode
- ✅ Safe queries only - Blocks all write operations
- ✅ LLM-optimized - Returns structured data perfect for AI analysis
- ✅ Cost transparent - Shows bytes processed for each query
- ✅ Cost bounded by default - Caps each query job at about USD 0.50 unless reconfigured
🔮 Vector Search (Optional)
Enable semantic similarity search using BigQuery vector embeddings.
Prerequisites: Setting Up Embeddings in BigQuery
Before using vector search, you need an embedding model and tables with embeddings:
Step 1: Create a Vertex AI connection (one-time setup)
-- In BigQuery console or bq command line
-- This creates a connection to Vertex AI for generating embeddings
CREATE EXTERNAL CONNECTION `your-project.your-region.vertex-ai`
OPTIONS (
endpoint = 'https://your-region-aiplatform.googleapis.com',
type = 'CLOUD_RESOURCE'
);
Step 2: Create the embedding model
CREATE OR REPLACE MODEL `your-project.your_dataset.text_embedding_model`
REMOTE WITH CONNECTION `your-project.your-region.vertex-ai`
OPTIONS (ENDPOINT = 'text-embedding-005');
Step 3: Add embeddings to your table
-- Add embedding column to existing table
ALTER TABLE `your-project.your_dataset.products`
ADD COLUMN IF NOT EXISTS embedding ARRAY<FLOAT64>;
-- Generate embeddings for your text data
UPDATE `your-project.your_dataset.products` t
SET embedding = (
SELECT ml_generate_embedding_result
FROM ML.GENERATE_EMBEDDING(
MODEL `your-project.your_dataset.text_embedding_model`,
(SELECT t.name AS content),
STRUCT(TRUE AS flatten_json_output)
)
)
WHERE embedding IS NULL;
See BigQuery text embeddings documentation for detailed setup instructions and connection permissions.
MCP Configuration for Vector Search
Once you have embeddings set up, configure the MCP server:
{
"mcpServers": {
"bigquery": {
"command": "uvx",
"args": [
"bigquery-mcp",
"--project", "your-project",
"--location", "US",
"--embedding-model", "your-project.your_dataset.text_embedding_model",
"--embedding-tables", "your_dataset.products", "your_dataset.documents"
]
}
}
}
Configuration Reference
| CLI Argument | Environment Variable | Default | Description |
|--------------|---------------------|---------|-------------|
| --embedding-model | BIGQUERY_EMBEDDING_MODEL | - | Required. Full path to embedding model (project.dataset.model). Validated on startup. |
| --embedding-tables | BIGQUERY_EMBEDDING_TABLES | - | Tables with embedding columns (skips auto-discovery) |
| --vector-column-contains | BIGQUERY_EMBEDDING_COLUMN_CONTAINS | embedding | Pattern for finding embedding columns (column name must contain this) |
| --distance-type | BIGQUERY_DISTANCE_TYPE | COSINE | Distance metric: COSINE, EUCLIDEAN, DOT_PRODUCT |
| --no-vector-search | BIGQUERY_VECTOR_SEARCH_ENABLED=false | enabled | Disable vector search tools |
Usage Examples
Discovery mode - find tables with embeddings:
{
"query_text": ""
}
Search mode - semantic similarity search:
{
"query_text": "solenoid valve for water",
"table_path": "my_dataset.products",
"top_k": "10",
"select_columns": "name,description,price"
}
Required Permissions
| Role | Purpose |
|------|---------|
| roles/bigquery.dataViewer | Read tables and models |
| roles/bigquery.jobUser | Run BigQuery jobs |
| roles/bigquery.metadataViewer | Auto-discover embedding tables (optional) |
🏗️ Development Setup
Local Development
# Clone and setup
git clone https://github.com/pvoo/bigquery-mcp.git
cd bigquery-mcp
make install # Setup environment + pre-commit hooks
# Development workflow
make run # Start server
make test # Run test suite
make check # Lint + format + typecheck
make inspect # Launch MCP inspector
Testing & Quality
make test # Full test suite
pytest tests/test_safety.py # SQL safety validation tests
pytest tests/test_server.py # Core server functionality tests
make check # Run all quality checks
🔐 Authentication & Permissions
Authentication Methods:
- Application Default Credentials (recommended):
gcloud auth application-default login - Service Account Key: Use
--key-fileor setGOOGLE_APPLICATION_CREDENTIALS
Required BigQuery Permissions:
bigquery.datasets.get,bigquery.datasets.listbigquery.tables.list,bigquery.tables.getbigquery.jobs.create,bigquery.data.get
🚨 Troubleshooting
Authentication Issues:
# Check current auth
gcloud auth application-default print-access-token
# Re-authenticate
gcloud auth application-default login
# Enable BigQuery API
gcloud services enable bigquery.googleapis.com
MCP Connection Issues:
- Ensure absolute paths in MCP config
- Test server manually:
make run - Check that project and location environment variables or args are set correctly
Performance Issues:
- Use
{"detailed": false}for faster responses - Add search filters:
{"search": "pattern"} - Reduce max_results for large datasets
💡 Usage Examples
📊 SQL Query Example
-- Query public datasets
SELECT
EXTRACT(YEAR FROM pickup_datetime) as year,
COUNT(*) as trips,
ROUND(AVG(fare_amount), 2) as avg_fare
FROM `bigquery-public-data.new_york_taxi_trips.tlc_yellow_trips_2020`
WHERE pickup_datetime BETWEEN '2020-01-01' AND '2020-12-31'
GROUP BY year
LIMIT 20
🤖 Example: Usage with Claude Code subagent
Scenario: Use the specialized BigQuery Table Analyst agent in Claude Code to automatically explore your data warehouse, analyze table relationships, and provide structured insights. By using the subagent you can take the context used for analyzing the tables out of the main thread and return actionable insights into the main agent thread for writing SQL or analyzing.
Setup:
# 1. Clone and configure
git clone https://github.com/pvoo/bigquery-mcp.git
cd bigquery-mcp
# 2. Setup environment
export GCP_PROJECT_ID="your-project-id"
export BIGQUERY_LOCATION="US"
gcloud auth application-default login
# 3. Launch Claude Code
claude-code
Example Usage:
💬 You: "I need to understand our sales data structure and find tables related to customer orders"
🤖 Claude: I'll use the BigQuery Table Analyst agent to explore your sales datasets and identify relevant tables with their relationships.
[Agent automatically:]
- Lists all datasets to identify sales-related ones
- Explores table schemas with detailed metadata
- Shows actual sample data from key tables
- Discovers join relationships between tables
- Provides ready-to-use SQL queries
What the Agent Returns:
- Table schemas with column descriptions and types
- Sample data showing actual values (not placeholders)
- Join relationships with working SQL examples
- Data quality insights (null rates, freshness, etc.)
- Actionable SQL queries yo
Truncated for display — read the full file on GitHub.
Related Skills
claude-mem
108.0kPersistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More
Agent-Reach
107.3kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
Understand-Anything
89.4kGraphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.
headroom
78.5kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
