The BigQuery Validator server provides tools for validating and analyzing BigQuery SQL queries without executing them.
SQL Validation: Check BigQuery SQL syntax for correctness using the
bq_validate_sqltoolDry-Run Analysis: Perform dry-run operations using the
bq_dry_run_sqltool to obtain:Cost estimates in USD based on bytes processed (customizable price per TiB)
Referenced tables identification
Output schema preview
Parameter Support: Both validation and dry-run tools support parameterized queries with key-value pairs
Safe Operation: All operations are dry-run only - no queries are executed or data modified
Provides tools for validating BigQuery SQL syntax and performing dry-run analysis to get cost estimates, schema previews, and metadata without executing queries
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@BigQuery Validatorestimate the cost of SELECT * FROM sales.transactions WHERE date > '2024-01-01'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-bigquery
Safe BigQuery exploration through Model Context Protocol
Documentation | Quick Start | Tools | Examples
π What is this?
mcp-bigquery is an MCP (Model Context Protocol) server that enables AI assistants like Claude to safely interact with Google BigQuery.
π― Key Features
graph LR
A[AI Assistant] -->|MCP Protocol| B[mcp-bigquery]
B -->|Dry-run Only| C[BigQuery API]
B -.->|β Never Executes| D[Actual Query Execution]π‘οΈ 100% Safe: All operations are dry-run only (never executes queries)
π° Cost Transparency: See costs before running any query
π Complete Analysis: Analyze dependencies and validate SQL syntax
π Schema Explorer: Browse datasets, tables, and columns with ease
β‘ Why use mcp-bigquery?
Problem | Solution with mcp-bigquery |
πΈ Accidentally running expensive queries | Check costs before execution |
π Wasting time on SQL errors | Detect syntax errors before running |
πΊοΈ Unknown table structures | Easily explore schemas |
β οΈ AI executing dangerous operations | Everything is read-only and safe |
Related MCP server: MySQL MCP
π Quick Start (4 minutes)
Step 1: Install (1 minute)
pip install mcp-bigqueryStep 2: Authenticate with Google Cloud (2 minutes)
# For personal accounts
gcloud auth application-default login
# For service accounts
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.jsonStep 3: Configure Claude Desktop (1 minute)
Open your Claude Desktop config:
Mac:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
Add this configuration:
{
"mcpServers": {
"mcp-bigquery": {
"command": "mcp-bigquery",
"env": {
"BQ_PROJECT": "your-gcp-project-id" // β Replace with your project ID
}
}
}
}Step 4: Test It!
Restart Claude Desktop and try these questions:
"What datasets are available in my BigQuery project?"
"Can you estimate the cost of: SELECT * FROM dataset.table"
"Show me the schema for the users table"π οΈ Available Tools
π SQL Validation & Analysis
Tool | Purpose | When to Use |
bq_validate_sql | Check SQL syntax | Before running any query |
bq_dry_run_sql | Get cost estimates & metadata | π° To check costs |
bq_extract_dependencies | Extract table dependencies | To understand data lineage |
bq_validate_query_syntax | Detailed error analysis | To debug SQL errors |
π Schema Discovery
Tool | Purpose | When to Use |
bq_list_datasets | List all datasets | To explore your project |
bq_list_tables | List tables with partitioning info | To browse a dataset |
bq_describe_table | Get detailed table schema | To understand columns |
bq_get_table_info | Complete table metadata | To get statistics |
π‘ Real-World Examples
Example 1: Check Costs Before Running
# Before running an expensive query...
query = "SELECT * FROM `bigquery-public-data.github_repos.commits`"
# First, check the cost
result = bq_dry_run_sql(sql=query)
print(f"Estimated cost: ${result['usdEstimate']}")
print(f"Data processed: {result['totalBytesProcessed'] / 1e9:.2f} GB")
# Output:
# Estimated cost: $12.50
# Data processed: 2500.00 GBExample 2: Understand Table Structure
# Check table schema
result = bq_describe_table(
dataset_id="your_dataset",
table_id="users"
)
# Output:
# βββ user_id (INTEGER, REQUIRED)
# βββ email (STRING, NULLABLE)
# βββ created_at (TIMESTAMP, REQUIRED)
# βββ profile (RECORD, REPEATED)
# βββ name (STRING)
# βββ age (INTEGER)Example 3: Track Data Dependencies
# Understand query dependencies
query = """
WITH user_stats AS (
SELECT user_id, COUNT(*) as order_count
FROM orders
GROUP BY user_id
)
SELECT u.name, s.order_count
FROM users u
JOIN user_stats s ON u.id = s.user_id
"""
result = bq_extract_dependencies(sql=query)
# Output:
# Tables: ['orders', 'users']
# Columns: ['user_id', 'name', 'id']
# Dependency Graph:
# orders β user_stats β final_result
# users β final_resultπ¨ How It Works
Your Code β β Claude/AI Assistant
β
MCP Protocol
β
mcp-bigquery
β
BigQuery API (Dry-run)
β
BigQuery
(Never executes actual queries)βοΈ Configuration
Environment Variables
export BQ_PROJECT="my-project" # GCP Project ID (required)
export BQ_LOCATION="asia-northeast1" # Region (optional)
export SAFE_PRICE_PER_TIB="5.0" # Price per TiB (default: $5)
export LOG_LEVEL="INFO" # Optional log level overrideFull Claude Desktop Configuration
{
"mcpServers": {
"mcp-bigquery": {
"command": "mcp-bigquery",
"env": {
"BQ_PROJECT": "my-production-project",
"BQ_LOCATION": "asia-northeast1",
"SAFE_PRICE_PER_TIB": "6.0",
"LOG_LEVEL": "WARNING"
}
}
}
}π§ Troubleshooting
Common Issues & Solutions
β Authentication Error
Error: Could not automatically determine credentialsSolution:
gcloud auth application-default loginβ Permission Error
Error: User does not have bigquery.tables.get permissionSolution: Grant BigQuery Data Viewer role
gcloud projects add-iam-policy-binding YOUR_PROJECT \
--member="user:your-email@example.com" \
--role="roles/bigquery.dataViewer"β Project Not Set
Error: Project ID is requiredSolution: Set BQ_PROJECT in your configuration
Debug Mode
If issues persist, enable debug mode:
{
"env": {
"LOG_LEVEL": "INFO",
"BQ_PROJECT": "your-project"
}
}π Learn More
Getting Started
For Developers
π¦ Project Status
Version | Release Date | Key Features |
v0.5.0 | 2026-01-02 | Consolidated formatters, client cache, logging controls |
v0.4.2 | 2025-12-08 | Modular schema explorer, unified client/logging controls |
v0.4.1 | 2025-01-22 | Better error handling, debug logging |
v0.4.0 | 2025-01-22 | Added 6 schema discovery tools |
v0.3.0 | 2025-01-17 | SQL analysis engine |
v0.2.0 | 2025-01-16 | Basic validation & dry-run |
π€ Contributing
Pull requests are welcome! See our Contributing Guide.
# Setup development environment
git clone https://github.com/caron14/mcp-bigquery.git
cd mcp-bigquery
pip install -e ".[dev]"
# Run tests
pytest tests/π License
MIT License - see LICENSE for details.
π Acknowledgments
Google BigQuery team for the excellent API
Anthropic for the MCP protocol
All contributors and users
Built for safe BigQuery exploration π‘οΈ
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.