BigQuery Validator
mcp-bigquery
Model Context Protocol을 통한 안전한 BigQuery 탐색
개요
mcp-bigquery는 AI 어시스턴트(예: Claude)가 Google BigQuery와 안전하게 상호작용할 수 있도록 하는 Model Context Protocol(MCP) 서버입니다.
주요 기능
안전한 실행: 모든 작업은 엄격히 dry-run 검증으로 제한됩니다. 서버는 데이터를 변경하거나 실행 비용이 발생하는 쿼리를 절대 실행하지 않습니다.
비용 투명성: 실행 전에 쿼리 비용과 처리 바이트 수의 추정치를 제공합니다.
정적 분석: 쿼리 종속성을 분석하고 SQL 구문을 검증합니다.
스키마 탐색: 데이터셋, 테이블, 컬럼을 탐색합니다.
비즈니스 가치
문제 | mcp-bigquery를 사용한 해결 방안 |
비용이 많이 드는 쿼리의 의도하지 않은 실행 | 실행 전 비용 추정 |
SQL 구문 오류로 인한 개발 지연 | 조기 구문 오류 감지 |
스키마 구조에 대한 가시성 부족 | 안전한 스키마 메타데이터 탐색 |
AI에 의한 무단 데이터 변경 위험 | 강제된 dry-run 제약 조건 |
Related MCP server: mcp-bigquery-dryrun
빠른 시작
1단계: 설치
pip를 통해 패키지를 설치합니다:
pip install mcp-bigquery2단계: 인증
Google Cloud Platform 인증을 설정합니다:
# For user account authentication
gcloud auth application-default login
# For service account authentication
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json3단계: Claude Desktop 구성
Claude Desktop 구성 파일에서 서버를 구성합니다:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
다음 항목을 추가합니다:
{
"mcpServers": {
"mcp-bigquery": {
"command": "mcp-bigquery",
"env": {
"BQ_PROJECT": "your-gcp-project-id"
}
}
}
}4단계: 검증
Claude Desktop을 다시 시작하고 다음 쿼리를 실행하여 설정을 확인합니다:
"내 BigQuery 프로젝트에서 사용할 수 있는 데이터셋은 무엇인가요?"
"다음 쿼리의 비용을 추정할 수 있나요: SELECT * FROM dataset.table"
"users 테이블의 스키마를 보여주세요"
사용 가능한 도구
SQL 검증 및 분석
도구 | 용도 | 주요 사용 사례 |
bq_validate_sql | SQL 구문 확인 | 쿼리 실행 전 검증 |
bq_dry_run_sql | 비용 추정치 및 메타데이터 검색 | 실행 전 비용 평가 |
bq_extract_dependencies | 테이블 종속성 매핑 | 데이터 계보 및 종속성 매핑 |
bq_validate_query_syntax | 상세 구문 분석 | 복잡한 SQL 쿼리 디버깅 |
스키마 탐색
도구 | 용도 | 주요 사용 사례 |
bq_list_datasets | 프로젝트의 모든 데이터셋 나열 | 초기 프로젝트 탐색 |
bq_list_tables | 파티셔닝 메타데이터가 있는 테이블 나열 | 데이터셋 구조 탐색 |
bq_describe_table | 상세 스키마 정보 가져오기 | 컬럼 수준 검증 |
bq_get_table_info | 포괄적인 메타데이터 검색 | 테이블 통계 분석 |
bq_preview_table | 테이블 데이터 미리보기(무비용) | 데이터 스캔 비용 없이 샘플 레코드 확인 |
[!IMPORTANT] bq_preview_table 도구는
client.list_rows(API:tabledata.list)를 사용하여 샘플 행을 직접 검색하므로 스캔되는 바이트가 0이고 실행 비용이 발생하지 않습니다. 민감한 정보(예: PII)가 LLM에 의도치 않게 노출되는 것을 방지하기 위해 이 도구는 기본적으로 비활성화되어 있습니다. 환경 구성에서MCP_BQ_ENABLE_PREVIEW=true를 설정하여 명시적으로 옵트인해야 합니다.
구성
환경 변수
변수 | 용도 | 기본값 |
| 대상 GCP 프로젝트 ID | ADC를 통해 결정됨 |
| 대상 BigQuery 리전 | 설정 안 됨 |
| 비용 추정에 사용되는 TiB당 가격 | 5.0 |
| 로깅 상세 수준(DEBUG, INFO, WARNING, ERROR, CRITICAL) | WARNING |
| bq_preview_table 도구 활성화(true/false) | false |
.env 파일 예시
로컬 테스트 또는 개발 환경에서 .env 파일에 다음 변수를 정의할 수 있습니다:
BQ_PROJECT=your-gcp-project-id
BQ_LOCATION=asia-northeast1
SAFE_PRICE_PER_TIB=5.0
LOG_LEVEL=WARNING
MCP_BQ_ENABLE_PREVIEW=true전체 Claude Desktop 구성 예시
{
"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",
"MCP_BQ_ENABLE_PREVIEW": "true"
}
}
}
}문제 해결
오류 유형별 해결 방법
인증 오류
Error: Could not automatically determine credentials해결 방법: 명령줄을 사용하여 다시 인증합니다:
gcloud auth application-default login
권한 거부
Error: User does not have bigquery.tables.get permission해결 방법: 대상 ID에
BigQuery Data Viewer역할을 부여합니다:gcloud projects add-iam-policy-binding YOUR_PROJECT \ --member="user:your-email@example.com" \ --role="roles/bigquery.dataViewer"
프로젝트 ID 누락
Error: Project ID is required해결 방법: 구성에서
BQ_PROJECT변수가 올바르게 설정되어 있는지 확인합니다.
사용 예시
예시 1: 실행 전 비용 확인
# 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 GB예시 2: 테이블 구조 이해
# 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)예시 3: 데이터 종속성 추적
# 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프로젝트 상태 및 버전 이력
버전 | 릴리스 날짜 | 변경 사항 요약 |
v0.7.1 | 2026-08-17 | mcp 종속성 제약 조건을 개선하고 wiki 문서를 간소화했습니다. |
v0.7.0 | 2026-06-21 | 무비용 테이블 미리보기 도구( |
v0.6.0 | 2026-06-21 | 스레드 안전 캐싱, 재귀적 AST 쿼리, 백오프 재시도 및 Google API 예외 매핑 |
v0.5.0 | 2026-01-02 | 포맷터 통합, 클라이언트 캐시 및 로깅 제어 통합 |
v0.4.2 | 2025-12-08 | 모듈식 스키마 탐색기 및 통합 클라이언트/로깅 제어 |
v0.4.1 | 2025-01-22 | 오류 처리 및 디버그 로깅 개선 |
v0.4.0 | 2025-01-22 | 스키마 탐색 도구 추가 |
v0.3.0 | 2025-01-17 | SQL 정적 분석 엔진 통합 |
v0.2.0 | 2025-01-16 | 기본 검증 및 dry-run 쿼리를 지원하는 초기 릴리스 |
개발 및 기여
로컬 개발 환경 설정 및 기여 정책에 대한 지침은 CONTRIBUTING.md 가이드를 참조하세요.
# Clone the repository
git clone https://github.com/caron14/mcp-bigquery.git
cd mcp-bigquery
# Install development dependencies
pip install -e ".[dev]"
# Execute the test suite
pytest tests/라이선스
이 프로젝트는 MIT 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 LICENSE를 참조하세요.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceA read-only BigQuery MCP server with auto-LIMIT injection, dry-run cost guard, and ADC authentication. Allows safe SQL querying of BigQuery by LLMs without risk of data modification or unexpected costs.1MIT
- AlicenseAqualityFmaintenanceValidates BigQuery SQL syntax and performs dry-run analysis without executing queries, providing cost estimates, referenced tables, and schema previews.2Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables LLMs to explore BigQuery datasets and tables, run safe read-only queries, and optionally perform vector search using BigQuery embeddings.9MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to query and analyze Google BigQuery data, including schema browsing, running queries, and comparing datasets through natural language.MIT
Related MCP Connectors
Deterministic validation for AI-generated artifacts: JSON Schema, OpenAPI response, SQL syntax.
Run SOQL queries to explore and retrieve Salesforce data. Inspect records, fields, and relationshi…
Run SOQL queries against your Salesforce org to explore and retrieve data. Quickly iterate on filt…
Appeared in Searches
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/caron14/mcp-bigquery'
If you have feedback or need assistance with the MCP directory API, please join our Discord server