Skip to content

debitCredit/bq-mcp-py

Repository files navigation

BigQuery MCP Server

CI Code style: ruff Type checker: mypy

A minimal MCP (Model Context Protocol) server that provides passthrough access to Google Cloud BigQuery commands. This server uses your existing gcloud CLI authentication and provides tools for querying BigQuery table schemas, routine information, and executing BigQuery queries with safety checks.

Features

  • Minimal setup: Uses your existing gcloud CLI authentication
  • Schema inspection: Get BigQuery table and view schemas in JSON format
  • Routine information: Get BigQuery routine (TVF, stored procedure, function) details
  • Query execution: Execute BigQuery queries with safety checks requiring user approval for dangerous operations (DELETE, DROP, TRUNCATE, etc.)

Prerequisites

  • Google Cloud SDK (gcloud and bq commands) installed and configured
  • Python 3.13+
  • uv package manager

Installation for coding agents

Claude Code

For setup instructions, see: https://docs.anthropic.com/en/docs/claude-code/mcp

VS Code

For setup instructions, see: https://code.visualstudio.com/docs/copilot/chat/mcp-servers

Use this server configuration:

"bq-mcp": {
  "command": "uv",
  "args": [
    "--directory",
    "/path/to/bq-mcp-py",
    "run",
    "bq-mcp.py"
  ]
}

Usage

Once installed, the server provides the following tools:

  • get_bq_schema(table_id): Get the schema for a BigQuery table or view in project.dataset.table format
  • get_bq_routine(routine_id): Get information about a BigQuery routine (TVF, stored procedure, function) in project.dataset.routine_name format
  • execute_bq_query(query, project_id): Execute BigQuery queries with safety checks and user approval prompts for dangerous operations

Authentication

This server uses your existing gcloud CLI authentication. Make sure you're authenticated with Google Cloud:

gcloud auth login
gcloud config set project YOUR_PROJECT_ID

About

Minimal MCP server for BigQuery schema inspection using gcloud CLI authentication

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages