BA

bhancockio/adk-mcp-tutorial

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

90 stars 74 forks 품질 45 트렌드 15

bhancockio/adk-mcp-tutorial는 MCP 서버 후보는 https://github.com/bhancockio/adk-mcp-tutorial.에서 수입

개요

bhancockio/adk-mcp-tutorial는 MCP 서버 후보는 https://github.com/bhancockio/adk-mcp-tutorial.에서 수입

개요(AI 번역)

이 프로젝트는 로컬 SQLite 데이터베이스와 상호 작용하는 Agent Development Kit (ADK) 에이전트를 보여줍니다. 상호 작용은 도구가 쿼리하고 데이터베이스를 수정하는 모델 Context Protocol (MCP) 서버가 용이합니다.

프로젝트 구조

설치 설명서

##1. 필수품

  • 파이썬 3.8 이상
  • 터미널 또는 명령 프롬프트에 액세스

##2. 가상 환경 만들기 및 활성화

프로젝트 의존성을 관리하기 위해 가상 환경을 사용하는 것이 좋습니다.

가상 환경을 활성화:

macOS/Linux에서:

Windows에서:

##3. 의존성 설치

pip를 사용하여 필요한 모든 Python 패키지 설치:

##4. Gemini API Key 설정 (ADK Agent용)

이 프로젝트의 ADK 에이전트는 Gemini 모델을 사용합니다. Gemini API 키가 필요합니다.

  1. 기존 Google AI Studio 계정을 만들거나 사용하십시오.
  2. API 키 섹션에서 Gemini API 키를 가져옵니다.
  3. 환경 변수로 API 키 설정. .env]파일을 adk-mcp 프로젝트의 **(즉, local_mcp] 폴더와 readme.md]):

server.py와 agent.py]는 이 키를로드합니다.

5. SQLite 데이터베이스 및 테이블 만들기

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.

README

원문 README의 일부입니다. 원문 보기.

ADK Agent MCP Server

This project demonstrates an Agent Development Kit (ADK) agent that interacts with a local SQLite database. The interaction is facilitated by a Model Context Protocol (MCP) server that exposes tools to query and modify the database.

Project Structure

adk-mcp/
├── local_mcp/
│   ├── agent.py             # The ADK agent for the local SQLite DB
│   ├── server.py            # The MCP server exposing database tools
│   ├── create_db.py         # Script to initialize the SQLite database
│   ├── database.db          # The SQLite database file
│   └── __init__.py
├── remote_mcp_agent/        # Example agent for connecting to a remote MCP server
│   ├── agent.py             # The ADK agent configured for a remote MCP
│   └── __init__.py
├── .env                   # For GOOGLE_API_KEY (ensure it's in .gitignore if repo is public)
├── requirements.txt       # Python dependencies
└── readme.md              # This file

Setup Instructions

1. Prerequisites

  • Python 3.8 or newer
  • Access to a terminal or command prompt

2. Create and Activate Virtual Environment

It’s highly recommended to use a virtual environment to manage project dependencies.

# Create a virtual environment (e.g., named .venv)
python3 -m venv .venv

Activate the virtual environment:

On macOS/Linux:

# Activate virtual environment
source .venv/bin/activate

On Windows:

# Activate virtual environment
.venv\Scripts\activate

3. Install Dependencies

Install all required Python packages using pip:

# Install all dependencies from requirements.txt
pip install -r requirements.txt

4. Set Up Gemini API Key (for the ADK Agent)

The ADK agent in this project uses a Gemini model. You’ll need a Gemini API key.

  1. Create or use an existing Google AI Studio account.

  2. Get your Gemini API key from the API Keys section.

  3. Set the API key as an environment variable. Create a .env file in the root of the adk-mcp project (i.e., next to the local_mcp folder and readme.md):

    # .env
    GOOGLE_API_KEY=your_gemini_api_key_here
    

    The server.py and agent.py will load this key.

5. Create the SQLite Database and Tables

The project includes a script to create and populate the SQLite database (database.db) with some initial tables (users, todos) and dummy data.

Navigate to the local_mcp directory and run the script:

cd local_mcp
python3 create_db.py
cd ..

This will create local_mcp/database.db if it doesn’t already exist.

Running the Agent and MCP Server

The ADK agent (local_mcp/agent.py) is configured to automatically start the MCP server (local_mcp/server.py) when it initializes its MCP toolset.

To run the agent:

  1. Ensure your virtual environment is active and you are in the root directory of the adk-mcp project.
  2. Execute the agent script:
GitHub에서 전체 README 보기

설치

npx -v
MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →