Build an AI agent with Google ADK and MCP to interact with Looker

1. Overview

In this codelab, you will build an interactive AI Agent using the Google Agent Development Kit (ADK) and the MCP toolbox for databases to interact with your Looker instance.

Integration stack of a Looker AI agent built with the Google Agent Development\nKit (ADK), connecting through the open-source MCP server to access the\nunderlying Looker API.

What is ADK and MCP?

  • Google ADK (Agent Development Kit): A lightweight framework for creating, testing, and orchestrating multi-tool LLM agents powered by Gemini.
  • Model Context Protocol (MCP): An open standard that allows LLMs to securely connect to external tools, databases, and APIs without custom adapter code.

What you will build

  • A local Python-based agent powered by Gemini 3.8 Flash.
  • A MCP toolbox integration to connect to Looker.
  • A running agent tested through the interactive ADK local web UI.

Prerequisites

  • A Looker instance with admin or developer permissions to generate API credentials.
  • Python 3.10+ installed.
  • Go 1.21+ installed (to build/install the toolbox binary).
  • Google Gemini API key or a Google Cloud project with Vertex AI enabled.

2. Secure Looker API Credentials

To allow the MCP server to authenticate with your Looker instance, you must obtain API 3 credentials.

  1. Log in to your Looker instance.
  2. Go to Admin > Users (or your Account Settings if self-service credential generation is enabled).
  3. Find your user account and select Edit.
  4. In the API 3 Keys section, click New API Key.
  5. Save the generated Client ID and Client Secret.

[WARNING] Keep your Client Secret secure. Never commit your .env file to version control.

3. Set Up Your Development Environment & Install the MCP Toolbox

Create a project directory, set up a Python virtual environment, and install the required MCP toolbox binary using Go.

Create project directory and virtual environment

mkdir looker-mcp-agent && cd looker-mcp-agent
python3 -m venv .venv
source .venv/bin/activate

Install Python dependencies

Install the Google ADK, MCP client SDK, and Python environment manager:

pip install google-adk mcp python-dotenv

Install the MCP Toolbox Binary using Go

The MCP connection relies on the MCP toolbox binary (toolbox). You can install it directly using go install:

# Install the MCP toolbox binary from source
go install github.com/googleapis/genai-toolbox/cmd/toolbox@latest

Verify that the binary was installed to your $(go env GOPATH)/bin directory:

# Check if MCP toolbox is in your Go bin
ls $(go env GOPATH)/bin/toolbox

To make it easy for your script to reference, either ensure $(go env GOPATH)/bin is on your $PATH, or copy/symlink the binary into your project directory:

# Symlink or copy the MCP toolbox into your current project directory
cp $(go env GOPATH)/bin/toolbox ./toolbox
chmod +x ./toolbox

4. Configure Environment Variables

Create a .env file in the root of looker-mcp-agent/:

LOOKER_BASE_URL="https://your-looker-instance.com"
LOOKER_CLIENT_ID="your_client_id"
LOOKER_CLIENT_SECRET="your_client_secret"
GEMINI_API_KEY="your_gemini_api_key"

Verify that .env is listed in your .gitignore file.

Note: You can also connect to Looker via Oauth

5. Define Tools in tools.yaml

What is tools.yaml?

tools.yaml is the declarative configuration manifest for the MCP Toolbox (toolbox). Instead of writing custom boilerplate or manual HTTP handlers to interact with Looker APIs, MCP Toolbox uses tools.yaml to dynamically expose Looker capabilities as standardized Model Context Protocol (MCP) tools for your LLM agent.

It serves two primary purposes:

  1. Configures the connection to your Looker instance (endpoint URL, authentication credentials, project, location, and timeouts).
  2. Specifies which Looker capabilities (e.g., listing connections, creating dashboards, running queries) the MCP server will expose to Gemini, complete with natural-language descriptions that Gemini uses for tool selection and argument generation.

File Location: Placing tools.yaml at the Project Root

The tools.yaml file must be located at the project root directory (the parent directory of basic_looker_agent/), not inside the basic_looker_agent/ subdirectory.

Here is the expected project directory structure:

looker-mcp-agent/                 <-- Project root directory
├── tools.yaml                    <-- Place tools.yaml here!
├── toolbox                       <-- MCP Toolbox binary executable
└── basic_looker_agent/           <-- Agent package directory created by ADK
    ├── .env                      <-- Local environment variables (keys & credentials)
    ├── __init__.py
    └── agent.py                  <-- Agent code (references ../tools.yaml)

Why at the project root? In agent.py, the agent resolves the MCP server configuration via ../tools.yaml (one directory up from basic_looker_agent/). Keeping tools.yaml at the project root cleanly separates your MCP tool definitions and data sources from your Python agent code. If you place tools.yaml inside basic_looker_agent/, the agent will not be able to find it.

sources:
  my-looker-source:
    kind: looker
    base_url: https://your-looker-instance.com
    client_id: $LOOKER_CLIENT_ID
    client_secret: $LOOKER_CLIENT_SECRET
    project: your-looker-project
    location: us-east1
    verify_ssl: true
    timeout: 600s

tools:
    get_connections:
        kind: looker-get-connections
        source: my-looker-source
        description: |
          This tool retrieves a list of all database connections configured in the Looker system.

          Parameters:
          This tool takes no parameters.

          Output:
          A JSON array of objects, each representing a database connection.
    create_dashboard:
        kind: looker-make-dashboard
        source: my-looker-source
        description: |
          This tool creates a dashboard from a prompt.

Note: The $LOOKER_CLIENT_ID and $LOOKER_CLIENT_SECRET placeholders will automatically resolve from the environment passed into the MCP server process.

6. Implement the Agent

Create a file named agent.py. This script connects the MCP server process to the ADK LlmAgent.

import os
from dotenv import load_dotenv
from mcp import StdioServerParameters
from google.adk.agents import LlmAgent
from google.adk.tools import MCPToolset
from google.adk.tools.mcp_tool.mcp_session_manager import StdioConnectionParams

# Load environment variables
load_dotenv()

# Configure MCP Stdio server parameters
base_dir = os.path.dirname(os.path.abspath(__file__))
# Reference the toolbox binary in your project root or from GOPATH
toolbox_path = os.path.abspath(os.path.join(base_dir, "toolbox"))
tools_path = os.path.abspath(os.path.join(base_dir, "tools.yaml"))

looker_server = StdioServerParameters(
    command=toolbox_path,
    args=["--stdio", "--tools-file", tools_path],
    env={
        "LOOKER_BASE_URL": os.getenv("LOOKER_BASE_URL"),
        "LOOKER_CLIENT_ID": os.getenv("LOOKER_CLIENT_ID"),
        "LOOKER_CLIENT_SECRET": os.getenv("LOOKER_CLIENT_SECRET"),
    },
)

# Create the ADK MCP Toolset
looker_toolset = MCPToolset(
    connection_params=StdioConnectionParams(server_params=looker_server)
)

# Define the root LLM Agent
root_agent = LlmAgent(
    model="gemini-3.8-flash",
    name="looker_pro",
    description="A helpful assistant that queries Looker and uses mcp-toolbox-for-databases.",
    instruction="You are a helpful assistant that retrieves Looker connection information and assists users with available Looker tools.",
    tools=[looker_toolset],
)

7. Run and Test the Agent

ADK includes a built-in development web interface.

Launch the ADK Web Server

Run the following command from your project directory:

adk web
``` This will spin up a lightweight locally hosted server to
review your agent.

### Interact with Your Agent

1.  Open the URL printed in the terminal (typically `http://localhost:8080` or
    `http://127.0.0.1:8000`).
2.  Test tool discovery by prompting the agent:

What tools do you have available?

    inspect its toolset and report the `get_connections` and the
    `create_dashboard` tool.

3.  Test tool execution:

Can you show me the database connections in Looker?

" class="language->">    Response: The agent will invoke `get_connections` over MCP and list your
    instance's active database connections.

---

## Congratulations & Next Steps

Duration: 1:00

You have built an AI agent using Google ADK connected to Looker via the Model
Context Protocol (MCP).

### What you learned:

*   How to install and configure `toolbox` using `go install`.
*   How to configure Looker API credentials for external integrations.
*   How to define MCP sources and tools in `tools.yaml`.
*   How to link an MCP toolset to an ADK `LlmAgent`.
*   How to test tool invocation in the ADK web interface.

### Next Steps:

*   Create a dashboard with the agent defined in the codelab.
*   Add more [Looker tools](https://mcp-toolbox.dev/integrations/looker/source/)
    to `tools.yaml` (such as `looker-query`, `looker-run-look`).
*   Check out [Google ADK Documentation](https://github.com/google/adk) for
    multi-agent routing and state persistence.