Connect your AI assistant to BigQuery using MCP servers
Enable Managed MCP Server:
Follow the guide to enable the managed server and confirm you have the appropriate IAM roles:
https://cloud.google.com/mcp/configure-mcp-ai-application
Create OAuth Client:
Follow the authentication guide to create an OAuth client:
https://cloud.google.com/mcp/authenticate-mcp#create-oauth-client
Configure the OAuth client according to your platform:
https://chatgpt.com/connector_platform_oauth_redirectAdd the BigQuery managed MCP server to your AI platform. Select your platform below:
client_id fieldclient_secret field
client_id fieldclient_secret field
Gemini CLI uses a local settings file for MCP configuration. It uses google_credentials auth provider to send OAuth tokens from your local Google Cloud credentials to MCP servers.
~/.gemini/settings.json (applies to all projects).gemini/settings.json in your project root (overrides user settings){
"mcpServers": {
"bigquery": {
"httpUrl": "https://bigquery.googleapis.com/mcp",
"authProviderType": "google_credentials",
"oauth": {
"scopes": [
"https://www.googleapis.com/auth/bigquery",
"https://www.googleapis.com/auth/cloud-platform"
]
}
}
}
}
gcloud auth application-default login
google_credentials auth provider, Gemini CLI obtains OAuth tokens from your local ADC and sends them to the MCP server.
More info: BigQuery MCP Documentation
Add a CA Agent MCP server using the same process as Step #2, but with a different URL. You have two options:
Generate your CA Agent MCP URL:
Your CA Agent MCP URL:
Follow the same steps as Step #2, using the URL generated above:
Gemini CLI requires a different approach using bearer token headers (unlike the BigQuery server which uses google_credentials):
"dataagents": { "httpUrl": "https://mcp.cademo.dev/{project}/dataagents/mcp", "headers": { "Authorization": "Bearer ${MCP_ACCESS_TOKEN}" } }
MCP_ACCESS_TOKEN=$(gcloud auth print-access-token) gemini
Once configured, you can ask your AI assistant questions about your data, and it will use the CA agent to query BigQuery and provide insights.
How it works:
Example prompts: