Skip to main content
Glama
erayguner

GCP BigQuery MCP Server

by erayguner

GCP BigQuery MCP サーバー

CI MegaLinter TypeScript Node MCP SDK OpenTelemetry License: MIT PRs Welcome

Google Cloud Platform BigQuery向けのエンタープライズグレードMCP(Model Context Protocol)サーバー。Workload Identity Federation認証を使用し、Model Context Protocolを通じてBigQueryへの安全なキーレスアクセスを提供します。

主な機能

  • サービスアカウントキー不要 - 100% Workload Identity Federationを採用

  • Google Workspace統合 - OIDCユーザー認証

  • MCPプロトコル準拠 - 公式MCP SDKのベストプラクティスに準拠

  • マルチテナント対応 - YAML許可リスト + BigQueryデータセットのIAM条件

  • セキュリティミドルウェア - レート制限、プロンプトインジェクション検知、データマスキング

  • Model Armorプリフライト - ツール実行前のオプションのコンテンツ安全性チェック

  • Private Service Connect - エンタープライズ消費者向けのオプションのプライベートイングレス

  • 顧客管理暗号化 - BigQueryデータセット向けのCMEK

  • 包括的な監査ログ - コンプライアンスのための7年間の保持期間

  • Terraformインフラストラクチャ - 再現可能なデプロイのための完全なIaC

  • Cloud Runデプロイ - サーバーレス、自動スケーリングアーキテクチャ

  • OpenTelemetry - 分散トレーシングとテナントごとのメトリクス

Related MCP server: bq_mcp_server

プロジェクト構造

db-mcp/
├── src/                       # TypeScript source code
│   ├── auth/                  # WIF authentication modules
│   ├── bigquery/              # BigQuery client, discovery, optimization
│   ├── mcp/                   # MCP protocol handlers and tools
│   ├── security/              # Security middleware
│   ├── monitoring/            # Health checks and monitoring
│   ├── telemetry/             # OpenTelemetry instrumentation
│   ├── config/                # Configuration management
│   └── utils/                 # Logging utilities
├── tests/                     # Unit, integration, and performance tests
├── terraform/                 # Infrastructure as Code
│   └── modules/               # Reusable Terraform modules
├── docs/                      # Comprehensive documentation
├── scripts/                   # Deployment and utility scripts
├── examples/                  # Usage examples
├── .github/workflows/         # CI/CD automation
└── Dockerfile                 # Production container image

セキュリティアーキテクチャ

従来のアプローチ(回避済み)

  • ファイルやシークレットに保存されたサービスアカウントキー

  • 有効期限のない永続的な認証情報

  • 手動でのキーローテーションが必要

  • 認証情報漏洩のリスクが高い

Workload Identity Federation(実装済み)

  • システム内にキーを一切保持しない

  • 自動ローテーション付きの1時間トークン有効期限

  • きめ細かな制御のための属性ベースのアクセス

  • すべてのアクセスに対する完全な監査証跡

  • 攻撃対象領域を90%削減

クイックスタート

前提条件

  • 課金が有効なGCPプロジェクト

  • Terraform >= 1.5.0

  • Node.js >= 22.0.0

  • Docker(コンテナ化用)

インストール

# Clone and install dependencies
npm install

# Copy environment configuration
cp .env.example .env

# Build the project
npm run build

ローカル開発

# Development mode with hot reload
npm run dev

# Run tests
npm test

# Type checking
npm run typecheck

本番環境へのデプロイ

# Build Docker image
docker build -t mcp-bigquery-server .

# Deploy infrastructure with Terraform
cd terraform
terraform init
terraform apply

# Deploy to Cloud Run
gcloud run deploy mcp-bigquery-server \
  --image gcr.io/YOUR_PROJECT/mcp-bigquery-server \
  --region us-central1

MCPツール

サーバーは以下のMCPツールを提供します:

ツール

説明

query_bigquery

BigQueryデータセットに対してSQLクエリを実行

list_datasets

利用可能なすべてのBigQueryデータセットを一覧表示

list_tables

特定のデータセット内のテーブルを一覧表示

get_table_schema

テーブルのスキーマ情報を取得

サーバー機能

  • リソース:BigQueryデータセットの一覧表示

  • ツール:クエリ実行およびスキーマ検査

  • Stderrログ:すべてのログをstderrに出力(JSON-RPC互換)

  • グレースフルシャットダウン:SIGTERM/SIGINT処理

アーキテクチャ

Client Request
  ↓
MCP Protocol Layer (JSON-RPC)
  ↓
Security Middleware (rate limiting, injection detection)
  ↓
Workload Identity Federation
  ↓ (OIDC Token)
Identity Pool
  ↓ (Attribute Mapping)
Service Account Impersonation
  ↓ (1-hour access token)
BigQuery API

コアコンポーネント

  1. Workload Identity Federation - OIDCプロバイダーを使用した開発/ステージング/本番環境用のIDプール

  2. セキュリティミドルウェア - レート制限、プロンプトインジェクション検知、SQLインジェクション防止

  3. BigQuery統合 - コネクションプーリング、クエリ最適化、データセット検出

  4. モニタリング - ヘルスチェック、OpenTelemetryトレーシング、Cloud Monitoring統合

ドキュメント

ドキュメント

説明

利用ガイド

ローカル開発、テスト、本番環境向けの完全ガイド

アーキテクチャ

システム設計およびコンポーネントドキュメント

セキュリティ

セキュリティミドルウェアとベストプラクティス

WIFガイド

Workload Identity Federationの詳細

デプロイ

完全な本番環境デプロイガイド

Docker

コンテナ設定

モニタリング

可観測性の設定

ドキュメントインデックス

完全なドキュメントマップ

テスト

# Run all tests
npm test

# Run specific test suites
npm run test:unit
npm run test:integration
npm run test:performance

# Run with coverage
npm run test:coverage

# Watch mode
npm run test:watch

開発コマンド

npm run build       # Build TypeScript
npm run dev         # Development with hot reload
npm run start       # Start production server
npm run lint        # Run ESLint
npm run lint:fix    # Fix linting issues
npm run format      # Format with Prettier
npm run typecheck   # TypeScript type checking

CI/CD

GitHub Actionsワークフローが自動的に以下を実行します:

  1. プルリクエストに対するテストの実行

  2. Dockerイメージのビルドとプッシュ

  3. メインブランチへのCloud Runデプロイ

  4. Workload Identity Federationの使用(キーなし)

モニタリング

  • Cloud Monitoring: mcp.tool.calls.total および mcp.tool.call.durationtenant_id ディメンションを設定した事前構成済みダッシュボード

  • Cloud Logging: 構造化JSONログ

  • Cloud Trace: tenant.id スパン属性を使用したOpenTelemetryによる分散トレーシング

  • 監査ログ: BigQueryでの7年間の保持

  • アラート: メール/Slack通知

コンプライアンス

  • GDPR: データの保存場所とアクセスログ

  • HIPAA: アクセス制御と監査証跡

  • SOC 2: ID管理とモニタリング

  • PCI-DSS: 認証と認可

貢献

貢献を歓迎します!ガイドラインについては CONTRIBUTING.md を参照してください。

ライセンス

MITライセンス - 詳細は LICENSE を参照してください

謝辞


ステータス: 本番環境対応 バージョン: 1.0.0 最終更新日: 2026年4月

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

No tool schema history has been recorded yet.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    A 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.
    1
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    A Python MCP server that retrieves and caches BigQuery metadata (datasets, tables, columns) and enables secure SQL query execution with cost control, file export, and keyword search.
    6
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Production-ready MCP server for BigQuery that translates natural language questions to SQL, executes queries securely, and delivers results via stdio or HTTP for integration with GitHub Copilot, Power BI, and web applications.
    237
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    MCP server for secure BigQuery access across multiple Google Cloud projects, enabling querying, schema exploration, and data analysis with SQL validation and read-only controls.
    2
    MIT

Latest Blog Posts

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/erayguner/db-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server