Skip to main content
Glama
qybbs

@qybbs/custom-bigquery-mcp

@qybbs/custom-bigquery-mcp

A standalone Model Context Protocol (MCP) server for Google Cloud BigQuery with enterprise FinOps guardrails, query cost estimation, and strict table allowlisting.

Quick Start via GitHub (Zero Installation)

You can run this MCP server directly without cloning or publishing to npm:

# Set your GCP credentials
export GCP_PROJECT_ID="your-project-id"
export ALLOWLIST_TABLES="project.dataset.table1,dataset.table2"

# Run directly via GitHub using npx
npx -y github:qybbs/custom-bigquery-mcp

Integration with saas-to-mcp-gateway

Add to your gateway-mcp-config.json:

"bigquery": {
  "type": "stdio",
  "command": "npx",
  "args": ["-y", "github:qybbs/custom-bigquery-mcp"],
  "env": {
    "GCP_PROJECT_ID": "${GCP_PROJECT_ID}",
    "GCP_KEY_FILE_PATH": "${GCP_KEY_FILE_PATH}",
    "ALLOWLIST_TABLES": "${ALLOWLIST_TABLES}",
    "MAX_BYTES_BILLED": "${MAX_BYTES_BILLED}",
    "ROW_LIMIT": "${ROW_LIMIT}"
  }
}

Integration with Claude Desktop / Cursor MCP

{
  "mcpServers": {
    "bigquery": {
      "command": "npx",
      "args": ["-y", "github:qybbs/custom-bigquery-mcp"],
      "env": {
        "GCP_PROJECT_ID": "your-project-id",
        "ALLOWLIST_TABLES": "dataset.table1"
      }
    }
  }
}

Related MCP server: BigQuery MCP Server

Features

  • Strict FinOps Guardrails: Enforces query dry-runs, comment stripping, SQL AST validation, and blocks mutative keywords (INSERT, UPDATE, DELETE, DROP, ALTER).

  • Table Allowlisting: Restricts queries strictly to tables explicitly listed in ALLOWLIST_TABLES.

  • Dual Authentication: Supports Google Cloud Application Default Credentials (ADC) or Service Account Key file.

  • Cross-Project Access: Automatically configures userProject so queries and metadata extraction across different GCP projects (e.g. shared VPC datasets) are billed to your designated execution project.

  • Cost Protection: Hard query caps (MAX_BYTES_BILLED) and client-side retrieval limits (ROW_LIMIT).

Tools Exposed

  1. list_allowed_tables: List all BigQuery tables allowed for query execution.

  2. describe_table: Get detailed schema, field descriptions, clustering, and partitioning info.

  3. estimate_query_cost: Perform dry-run calculation returning scanned bytes and estimated USD cost.

  4. execute_readonly_query: Execute read-only SQL queries against allowed tables.

  5. search_allowed_tables: Search allowed tables and schemas by keyword.

Environment Configuration

Configure via .env or pass via MCP driver env:

GCP_PROJECT_ID=your-billing-project-id
# GCP_KEY_FILE_PATH=./google-service-account.json (leave commented to use ADC)
ALLOWLIST_TABLES=project.dataset.table1,dataset.table2
MAX_BYTES_BILLED=10737418240
ROW_LIMIT=1000

Local Development & Testing

# Install dependencies
npm install

# Build
npm run build

# Run unit tests
npm test

# Dry-run pack
npm run pack:dry

# Start stdio server locally
npm start

License

MIT License

Available Tools

5 tools
describe_tableB

Get detailed schema, column descriptions, and partitioning information for an allowed BigQuery table.

ParametersJSON Schema
NameRequiredDescriptionDefault
tableIdYesBigQuery table ID
datasetIdYesBigQuery dataset ID

TDQS

B3.4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the burden, and it does disclose the returned content (schema, column descriptions, partitioning) and that the table must be an 'allowed' one, implying access control. However, it doesn't state that the operation is read-only, what happens for a missing or forbidden table, or any limits. Partial disclosure without annotations warrants a 3.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single front-loaded sentence that names the action, the returned artifacts, and the resource scope with no filler. Every clause earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple two-parameter read tool with no output schema and no annotations, the description covers the purpose and the shape of the returned data well. It could go further on error/permission behavior, but nothing essential for correct invocation is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with both required parameters (datasetId, tableId) fully documented in the schema. The description adds no additional meaning about parameter format or constraints, so the baseline of 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (Get) and resource (schema, column descriptions, partitioning information for a BigQuery table), which is clearly distinct from the list/search/execute/estimate siblings. It doesn't explicitly name a sibling to contrast with, so it lands at 4 rather than 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives no when-to-use guidance, no indication of when to prefer this over list_allowed_tables or search_allowed_tables, and no prerequisites. The only contextual hint is the word 'allowed', which implies an access constraint but doesn't tell the agent when to reach for this tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

estimate_query_costA

Estimate bytes scanned and projected cost in USD for a read-only SQL query without executing it.

ParametersJSON Schema
NameRequiredDescriptionDefault
sqlYesRead-only SQL query to dry-run

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full disclosure burden. It does convey the most important trait — the query is not executed and only estimated bytes/cost are returned — but says nothing about permissions required, behavior on non-read-only or malformed SQL, or whether estimates are exact or approximate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

One front-loaded sentence that names the output (bytes scanned, USD cost) and the safety constraint (no execution) with zero filler. Nothing redundant or vague.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a one-parameter, no-output-schema tool, the description covers purpose, output content, and the non-execution guarantee. Only minor gaps remain: no error/limitation behavior and no explicit routing to execute_readonly_query, but nothing essential to invoking it is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% for the single 'sql' parameter, so the schema already documents the argument and its read-only dry-run semantics. The description adds no syntax, dialect, or format detail beyond what the schema provides, so the baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (estimate), the resource (bytes scanned and projected USD cost for a SQL query), and the key scope qualifier (read-only, without executing). This clearly separates it from sibling execute_readonly_query and from the listing/describe siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The phrase 'without executing it' implies the natural use case: dry-run before running execute_readonly_query. It gives clear context for when the tool applies but stops short of an explicit 'use this before executing' rule or any stated exclusions (e.g., only for supported query types).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

execute_readonly_queryB

Execute a read-only BigQuery SQL query against allowed tables.

ParametersJSON Schema
NameRequiredDescriptionDefault
sqlYesRead-only SELECT query

TDQS

B3.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It does disclose two meaningful behavioral facts: execution is read-only and queries are restricted to allowed tables. It says nothing about cost, row/result limits, timeouts, or how non-allowed tables are rejected.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single front-loaded sentence with no filler; the read-only and allowed-table constraints appear immediately. Nothing is padded or redundant.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema and no annotations, so the description is the sole source of behavior. It covers the safety-relevant constraints but omits result handling, cost implications, and error behavior for disallowed queries, leaving gaps for a query-execution tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Only one parameter, and schema coverage is 100%, so the schema already documents the sql field. The description adds marginal value by tying the parameter to the read-only/allowed-table constraint, but gives no syntax or dialect details. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (Execute) plus resource (read-only BigQuery SQL query) and a scope constraint (allowed tables). It is clear what the tool does, though it never names or contrasts itself with the sibling tools such as estimate_query_cost or describe_table.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No when-to-use guidance is given. With siblings like estimate_query_cost and describe_table present, the agent gets no hint about sequencing (e.g., estimate cost first, describe table to learn schema) or about when this tool is inappropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_allowed_tablesB

List all BigQuery tables allowed for query execution.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full disclosure burden. It states the resource but omits behavioral traits: whether results are paginated or capped, whether this requires BigQuery auth, and what the listing actually returns (names only vs. metadata). For a no-annotation tool this is a substantial gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

One front-loaded sentence with the resource and scope stated immediately and zero wasted words. Nothing could be trimmed without losing meaning.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple (no params, no output schema, no annotations), and the description covers what is listed and the permission scope. However, with no output schema it should indicate the shape of the return (e.g., table identifiers) and any result-size caveat, which it does not.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool takes zero parameters, which per the rubric sets a baseline of 4; there are no parameter semantics to add beyond what the empty schema already conveys.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (List) and resource (BigQuery tables) with a clear scope qualifier ('allowed for query execution'). It is distinguishable from describe_table and execute_readonly_query, but it does not explicitly contrast with the sibling search_allowed_tables, so differentiation is inferential rather than stated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies this is the enumeration tool for discovering permitted tables, but it never says when to use it versus search_allowed_tables (search vs. list-all is left to inference) and gives no exclusions or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_allowed_tablesA

Search allowed tables and their schemas by a keyword (e.g., 'transaction', 'customer'). Returns table description, partitioning columns, clustering columns, and field schemas in one call.

ParametersJSON Schema
NameRequiredDescriptionDefault
keywordYesThe search keyword to filter table names and datasets

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full behavioral burden. It does disclose the return payload (table description, partitioning columns, clustering columns, field schemas), which is useful since no output schema exists, but it says nothing about read-only semantics, result limits, pagination, or match scope (names vs. field names).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two tight sentences: the action and its scope are front-loaded, and the return contents are summarized in a single clause with no filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given one parameter, no annotations, and no output schema, the description covers everything essential: what is searched, what the keyword does, and what is returned. Minor gaps remain around result limits and whether matching spans field names, but nothing blocks correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, and the single 'keyword' parameter is already documented there, so the baseline is 3. The description adds only example keywords, which gives a marginal sense of expected input but no format, matching rules, or case-sensitivity detail.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Search allowed tables and their schemas by a keyword') and names what comes back. It implies but never explicitly names how it differs from the sibling list_allowed_tables, so an agent must infer the keyword-vs-enumerate distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The keyword examples ('transaction', 'customer') imply the intended usage context, but there is no explicit when-to-use/when-not guidance and no routing to list_allowed_tables or describe_table for narrowing or expanding results.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 5 tool updatesv1.0.0
    • First observeddescribe_table
    • First observedestimate_query_cost
    • First observedexecute_readonly_query
    • First observedlist_allowed_tables
    • First observedsearch_allowed_tables

TDQS

A3.8/5.0

Scored across 5 tools

Disambiguation4/5

The five tools have largely distinct roles: listing, searching, describing, estimating, and executing. However, search_allowed_tables returns schema and partitioning details that overlap with describe_table, and list_allowed_tables overlaps with search_allowed_tables for table discovery. Descriptions clarify the differences, so confusion is limited.

Naming Consistency5/5

All tool names follow a consistent snake_case verb_noun pattern (list_allowed_tables, describe_table, estimate_query_cost, execute_readonly_query, search_allowed_tables). Minor modifiers like 'allowed' and 'readonly' are used consistently and do not break the pattern.

Tool Count5/5

Five tools are well-scoped for a read-only BigQuery querying server, covering discovery, schema inspection, cost estimation, and execution. No tool feels redundant or missing, making the count appropriate.

Completeness5/5

The surface covers the full read-only query lifecycle: discovering allowed tables (list/search), understanding their schemas (describe), estimating cost, and executing queries. No obvious gaps exist for the stated purpose, though bulk schema retrieval could be slightly more efficient.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables LLMs to explore BigQuery datasets and tables, run safe read-only queries, and optionally perform vector search using BigQuery embeddings.
    152 PyPI
    10
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables read-only interaction with Google BigQuery, including SQL queries, dataset/table listing, schema retrieval, table preview, and metadata access via service account authentication.
    -
  • 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
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables secure read-only interaction with Google BigQuery through natural language, including listing datasets, listing tables, retrieving metadata, and executing queries with cost controls.
    -