BigQuery MCP Server

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Connects to Google Cloud's BigQuery service to access and query datasets, tables, and materialized views

BigQuery MCP 服务器

这是什么?🤔

这是一个服务器,可以让你的法学硕士(比如 Claude)直接与你的 BigQuery 数据对话!你可以把它想象成一个友好的翻译器,位于你的 AI 助手和数据库之间,确保它们能够安全高效地进行对话。

快速示例

You: "What were our top 10 customers last month?" Claude: *queries your BigQuery database and gives you the answer in plain English*

不再需要手动编写 SQL 查询 - 只需与您的数据自然聊天!

它是如何工作的?🛠️

该服务器使用模型上下文协议 (MCP),它就像一个用于 AI 与数据库通信的通用转换器。虽然 MCP 的设计目标是兼容任何 AI 模型,但它目前在 Claude Desktop 中以开发者预览版的形式提供。

您需要做的就是:

  1. 设置身份验证(见下文)
  2. 将您的项目详细信息添加到 Claude Desktop 的配置文件中
  3. 开始自然地与您的 BigQuery 数据聊天!

它能做什么?📊

  • 只需用简单的英语提问即可运行 SQL 查询
  • 访问数据集中的表和物化视图
  • 探索具有清晰资源类型标签(表与视图)的数据集模式
  • 在安全范围内分析数据(默认查询限制为 1GB)
  • 保证数据安全(只读访问)

快速入门🚀

先决条件

  • Node.js 14 或更高版本
  • 启用 BigQuery 的 Google Cloud 项目
  • 安装了 Google Cloud CLI 或服务帐户密钥文件
  • Claude Desktop(目前唯一支持的LLM界面)

选项 1:通过 Smithery 快速安装(推荐)

要通过Smithery自动为 Claude Desktop 安装 BigQuery MCP Server,请在终端中运行以下命令:

npx @smithery/cli install @ergut/mcp-bigquery-server --client claude

安装程序将提示您:

  • 您的 Google Cloud 项目 ID
  • BigQuery 位置(默认为 us-central1)

配置完成后,Smithery 将自动更新您的 Claude Desktop 配置并重新启动应用程序。

选项 2:手动设置

如果您更喜欢手动配置或需要更多控制:

  1. 使用 Google Cloud 进行身份验证(选择一种方法):
    • 使用 Google Cloud CLI(非常适合开发):
      gcloud auth application-default login
    • 使用服务帐户(建议用于生产):
      # Save your service account key file and use --key-file parameter # Remember to keep your service account key file secure and never commit it to version control
  2. 添加到您的 Claude Desktop 配置将其添加到您的claude_desktop_config.json
    • 基本配置:
      { "mcpServers": { "bigquery": { "command": "npx", "args": [ "-y", "@ergut/mcp-bigquery-server", "--project-id", "your-project-id", "--location", "us-central1" ] } } }
    • 使用服务帐户:
      { "mcpServers": { "bigquery": { "command": "npx", "args": [ "-y", "@ergut/mcp-bigquery-server", "--project-id", "your-project-id", "--location", "us-central1", "--key-file", "/path/to/service-account-key.json" ] } } }
  3. **开始聊天!**打开 Claude Desktop 并开始询问有关您的数据的问题。

命令行参数

服务器接受以下参数:

  • --project-id :(必填)您的 Google Cloud 项目 ID
  • --location :(可选)BigQuery 位置,默认为“us-central1”
  • --key-file :(可选)服务帐户密钥 JSON 文件的路径

使用服务帐户的示例:

npx @ergut/mcp-bigquery-server --project-id your-project-id --location europe-west1 --key-file /path/to/key.json

所需权限

您需要以下其中之一:

  • roles/bigquery.user (推荐)
  • 或两者:
    • roles/bigquery.dataViewer
    • roles/bigquery.jobUser

开发人员设置(可选)🔧

想要自定义或贡献代码?以下是如何在本地进行设置:

# Clone and install git clone https://github.com/ergut/mcp-bigquery-server cd mcp-bigquery-server npm install # Build npm run build

然后更新您的 Claude Desktop 配置以指向您的本地构建:

{ "mcpServers": { "bigquery": { "command": "node", "args": [ "/path/to/your/clone/mcp-bigquery-server/dist/index.js", "--project-id", "your-project-id", "--location", "us-central1", "--key-file", "/path/to/service-account-key.json" ] } } }

当前限制⚠️

  • MCP 支持目前仅在 Claude Desktop(开发者预览版)中提供
  • 连接仅限于在同一台机器上运行的本地 MCP 服务器
  • 查询是只读的,处理限制为 1GB
  • 虽然表和视图都受支持,但某些复杂的视图类型可能会有限制

支持与资源💬

许可证📝

MIT 许可证 - 有关详细信息,请参阅LICENSE文件。

作者✍️

萨利赫·埃尔古特

赞助

该项目由以下机构赞助:

版本历史📋

请参阅CHANGELOG.md了解更新和版本历史记录。

-
security - not tested
A
license - permissive license
-
quality - not tested

Tools

这是一个服务器,可以让你的法学硕士(比如 Claude)直接与你的 BigQuery 数据对话!你可以把它想象成一个友好的翻译器,位于你的 AI 助手和数据库之间,确保它们能够安全高效地进行对话。

  1. What is this? 🤔
    1. Quick Example
  2. How Does It Work? 🛠️
    1. What Can It Do? 📊
  3. Quick Start 🚀
    1. Prerequisites
    2. Option 1: Quick Install via Smithery (Recommended)
    3. Option 2: Manual Setup
    4. Command Line Arguments
    5. Permissions Needed
  4. Developer Setup (Optional) 🔧
    1. Current Limitations ⚠️
      1. Support & Resources 💬
        1. License 📝
          1. Author ✍️
            1. Sponsorship
              1. Version History 📋
                ID: dflwpk8hgv