1. 개요
이 Codelab에서는 Google 에이전트 개발 키트(ADK)와 데이터베이스용 MCP 도구 상자를 사용하여 Looker 인스턴스와 상호작용하는 대화형 AI 에이전트를 빌드합니다.

ADK 및 MCP란 무엇인가요?
- Google ADK(에이전트 개발 키트): Gemini 기반의 멀티 도구 LLM 에이전트를 만들고, 테스트하고, 조정할 수 있는 경량 프레임워크입니다.
- 모델 컨텍스트 프로토콜(MCP): LLM이 커스텀 어댑터 코드 없이 외부 도구, 데이터베이스, API에 안전하게 연결할 수 있도록 지원하는 개방형 표준입니다.
빌드 대상
- Gemini 3.8 Flash를 기반으로 하는 로컬 Python 기반 에이전트입니다.
- Looker에 연결하는 MCP 도구 상자 통합
- 상호작용형 ADK 로컬 웹 UI를 통해 테스트된 실행 중인 에이전트
기본 요건
- API 사용자 인증 정보를 생성할 수 있는 관리자 또는 개발자 권한이 있는 Looker 인스턴스
- Python 3.10 이상이 설치되어 있어야 합니다.
- Go 1.21 이상이 설치되어 있어야 합니다(
toolbox바이너리를 빌드/설치하기 위해). - Google Gemini API 키 또는 Vertex AI가 사용 설정된 Google Cloud 프로젝트
2. Looker API 사용자 인증 정보 보호
MCP 서버가 Looker 인스턴스로 인증하도록 허용하려면 API 3 사용자 인증 정보를 가져와야 합니다.
- Looker 인스턴스에 로그인합니다.
- 관리 > 사용자(또는 셀프 서비스 사용자 인증 정보 생성이 사용 설정된 경우 계정 설정)로 이동합니다.
- 사용자 계정을 찾아 수정을 선택합니다.
- API 3 키 섹션에서 새 API 키를 클릭합니다.
- 생성된 클라이언트 ID와 클라이언트 보안 비밀번호를 저장합니다.
[경고] 클라이언트 보안 비밀번호를 안전하게 보관하세요. .env 파일을 버전 제어에 커밋하지 마세요.
3. 개발 환경 설정 및 MCP 도구 상자 설치
프로젝트 디렉터리를 만들고, Python 가상 환경을 설정하고, Go를 사용하여 필요한 MCP 도구 상자 바이너리를 설치합니다.
프로젝트 디렉터리 및 가상 환경 만들기
mkdir looker-mcp-agent && cd looker-mcp-agent
python3 -m venv .venv
source .venv/bin/activate
Python 종속 항목 설치
Google ADK, MCP 클라이언트 SDK, Python 환경 관리자를 설치합니다.
pip install google-adk mcp python-dotenv
Go를 사용하여 MCP 도구 상자 바이너리 설치
MCP 연결은 MCP 도구 상자 바이너리(toolbox)를 사용합니다. go install를 사용하여 직접 설치할 수 있습니다.
# Install the MCP toolbox binary from source
go install github.com/googleapis/genai-toolbox/cmd/toolbox@latest
바이너리가 $(go env GOPATH)/bin 디렉터리에 설치되었는지 확인합니다.
# Check if MCP toolbox is in your Go bin
ls $(go env GOPATH)/bin/toolbox
스크립트에서 쉽게 참조할 수 있도록 $(go env GOPATH)/bin가 $PATH에 있는지 확인하거나 바이너리를 프로젝트 디렉터리에 복사/심볼릭 링크합니다.
# Symlink or copy the MCP toolbox into your current project directory
cp $(go env GOPATH)/bin/toolbox ./toolbox
chmod +x ./toolbox
4. 환경 변수 구성
looker-mcp-agent/의 루트에 .env 파일을 만듭니다.
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"
.env가 .gitignore 파일에 나열되어 있는지 확인합니다.
참고: OAuth를 통해 Looker에 연결할 수도 있습니다.
5. tools.yaml에서 도구 정의
tools.yaml는 어떤 서비스인가요?
tools.yaml는 MCP 도구 상자(toolbox)의 선언적 구성 매니페스트입니다. Looker API와 상호작용하기 위해 커스텀 상용구나 수동 HTTP 핸들러를 작성하는 대신 MCP 도구 상자는 tools.yaml를 사용하여 Looker 기능을 LLM 에이전트의 표준화된 모델 컨텍스트 프로토콜(MCP) 도구로 동적으로 노출합니다.
이는 다음과 같은 두 가지 주요 목적으로 사용됩니다.
- Looker 인스턴스에 대한 연결(엔드포인트 URL, 사용자 인증 정보, 프로젝트, 위치, 제한 시간)을 구성합니다.
- MCP 서버가 Gemini에 노출할 Looker 기능(예: 연결 나열, 대시보드 만들기, 쿼리 실행)을 지정하며, Gemini가 도구 선택 및 인수 생성에 사용하는 자연어 설명이 포함됩니다.
파일 위치: 프로젝트 루트에 tools.yaml 배치
tools.yaml 파일은 basic_looker_agent/ 하위 디렉터리 내부가 아닌 프로젝트 루트 디렉터리(basic_looker_agent/의 상위 디렉터리)에 있어야 합니다.
예상되는 프로젝트 디렉터리 구조는 다음과 같습니다.
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)
프로젝트 루트에 있는 이유 agent.py에서 에이전트는 ../tools.yaml(basic_looker_agent/에서 한 디렉터리 위)를 통해 MCP 서버 구성을 확인합니다. tools.yaml를 프로젝트 루트에 유지하면 MCP 도구 정의 및 데이터 소스가 Python 에이전트 코드와 깔끔하게 분리됩니다. basic_looker_agent/ 내부에 tools.yaml를 배치하면 상담사가 찾을 수 없습니다.
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.
참고: $LOOKER_CLIENT_ID 및 $LOOKER_CLIENT_SECRET 자리표시자는 MCP 서버 프로세스에 전달된 환경에서 자동으로 확인됩니다.
6. 에이전트 구현
agent.py 파일을 만듭니다. 이 스크립트는 MCP 서버 프로세스를 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. 에이전트 실행 및 테스트
ADK에는 기본 제공 개발 웹 인터페이스가 포함되어 있습니다.
ADK 웹 서버 실행
프로젝트 디렉터리에서 다음 명령어를 실행합니다.
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:
어떤 도구를 사용할 수 있나요?
inspect its toolset and report the `get_connections` and the
`create_dashboard` tool.
3. Test tool execution:
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.