Skip to main content
Glama
erayguner

GCP BigQuery MCP Server

by erayguner

GCP BigQuery MCP-Server

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

MCP-Server (Model Context Protocol) auf Enterprise-Niveau für Google Cloud Platform BigQuery mit Workload Identity Federation-Authentifizierung. Bietet sicheren, schlüssellosen Zugriff auf BigQuery über das Model Context Protocol.

Hauptfunktionen

  • Keine Service-Account-Schlüssel - 100% Workload Identity Federation

  • Google Workspace-Integration - OIDC-Benutzerauthentifizierung

  • MCP-Protokoll-konform - Befolgt die Best Practices des offiziellen MCP SDK

  • Multi-Mandanten-fähig - YAML-Allowlist + IAM-Bedingungen für BigQuery-Datasets

  • Sicherheits-Middleware - Ratenbegrenzung, Erkennung von Prompt-Injection, Daten-Schwärzung

  • Model Armor Pre-flight - Optionale Inhaltsprüfung vor der Tool-Ausführung

  • Private Service Connect - Optionaler privater Ingress für Unternehmenskunden

  • Kundenseitig verwaltete Verschlüsselung - CMEK für BigQuery-Datasets

  • Umfassende Audit-Protokollierung - 7 Jahre Aufbewahrungsfrist für Compliance

  • Terraform-Infrastruktur - Vollständiges IaC für reproduzierbare Bereitstellungen

  • Cloud Run-Bereitstellung - Serverlose, automatisch skalierende Architektur

  • OpenTelemetry - Verteiltes Tracing und Metriken pro Mandant

Related MCP server: bq_mcp_server

Projektstruktur

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

Sicherheitsarchitektur

Traditioneller Ansatz (vermieden)

  • Service-Account-Schlüssel in Dateien/Geheimnissen gespeichert

  • Permanente Anmeldedaten, die nie ablaufen

  • Manuelle Schlüsselrotation erforderlich

  • Hohes Risiko von Anmeldedaten-Lecks

Workload Identity Federation (implementiert)

  • Keine Schlüssel im System

  • 1-Stunden-Token-Lebensdauer mit automatischer Rotation

  • Attributbasierter Zugriff für fein abgestufte Kontrolle

  • Vollständiger Audit-Pfad für alle Zugriffe

  • 90% Reduzierung der Angriffsfläche

Schnellstart

Voraussetzungen

  • GCP-Projekt mit aktivierter Abrechnung

  • Terraform >= 1.5.0

  • Node.js >= 22.0.0

  • Docker (für Containerisierung)

Installation

# Clone and install dependencies
npm install

# Copy environment configuration
cp .env.example .env

# Build the project
npm run build

Lokale Entwicklung

# Development mode with hot reload
npm run dev

# Run tests
npm test

# Type checking
npm run typecheck

Produktionsbereitstellung

# 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-Tools

Der Server stellt diese MCP-Tools bereit:

Tool

Beschreibung

query_bigquery

SQL-Abfragen auf BigQuery-Datasets ausführen

list_datasets

Alle verfügbaren BigQuery-Datasets auflisten

list_tables

Tabellen in einem bestimmten Dataset auflisten

get_table_schema

Schema-Informationen für eine Tabelle abrufen

Server-Funktionen:

  • Ressourcen: Auflistung von BigQuery-Datasets

  • Tools: Abfrageausführung und Schema-Inspektion

  • Stderr-Protokollierung: Alle Protokolle an stderr (JSON-RPC-kompatibel)

  • Graceful Shutdown: SIGTERM/SIGINT-Behandlung

Architektur

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

Kernkomponenten

  1. Workload Identity Federation - Identitätspools für Dev/Staging/Prod mit OIDC-Anbietern

  2. Sicherheits-Middleware - Ratenbegrenzung, Erkennung von Prompt-Injection, SQL-Injection-Prävention

  3. BigQuery-Integration - Verbindungspooling, Abfrageoptimierung, Dataset-Erkennung

  4. Überwachung - Gesundheitsprüfungen, OpenTelemetry-Tracing, Cloud Monitoring-Integration

Dokumentation

Dokument

Beschreibung

Nutzungsanleitung

Vollständige Anleitung für lokale Entwicklung, Tests und Produktion

Architektur

Systemdesign und Komponentendokumentation

Sicherheit

Sicherheits-Middleware und Best Practices

WIF-Anleitung

Details zur Workload Identity Federation

Bereitstellung

Vollständige Anleitung zur Produktionsbereitstellung

Docker

Container-Konfiguration

Überwachung

Einrichtung der Beobachtbarkeit

Dokumentationsindex

Vollständige Dokumentationsübersicht

Tests

# 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

Entwicklungsbefehle

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

Der GitHub Actions-Workflow führt automatisch Folgendes aus:

  1. Führt Tests bei Pull Requests aus

  2. Erstellt und pusht das Docker-Image

  3. Stellt auf dem Haupt-Branch auf Cloud Run bereit

  4. Verwendet Workload Identity Federation (keine Schlüssel)

Überwachung

  • Cloud Monitoring: Vorkonfigurierte Dashboards mit tenant_id-Dimension für mcp.tool.calls.total und mcp.tool.call.duration

  • Cloud Logging: Strukturierte JSON-Protokolle

  • Cloud Trace: Verteiltes Tracing über OpenTelemetry mit tenant.id-Span-Attribut

  • Audit-Protokolle: 7 Jahre Aufbewahrungsfrist in BigQuery

  • Warnungen: E-Mail/Slack-Benachrichtigungen

Compliance

  • GDPR: Datenresidenz und Zugriffsprotokollierung

  • HIPAA: Zugriffskontrollen und Audit-Pfade

  • SOC 2: Identitätsmanagement und Überwachung

  • PCI-DSS: Authentifizierung und Autorisierung

Mitwirken

Beiträge sind willkommen! Siehe CONTRIBUTING.md für Richtlinien.

Lizenz

MIT-Lizenz - siehe LICENSE für Details

Danksagungen


Status: Produktionsbereit Version: 1.0.0 Zuletzt aktualisiert: April 2026

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