bigquery-mcp-server

bigquery-mcp-server

1

BigQuery MCP Server is a solution that facilitates the interaction between Large Language Models and Google BigQuery. It enables models to not only comprehend dataset structures but also execute SQL queries securely and efficiently.

BigQuery MCP Server

A Model Context Protocol (MCP) server for accessing Google BigQuery. This server allows Large Language Models to understand BigQuery dataset structures and execute SQL queries.

Features

  • Authentication and Connection Management: Supports Application Default Credentials or service account key files with configurable project ID and location.
  • Tools:
    • Execute read-only BigQuery SQL queries
    • List all datasets and tables with schemas
    • Get table schema and sample data
    • Perform dry run of queries for validation

Security Features

  • Only read-only queries allowed
  • Default limit on query processing costs
  • Secure handling of authentication credentials

Installation

Local Installation

  1. Clone the repository and install dependencies.
  2. Build the server executable.

Docker Installation

  1. Build and run the Docker image.
  2. Use Docker Compose for alternative setup.

Usage

  • Run the server with helper scripts or manually.

Required Permissions

  • roles/bigquery.user or roles/bigquery.dataViewer and roles/bigquery.jobUser are required.

Error Handling

Provides detailed error messages for authentication, permission issues, and excessive data processing requests.

Code Structure

  • Organized into source directories for different tools and utilities.

License

MIT License