npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

bigquery-mcp-server

v0.1.16

Published

MCP server for BigQuery that allows AI assistants to query and understand BigQuery datasets

Downloads

287

Readme

BigQuery MCP Server

A Model Context Protocol (MCP) server for BigQuery that allows AI assistants to query and understand BigQuery datasets.

Overview

This MCP server provides a simple interface for AI code editors like Claude Desktop to interact with BigQuery datasets. It connects to the BigQuery toolbox service and provides the following capabilities:

  • List available BigQuery datasets
  • Retrieve schema information for tables in a dataset
  • Execute SQL queries against BigQuery datasets

Installation

Using npx (Recommended)

The simplest way to use the BigQuery MCP server is with npx:

npx bigquery-mcp-server start

Usage

To start the MCP server:

npx bigquery-mcp-server start

Options:

  • -p, --port <port>: Port to run the server on (default: 3000)
  • -u, --url <url>: BigQuery toolbox URL
  • -l, --log-level <level>: Log level (debug, info, warn, error) (default: info)
  • -d, --detached: Run in detached mode (background)

To configure the server:

npx bigquery-mcp-server config --url http://your-toolbox-url

Additional commands:

# Show current configuration
npx bigquery-mcp-server config --show

# Display server information
npx bigquery-mcp-server info

# Test connection to BigQuery toolbox service
npx bigquery-mcp-server test-connection

Configuration

You can configure the server using environment variables or command-line options:

npx bigquery-mcp-server start --port 3000 --url https://your-bigquery-toolbox-url

Or create a .env file in your working directory:

PORT=3000
BIGQUERY_TOOLBOX_URL=https://your-bigquery-toolbox-url
LOG_LEVEL=info

Integration with Claude Desktop

Add the following to your Claude Desktop configuration:

{
  "mcpServers": {
    "Nuuly BigQuery": {
      "command": "npx",
      "args": ["@nuuly/bigquery-mcp-server", "start"],
      "env": {}
    }
  }
}

API Documentation

The BigQuery MCP server provides the following tools that can be invoked by AI assistants:

list_databases

Lists all available BigQuery datasets.

Parameters:

  • None

Returns:

{
  "databases": [
    {
      "name": "dataset_name",
      "description": "Dataset description",
      "created": "2023-01-01T00:00:00.000Z",
      "updated": "2023-01-01T00:00:00.000Z"
    },
    ...
  ]
}

Example:

{
  "name": "list_databases",
  "arguments": {}
}

get_schema

Retrieves schema information for tables in a specified dataset.

Parameters:

  • database (string, required): The name of the BigQuery dataset

Returns:

{
  "tables": [
    {
      "name": "table_name",
      "description": "Table description",
      "columns": [
        {
          "name": "column_name",
          "type": "STRING",
          "description": "Column description",
          "mode": "NULLABLE"
        },
        ...
      ],
      "primaryKeys": ["column_name"],
      "foreignKeys": [
        {
          "columns": ["column_name"],
          "referencedTable": "referenced_table",
          "referencedColumns": ["referenced_column"]
        },
        ...
      ]
    },
    ...
  ]
}

Example:

{
  "name": "get_schema",
  "arguments": {
    "database": "my_dataset"
  }
}

run_query

Executes a SQL query against a BigQuery dataset.

Parameters:

  • database (string, required): The name of the BigQuery dataset
  • sql (string, required): The SQL query to execute

Returns:

{
  "columns": ["column1", "column2", ...],
  "rows": [
    ["value1", "value2", ...],
    ...
  ],
  "totalRows": 100,
  "executionTime": "1.23 seconds"
}

Example:

{
  "name": "run_query",
  "arguments": {
    "database": "my_dataset",
    "sql": "SELECT * FROM my_table LIMIT 10"
  }
}

Note: For security reasons, only SELECT, SHOW, DESCRIBE, and EXPLAIN statements are allowed.

Examples

The package includes several examples to help you get started:

Example Queries

Check out the examples/queries/basic-queries.md file for a collection of common BigQuery SQL queries, including:

  • Simple SELECT queries with filtering
  • Aggregation queries with GROUP BY
  • JOIN operations between tables
  • Date and time functions
  • Window functions
  • Subqueries
  • EXPLAIN statements

Node.js Client

A Node.js example client is provided in examples/node-client.js that demonstrates how to interact with the MCP server programmatically:

# List all databases
node examples/node-client.js list_databases {}

# Get schema for a database
node examples/node-client.js get_schema '{"database": "my_dataset"}'

# Run a query
node examples/node-client.js run_query '{"database": "my_dataset", "sql": "SELECT * FROM my_table LIMIT 10"}'

Python Client

A Python example client is provided in examples/python-client.py:

# List all databases
python examples/python-client.py list

# Get schema for a database
python examples/python-client.py schema my_dataset

# Run a query
python examples/python-client.py query my_dataset "SELECT * FROM my_table LIMIT 10"

Troubleshooting

Connection Issues

Problem: Cannot connect to the BigQuery toolbox service

Solution:

  1. Verify that the BigQuery toolbox service is running and accessible
  2. Check that the URL is correct in your configuration
  3. Run the test-connection command to diagnose issues:
    npx bigquery-mcp-server test-connection

SQL Query Errors

Problem: SQL queries are failing or returning errors

Solution:

  1. Verify that your SQL syntax is correct
  2. Ensure you're only using allowed SQL commands (SELECT, SHOW, DESCRIBE, EXPLAIN)
  3. Check that the dataset and table names are correct
  4. Try running a simple query first to verify connectivity:
    SELECT 1 as test

MCP Server Not Starting

Problem: The MCP server fails to start

Solution:

  1. Check if another process is using the same port
  2. Verify that you have the necessary permissions to bind to the port
  3. Try specifying a different port:
    npx bigquery-mcp-server start --port 3001
  4. Increase the log level for more detailed error information:
    npx bigquery-mcp-server start --log-level debug

Claude Desktop Integration Issues

Problem: Claude Desktop cannot connect to the MCP server

Solution:

  1. Verify that the MCP server is running
  2. Check that the Claude Desktop configuration is correct
  3. Ensure that the port specified in Claude Desktop matches the one the server is running on
  4. Restart Claude Desktop after making configuration changes

Documentation

Detailed documentation is available in the docs directory:

CI/CD Pipeline

This project uses GitHub Actions for continuous integration and delivery:

  • CI Workflow: Automatically runs tests, linting, and builds on pull requests and pushes to main
  • Release Workflow: Automates version bumping, changelog updates, and npm publishing

To create a new release:

  1. Go to the GitHub Actions tab
  2. Select the "Release Management" workflow
  3. Click "Run workflow"
  4. Select the version type (patch, minor, or major)
  5. Click "Run workflow"

This will create a new release, update the version in package.json, push tags, and publish to npm.

Development

Setup

# Clone the repository
git clone https://github.com/nuuly/bigquery-mcp-server.git
cd bigquery-mcp-server

# Install dependencies
npm install

# Build the project
npm run build

# Start the server in development mode
npm run dev

Available Scripts

  • npm start: Start the server from the compiled JavaScript
  • npm run dev: Start the server in development mode using ts-node
  • npm run build: Build the TypeScript code
  • npm test: Run tests
  • npm run lint: Run ESLint

License

MIT