
Intro
In the era of Generative AI, the ability to ask questions in natural language and get accurate, actionable insights from your business data is no longer a luxury — it’s a necessity. But the quality of AI-driven answers depends entirely on the consistency and governance of the underlying data. This is where the Looker Semantic Layer — your single source of truth for business metrics — becomes essential.
This tutorial will take you through creating an Agent Development Kit (ADK) agent that is connected to Looker via the Model Context Protocol (MCP) Toolbox and exposing it within Agentspace, to make data accessible and actionable for end users.
Tutorial:
Step 1 — Set up Looker Integration in MCP Toolbox
The MCP Toolbox for Databases is an open-source server that centralizes the hosting and management of toolsets, decoupling agentic applications from direct Looker interaction. Instead of managing tool logic and authentication themselves, agents act as MCP clients, requesting tools from the Toolbox. The MCP Toolbox handles all the underlying complexities, including secure connections to Looker, authentication and query execution.
The MCP Toolbox for Databases natively supports Looker’s pre-built toolset. To access these tools, follow the below steps:
Connect to Cloud Shell, check that you’re already authenticated and that the project is set to your project ID using the following command:
gcloud auth list
Run the following command in Cloud Shell to confirm that the gcloud command knows about your project.
gcloud config list project
Create a folder named mcp-toolbox.
mkdir mcp-toolbox
Go to the mcp-toolbox folder via the command shown below:
cd mcp-toolbox
Install the binary version of the MCP Toolbox for Databases via the script given below. The command given below is for Linux but if you are on Mac or Windows, ensure that you are downloading the correct binary. Check out the releases page for your Operation System and Architecture and download the correct binary.
export OS="linux/amd64" # one of linux/amd64, darwin/arm64, darwin/amd64, or windows/amd64
curl -O https://storage.googleapis.com/genai-toolbox/v0.12.0/$OS/toolbox
chmod +x toolbox
Deploy Toolbox to Cloud Run
export PROJECT_ID="YOUR_GOOGLE_CLOUD_PROJECT_ID"
Enable relevant APIs if needed:
gcloud services enable run.googleapis.com \
cloudbuild.googleapis.com \
artifactregistry.googleapis.com \
iam.googleapis.com \
secretmanager.googleapis.com
Create service account and assign necessary roles:
gcloud iam service-accounts create toolbox-identity
gcloud projects add-iam-policy-binding $PROJECT_ID \
- member serviceAccount:toolbox-identity@$PROJECT_ID.iam.gserviceaccount.com \
- role roles/secretmanager.secretAccessor
gcloud projects add-iam-policy-binding $PROJECT_ID \
- member serviceAccount:toolbox-identity@$PROJECT_ID.iam.gserviceaccount.com \
- role roles/cloudsql.client
Create tools.yaml, similar to the below example (full version available here). For information on getting your client id and secret, see the documentation here.
sources:
looker-source:
kind: looker
base_url: looker_url
client_id: XXX
client_secret: XXX
verify_ssl: true
timeout: 600s
tools:
get_models:
kind: looker-get-models
source: looker-source
description: |
The get_models tool retrieves the list of LookML models in the Looker system.
It takes no parameters.
Load the config into a secret:
gcloud secrets create tools - data-file=tools.yaml
export IMAGE=us-central1-docker.pkg.dev/database-toolbox/toolbox/toolbox:latest
Deploy MCP Toolbox to Cloud Run:
gcloud run deploy toolbox \
- image $IMAGE \
- service-account toolbox-identity \
- region us-central1 \
- set-secrets "/app/tools.yaml=tools:latest" \
- args=" - tools_file=/app/tools.yaml"," - address=0.0.0.0"," - port=8080"
Allow Unauthenticated: N
Step 2: Deploy ADK Agent to Agent Engine
Agent Development Kit (ADK) is a flexible and modular framework for developing and deploying AI agents. While optimized for Gemini and the Google ecosystem, ADK is model-agnostic, deployment-agnostic, and is built for compatibility with other frameworks. ADK was designed to make agent development feel more like software development, to make it easier for developers to create, deploy, and orchestrate agentic architectures that range from simple tasks to complex workflows.
Vertex AI Agent Engine, a part of the Vertex AI Platform, is a set of services that enables developers to deploy, manage, and scale AI agents in production. Agent Engine handles the infrastructure to scale agents in production so you can focus on creating applications.
Open a new terminal tab in Cloud Shell and create a folder named my-agents as follows. Navigate to the my-agents folder too.
mkdir my-agents
cd my-agents
Now, let’s create a virtual Python environment using venv as follows:
python -m venv .venv
Activate the virtual environment as follows:
source .venv/bin/activate
Install the ADK and the MCP Toolbox for Databases packages along with langchain dependency as follows:
pip install google-adk toolbox-core
Creating our first Agent Application
We are now going to use adk to create a scaffolding for our Looker Agent Application via the adk create command with an app name looker_app as given below.
adk create looker_app
Follow the steps and select the following:
Gemini model for choosing a model for the root agent.
Choose Vertex AI for the backend.
Your default Google Project Id and region will be displayed. Select the default itself.
Choose a model for the root agent:
1. gemini-2.5-flash-001
2. Other models (fill later)
Choose model (1, 2): 1
1. Google AI
2. Vertex AI
Choose a backend (1, 2): 2
Enter Google Cloud project ID [your_current_project_id]:
Enter Google Cloud region [us-central1]:
Agent created in /home/romin/looker-app:
– .env
– __init__.py
– agent.py
Observe the folder in which a default template and required files for the Agent have been created.
First up is the .env file. The contents of which are shown below:
GOOGLE_GENAI_USE_VERTEXAI=1
GOOGLE_CLOUD_PROJECT=YOUR_GOOGLE_PROJECT_ID
GOOGLE_CLOUD_LOCATION=YOUR_GOOGLE_PROJECT_REGION
The values indicate that we will be using Gemini via Vertex AI along with the respective values for the Google Cloud Project Id and location.
Then we have the __init__.py file that marks the folder as a module and has a single statement that imports the agent from the agent.py file.
from . import agent
Finally, let’s take a look at the agent.py file. The contents can be edited to similar to the below:
Insert the Cloud Run URL highlighted here: i.e. not the one with the project number in the url.
import os
from google.adk.agents import LlmAgent
from google.adk.planners.built_in_planner import BuiltInPlanner
from google.adk.tools.mcp_tool.mcp_toolset import MCPToolset
from google.adk.tools.mcp_tool.mcp_session_manager import SseConnectionParams, StreamableHTTPConnectionParams
from google.genai.types import ThinkingConfig
from google.auth import compute_engine
import google.auth.transport.requests
import google.oauth2.id_token# Replace this URL with the correct endpoint for your MCP server.
MCP_SERVER_URL = "YOUR_CLOUD_RUN_URL/mcp"
if not MCP_SERVER_URL:
raise ValueError("The MCP_SERVER_URL is not set.")
def get_id_token():
"""Get an ID token to authenticate with the MCP server."""
target_url = MCP_SERVER_URL
audience = target_url.split('/mcp')[0]
auth_req = google.auth.transport.requests.Request()
id_token = google.oauth2.id_token.fetch_id_token(auth_req, audience)
# Get the ID token.
return id_token
root_agent = LlmAgent(
model='gemini-2.5-flash',
name='looker_agent',
description='Agent to answer questions about Looker data.',
instruction=(
'You are a helpful agent who can answer user questions about Looker data the user has access to. Use the tools to answer the question. If you are unsure on what model to use, try defaulting to thelook and if you are also unsure on the explore, try order_items if using thelook model'
),
planner=BuiltInPlanner(
thinking_config=ThinkingConfig(include_thoughts=False, thinking_budget=0)
),
tools=[
MCPToolset(
connection_params=StreamableHTTPConnectionParams(
url=MCP_SERVER_URL,
headers={
"Authorization": f"Bearer {get_id_token()}",
}
),
errlog=None,
# Load all tools from the MCP server at the given URL
tool_filter=None,
)
],
)
Create a cloud storage bucket if you need.
gcloud storage buckets create gs://BUCKET_NAME - location=BUCKET_LOCATION
Ensure you are in the my-agents directory. Update the BUCKET_NAME with the GCS bucket you want to use.
export PROJECT_ID="YOUR_GOOGLE_CLOUD_PROJECT_ID"
adk deploy agent_engine - project $PROJECT_ID - region us-central1 - staging_bucket gs://BUCKET_NAME - display_name "looker-agent1" looker_app
NOTE: Ensure you grant the Cloud Run Invoker role to the default Agent Engine Service Account (ie. service-PROJECT_NUMBER@gcp-sa-aiplatform-re.iam.gserviceaccount.com)
Step 3: Connect to Agentspace
Create an Agentspace app (instructions here).
Run the below command with the GCP Project Number, Reasoning Engine resource name outputted from the ‘deploy agent_engine’ command above and your Agentspace Agent ID from the Agentspace Apps interface.
export PROJECT_NUMBER="YOUR_PROJECT_NUMBER"
export REASONING_ENGINE="projects/XXXXX/locations/us-central1/reasoningEngines/XXXXX"
export DISPLAY_NAME="Looker Agent"
export DESCRIPTION="Looker's MCP Capability."
export TOOL_DESCRIPTION="Looker's Query Engine is used to answer Ecommerce questions."
export AS_APP="YOUR_AGENTSPACE_AGENT_ID"
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-H "X-Goog-User-Project: ${PROJECT_NUMBER}" \
https://discoveryengine.googleapis.com/v1alpha/projects/${PROJECT_NUMBER}/locations/global/collections/default_collection/engines/${AS_APP}/assistants/default_assistant/agents \
-d '{
"displayName": "'"${DISPLAY_NAME}"'",
"description": "'"${DESCRIPTION}"'",
"adk_agent_definition": {
"tool_settings": {
"tool_description": "'"${TOOL_DESCRIPTION}"'"
},
"provisioned_reasoning_engine": {
"reasoning_engine":
"'"${REASONING_ENGINE}"'"
}
}
}'
Looker data is now available within your Agentspace app!!
If you don’t have access to this feature, contact your Google Cloud account team.
Conclusion:
In summary, connecting Looker’s semantic layer to Vertex AI Agent services via the ADK and MCP Toolbox represents a significant leap forward in data accessibility. By exposing your trusted Looker models and Explores within Agentspace, you empower end-users to query complex business data using natural language. This integration closes the gap between data insights and immediate action, ensuring that your organization’s semantic layer is not just a source of passive reports but an active, conversational, and decision-driving asset. The future of data interaction is here, and it’s conversational, accurate and governed.
Source Credit: https://medium.com/google-cloud/connect-looker-to-agentspace-in-minutes-with-mcp-toolbox-and-the-adk-8e37ae096f49?source=rss—-e52cf94d98af—4