This document guides you on how to connect Gemini CLI with MCP Toolbox for Databases
to easily query and analyze data in Google Cloud BigQuery using natural language. Through this example, you can explore the powerful capabilities of handling various Google Cloud databases with natural language.
- Google Cloud account and project
gcloud
CLI installed and configured
MCP Toolbox for Databases
is a suite of tools that allows interaction with Google Cloud databases. Refer to the link below to download and install the correct binary for your operating system (OS) and CPU architecture.
- Installation Guide: Install MCP Toolbox for Databases
[NOTE] It is crucial to select the correct binary for your OS and CPU architecture.
For more detailed instructions on getting started with a local BigQuery integration, you can refer to the quickstart document below.
- Reference: Quickstart (Local with BigQuery)
To allow Gemini CLI to recognize and use the MCP Toolbox, you need to register the server information in the configuration file. Add the following mcpServers
configuration to your Gemini CLI settings file.
{
"mcpServers": {
"bigquery": {
"command": "toolbox",
"args": ["--prebuilt", "bigquery", "--stdio"],
"env": {
"BIGQUERY_PROJECT": "[YOUR_PROJECT_ID]",
"BIGQUERY_LOCATION": "[YOUR_REGION]"
}
}
}
}
[YOUR_PROJECT_ID]
: Replace with your Google Cloud project ID.[YOUR_REGION]
: Replace with the region where your BigQuery dataset is located (e.g.,us-central1
).
The MCP Toolbox requires Google Cloud authentication to access BigQuery.
-
Authenticate with Google Cloud (Application Default Credentials):
-
Set your default Google Cloud project (replace
PROJECT_ID
with your actual project ID): -
Set your default Google Cloud region (replace
us-central1
with your actual region):
Now you can explore your BigQuery data using natural language prompts.
List datasets in the project: "List the available datasets in the project."
Get metadata for the dataset: "Get the metadata for
products
dataset."![]()
List tables in the dataset: "List tables in
products
dataset."
Get metadata for the table: "Get the metadata for
products
table."![]()
![]()
Execute SQL: "Execute a sql (e.g.,
Retrieve 10 rows from products table
)"![]()