Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
IDE mit BigQuery verbinden – MCP Toolbox
In diesem Leitfaden erfahren Sie, wie Sie die MCP Toolbox for Databases verwenden, um Ihre BigQuery-Instanz mit verschiedenen integrierten Entwicklungsumgebungen (IDEs) und Entwicklertools zu verbinden. Dabei wird das Model Context Protocol (MCP) verwendet, ein offenes Protokoll zum Verbinden von Large Language Models (LLMs) mit Datenquellen wie BigQuery. So können Sie SQL-Abfragen ausführen und direkt über Ihre vorhandenen Tools mit Ihrem Projekt interagieren.
In diesem Leitfaden wird der Verbindungsprozess für die folgenden IDEs beschrieben:
Konfigurieren Sie die erforderlichen Rollen und Berechtigungen, um diese Aufgabe auszuführen. Sie benötigen die Rolle BigQuery-Nutzer (roles/bigquery.user), die Rolle „BigQuery-Datenbetrachter“ (roles/bigquery.dataViewer) oder entsprechende IAM-Berechtigungen, um eine Verbindung zur Instanz herzustellen.
Laden Sie die aktuelle Version der MCP Toolbox als Binärdatei herunter. Wählen Sie die Binärdatei aus, die Ihrem Betriebssystem und Ihrer CPU-Architektur entspricht. Sie müssen die MCP Toolbox-Version V0.7.0 oder höher verwenden:
Hinweis:Mit der Umgebungsvariable BIGQUERY_PROJECT wird die Standard- Google Cloud Projekt-ID für die MCP Toolbox angegeben. Alle BigQuery-Vorgänge, z. B. das Ausführen von Abfragen, werden in diesem Projekt ausgeführt.
Tools verwenden
Ihr KI-Tool ist jetzt über MCP mit BigQuery verbunden. Bitten Sie Ihren KI-Assistenten, Tabellen aufzulisten, eine Tabelle zu erstellen oder andere SQL-Anweisungen zu definieren und auszuführen.
Dem LLM stehen die folgenden Tools zur Verfügung:
ask_data_insights: Daten analysieren, Statistiken abrufen oder komplexe Fragen zum Inhalt von BigQuery-Tabellen beantworten.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[],[],null,["# Connect your IDE to BigQuery using MCP Toolbox\n==============================================\n\nThis guide shows you how to use the [MCP Toolbox for Databases](https://github.com/googleapis/genai-toolbox) to connect your BigQuery instance to a variety of Integrated Development Environments (IDEs) and developer tools. It uses the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction), an open protocol for connecting large language models (LLMs) to data sources like BigQuery, allowing you to run SQL queries and interact with your project directly from your existing tools.\n\nThis guide demonstrates the connection process for the following IDEs:\n\n- [Cursor](#configure-your-mcp-client)\n- [Windsurf](#configure-your-mcp-client) (formerly Codeium)\n- [Visual Studio Code](#configure-your-mcp-client) (Copilot)\n- [Cline](#configure-your-mcp-client) (VS Code extension)\n- [Claude desktop](#configure-your-mcp-client)\n- [Claude code](#configure-your-mcp-client)\n\nBefore you begin\n----------------\n\n1. In the Google Cloud console, on the [project selector page](https://console.cloud.google.com/projectselector2/home/dashboard), select or create a Google Cloud project.\n\n2. [Make sure that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n3. [Enable the BigQuery API in the Google Cloud project](https://console.cloud.google.com/flows/enableapi?apiid=bigquery.googleapis.com&redirect=https://console.cloud.google.com).\n\n4. Configure the required roles and permissions to complete this task. You will need the [BigQuery User](/bigquery/docs/access-control) role (`roles/bigquery.user`), the BigQuery Data Viewer role (`roles/bigquery.dataViewer`), or equivalent IAM permissions to connect to the instance.\n\n5. Configure [Application Default Credentials (ADC)](/docs/authentication/set-up-adc-local-dev-environment) for your environment.\n\nInstall the MCP Toolbox\n-----------------------\n\n1. Download the latest version of the MCP Toolbox as a binary. Select the [binary](https://github.com/googleapis/genai-toolbox/releases) corresponding to your operating system (OS) and CPU architecture. You must use MCP Toolbox version V0.7.0 or later:\n\n ### linux/amd64\n\n ```\n curl -O https://storage.googleapis.com/genai-toolbox/VERSION/linux/amd64/toolbox\n ```\n\n Replace \u003cvar translate=\"no\"\u003eVERSION\u003c/var\u003e with the MCP Toolbox\n version---for example `v0.7.0`.\n\n ### macOS darwin/arm64\n\n ```\n curl -O https://storage.googleapis.com/genai-toolbox/VERSION/darwin/arm64/toolbox\n ```\n\n Replace \u003cvar translate=\"no\"\u003eVERSION\u003c/var\u003e with the MCP Toolbox\n version---for example `v0.7.0`.\n\n ### macOS darwin/amd64\n\n ```\n curl -O https://storage.googleapis.com/genai-toolbox/VERSION/darwin/amd64/toolbox\n ```\n\n Replace \u003cvar translate=\"no\"\u003eVERSION\u003c/var\u003e with the MCP Toolbox\n version---for example `v0.7.0`.\n\n ### windows/amd64\n\n ```\n curl -O https://storage.googleapis.com/genai-toolbox/VERSION/windows/amd64/toolbox\n ```\n\n Replace \u003cvar translate=\"no\"\u003eVERSION\u003c/var\u003e with the MCP Toolbox\n version---for example `v0.7.0`.\n2. Make the binary executable:\n\n chmod +x toolbox\n\n3. Verify the installation:\n\n ./toolbox --version\n\nConfigure the MCP client\n------------------------\n\n### Claude code\n\n\u003cbr /\u003e\n\n1. Install [Claude Code](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/overview). \n2. Create `.mcp.json` file in your project root, if it doesn't exist. \n3. Add the configuration, replace the environment variables with your values, and save: \n\n```\n{\n \"mcpServers\": {\n \"bigquery\": {\n \"command\": \"./PATH/TO/toolbox\",\n \"args\": [\"--prebuilt\",\"bigquery\",\"--stdio\"],\n \"env\": {\n \"BIGQUERY_PROJECT\": \"PROJECT_ID\"\n }\n }\n }\n}\n```\n\n### Claude desktop\n\n\u003cbr /\u003e\n\n1. Open [Claude Desktop](https://claude.ai/download) and navigate to **Settings** . \n2. In the **Developer** tab, click **Edit Config** to open the configuration file. \n3. Add the configuration, replace the environment variables with your values, and save: \n\n```\n{\n \"mcpServers\": {\n \"bigquery\": {\n \"command\": \"./PATH/TO/toolbox\",\n \"args\": [\"--prebuilt\",\"bigquery\",\"--stdio\"],\n \"env\": {\n \"BIGQUERY_PROJECT\": \"PROJECT_ID\"\n }\n }\n }\n}\n```\n\n4. Restart Claude Desktop. \n5. The new chat screen displays a hammer (MCP) icon with the new MCP server. \n\n\u003cbr /\u003e\n\n### Cline\n\n\u003cbr /\u003e\n\n1. Open [Cline](https://github.com/cline/cline) extension in VS Code and tap **MCP Servers** icon. \n2. Tap Configure MCP Servers to open the configuration file. \n3. Add the following configuration, replace the environment variables with your values, and save: \n\n```\n{\n \"mcpServers\": {\n \"bigquery\": {\n \"command\": \"./PATH/TO/toolbox\",\n \"args\": [\"--prebuilt\",\"bigquery\",\"--stdio\"],\n \"env\": {\n \"BIGQUERY_PROJECT\": \"PROJECT_ID\"\n }\n }\n }\n}\n```\n\nA green active status appears after the server connects successfully. \n\n### Cursor\n\n\u003cbr /\u003e\n\n1. Create the `.cursor` directory in your project root if it doesn't exist. \n2. Create the `.cursor/mcp.json` file if it doesn't exist and open it. \n3. Add the following configuration, replace the environment variables with your values, and save: \n\n```\n{\n \"mcpServers\": {\n \"bigquery\": {\n \"command\": \"./PATH/TO/toolbox\",\n \"args\": [\"--prebuilt\",\"bigquery\",\"--stdio\"],\n \"env\": {\n \"BIGQUERY_PROJECT\": \"PROJECT_ID\"\n }\n }\n }\n}\n```\n\n4. Open [Cursor](https://www.cursor.com/) and navigate to **Settings \\\u003e Cursor Settings \\\u003e MCP** . A green active status appears when the server connects. \n\n### Visual Studio Code (Copilot)\n\n\u003cbr /\u003e\n\n1. Open [VS Code](https://code.visualstudio.com/docs/copilot/overview) and create `.vscode` directory in your project root if it does not exist. \n2. Create the `.vscode/mcp.json` file if it doesn't exist, and open it. \n3. Add the following configuration, replace the environment variables with your values, and save: \n\n```\n{\n \"servers\": {\n \"bigquery\": {\n \"command\": \"./PATH/TO/toolbox\",\n \"args\": [\"--prebuilt\",\"bigquery\",\"--stdio\"],\n \"env\": {\n \"BIGQUERY_PROJECT\": \"PROJECT_ID\"\n }\n }\n }\n}\n```\n\n### Windsurf\n\n\u003cbr /\u003e\n\n1. Open [Windsurf](https://docs.codeium.com/windsurf) and navigate to Cascade assistant. \n2. Click the MCP icon, then click **Configure** to open the configuration file. \n3. Add the following configuration, replace the environment variables with your values, and save: \n\n```\n{\n \"mcpServers\": {\n \"bigquery\": {\n \"command\": \"./PATH/TO/toolbox\",\n \"args\": [\"--prebuilt\",\"bigquery\",\"--stdio\"],\n \"env\": {\n \"BIGQUERY_PROJECT\": \"PROJECT_ID\"\n }\n }\n }\n}\n```\n\nUse the tools\n-------------\n\nYour AI tool is now connected to BigQuery using MCP. Try asking your AI assistant to list tables, create a table, or define and execute other SQL statements.\n\nThe following tools are available to the LLM:\n\n- **execute_sql**: execute SQL statement\n- **get_dataset_info**: get dataset metadata\n- **get_table_info**: get table metadata\n- **list_dataset_ids**: list datasets\n- **list_table_ids**: list tables\n\n| **Note:** Prebuilt tools are pre-1.0, so expect some tool changes between versions. LLMs will adapt to the tools available, so this shouldn't affect most users."]]