Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Connecter votre IDE à BigQuery à l'aide de MCP Toolbox
Ce guide vous explique comment utiliser la MCP Toolbox for Databases pour connecter votre instance BigQuery à différents environnements de développement intégrés (IDE) et outils pour les développeurs. Il utilise le protocole de contexte de modèle (MCP), un protocole ouvert permettant de connecter des grands modèles de langage (LLM) à des sources de données telles que BigQuery. Vous pouvez ainsi exécuter des requêtes SQL et interagir avec votre projet directement depuis vos outils existants.
Ce guide explique comment connecter les IDE suivants :
Configurez les rôles et autorisations requis pour effectuer cette tâche. Pour vous connecter à l'instance, vous devez disposer du rôle Utilisateur BigQuery (roles/bigquery.user), du rôle Lecteur de données BigQuery (roles/bigquery.dataViewer) ou d'autorisations IAM équivalentes.
Téléchargez la dernière version de MCP Toolbox en tant que fichier binaire. Sélectionnez le fichier binaire correspondant à votre système d'exploitation et à l'architecture de votre processeur. Vous devez utiliser la version V0.7.0 ou ultérieure de MCP Toolbox :
Remarque : La variable d'environnement BIGQUERY_PROJECT spécifie l'ID de projet Google Cloud par défaut que la boîte à outils MCP doit utiliser. Toutes les opérations BigQuery, comme l'exécution de requêtes, sont effectuées dans ce projet.
Utiliser les outils
Votre outil d'IA est désormais connecté à BigQuery à l'aide de MCP. Essayez de demander à votre assistant IA de lister des tables, d'en créer une ou de définir et d'exécuter d'autres instructions SQL.
Les outils suivants sont à la disposition du LLM :
ask_data_insights : effectuer une analyse des données, obtenir des insights ou répondre à des questions complexes sur le contenu des tables BigQuery.
execute_sql : exécuter une instruction SQL
forecast : données de séries temporelles de prévision.
get_dataset_info : obtenir les métadonnées de l'ensemble de données
get_table_info : obtenir les métadonnées de la table
list_dataset_ids : lister les ensembles de données
list_table_ids : lister les tables
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 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."]]