Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Connetti il tuo IDE a BigQuery utilizzando MCP Toolbox
Questa guida mostra come utilizzare MCP Toolbox for Databases per connettere l'istanza BigQuery a una serie di ambienti di sviluppo integrati (IDE) e strumenti per sviluppatori. Utilizza il Model Context Protocol (MCP), un protocollo aperto per connettere modelli linguistici di grandi dimensioni (LLM) a origini dati come BigQuery, consentendoti di eseguire query SQL e interagire con il tuo progetto direttamente dagli strumenti esistenti.
Questa guida mostra la procedura di connessione per i seguenti IDE:
Configura i ruoli e le autorizzazioni richiesti per completare questa attività. Per connetterti all'istanza, devi disporre del ruolo Utente BigQuery (roles/bigquery.user), del ruolo Visualizzatore dati BigQuery (roles/bigquery.dataViewer) o di autorizzazioni IAM equivalenti.
Scarica l'ultima versione di MCP Toolbox come file binario. Seleziona il file binario corrispondente al tuo sistema operativo e all'architettura della CPU. Devi utilizzare MCP Toolbox versione V0.7.0 o successive:
Nota:la variabile di ambiente BIGQUERY_PROJECT specifica l'ID progetto Google Cloud predefinito da utilizzare per MCP Toolbox. Tutte le operazioni BigQuery, come l'esecuzione di query, vengono eseguite all'interno di questo progetto.
Utilizzare gli strumenti
Il tuo strumento di AI è ora connesso a BigQuery tramite MCP. Prova a chiedere all'assistente AI di elencare le tabelle, creare una tabella o definire ed eseguire altre istruzioni SQL.
Sono disponibili i seguenti strumenti per il LLM:
ask_data_insights: esegui l'analisi dei dati, ottieni approfondimenti o rispondi a domande complesse sui contenuti delle tabelle BigQuery.
execute_sql: esegui l'istruzione SQL
forecast: prevede i dati delle serie temporali.
get_dataset_info: recupera i metadati del set di dati
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 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."]]