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_sql
tool - Dry-Run Analysis: Perform dry-run operations using the
bq_dry_run_sql
tool 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
mcp-bigquery
The mcp-bigquery
package provides a minimal MCP server for BigQuery SQL validation and dry-run analysis. This server provides exactly two tools for validating and analyzing BigQuery SQL queries without executing them.
** IMPORTANT: This server does NOT execute queries. All operations are dry-run only. Cost estimates are approximations based on bytes processed.**
Features
- SQL Validation: Check BigQuery SQL syntax without running queries
- Dry-Run Analysis: Get cost estimates, referenced tables, and schema preview
- Parameter Support: Validate parameterized queries
- Cost Estimation: Calculate USD estimates based on bytes processed
Quick Start
Prerequisites
- Python 3.10+
- Google Cloud SDK with BigQuery API enabled
- Application Default Credentials configured
Installation
From PyPI (Recommended)
From Source
Authentication
Set up Application Default Credentials:
Or use a service account key:
Configuration
Environment Variables
Variable | Description | Default |
---|---|---|
BQ_PROJECT | GCP project ID | From ADC |
BQ_LOCATION | BigQuery location (e.g., US, EU, asia-northeast1) | None |
SAFE_PRICE_PER_TIB | Default price per TiB for cost estimation | 5.0 |
Claude Code Integration
Add to your Claude Code configuration:
Or if installed from source:
Tools
bq_validate_sql
Validate BigQuery SQL syntax without executing the query.
Input:
Success Response:
Error Response:
bq_dry_run_sql
Perform a dry-run to get cost estimates and metadata without executing the query.
Input:
Success Response:
Error Response:
Examples
Validate a Simple Query
Validate with Parameters
Get Cost Estimate
Analyze Complex Query
Testing
Run tests with pytest:
Development
Limitations
- No Query Execution: This server only performs dry-runs and validation
- Cost Estimates: USD estimates are approximations based on bytes processed
- Parameter Types: Initial implementation treats all parameters as STRING type
- Cache Disabled: Queries always run with
use_query_cache=False
for accurate estimates
License
MIT
Changelog
0.2.1 (2025-08-16)
- Fixed GitHub Pages documentation layout issues
- Enhanced MkDocs Material theme compatibility
- Improved documentation dependencies and build process
- Added site/ directory to .gitignore
- Simplified documentation layout for better compatibility
0.2.0 (2025-08-16)
- Code quality improvements with pre-commit hooks
- Enhanced development setup with Black, Ruff, isort, and mypy
- Improved CI/CD pipeline
- Documentation enhancements
0.1.0 (2025-08-16)
- Initial release
- Renamed from mcp-bigquery-dryrun to mcp-bigquery
- SQL validation tool (bq_validate_sql)
- Dry-run analysis tool (bq_dry_run_sql)
- Cost estimation based on bytes processed
- Support for parameterized queries
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Enables validation and dry-run analysis of BigQuery SQL queries without execution. Provides cost estimates, schema previews, and syntax validation for BigQuery queries.
Related Resources
Related MCP Servers
- AsecurityAlicenseAqualityAllows AI assistants to list tables, read data, and execute SQL queries through a controlled interface, making database exploration and analysis safer and more structured.Last updated -1768PythonMIT License
- -securityFlicense-qualityA server that enables executing and validating SQL queries against Google BigQuery with safety features that prevent data modifications and excessive processing.Last updated -1TypeScript
- -securityFlicense-qualityA tool that provides simple API to execute SQL queries and manage MySQL databases, designed to integrate with Cursor IDE for AI assistants to directly perform database operations.Last updated -Python
- -securityFlicense-qualityManages query validation, database connection, and security for a system that transforms SQL databases into interactive dashboards using natural language queries.Last updated -Python