# 利用 Gemini CLI 與 ADK 開發 Agentic 應用
> 📌 Slido 📌
> https://app.sli.do/event/8KgV6W46m8rZo23c3GXv5z
> 共筆請從這裡開始
簡報:https://devfest2025taipei-jimmyliao.web.app/
[TOC]
## 痛點
* 敏感資料,不能上雲
* 內部認證問題
* 各種服務API缺乏統一標準
* 一拖拉庫的AI 工具
* MCP 本身也會演進,開發要跟上
* 非開發人員,要怎麼理解API
## Solution
* ✅ Gemini CLI -> 快速驗證、免費額度
* ✅ MCP 協定 -> 標準化工具整合
* ✅ Google ADK -> Agent 自動化編排
* ✅ Vertex AI / Cloud Run -> 企業級部署
* 🏢 實際部署選擇
企業場景:
- 自建平台 + MCP + ADK
演示方案
> AnythingLLM(開源、今日 Demo)
>= Agentic Workflow 開發平台
## 系統架構
```mermaid
flowchart TD
classDef highlight fill:#f9f,stroke:#333,stroke-width:2px;
classDef cloud fill:#e1f5fe,stroke:#01579b;
classDef tools fill:#fff3e0,stroke:#e65100;
Dev([開發者])
Platform[自建 AI 平台<br/>整合 Gemini API]
DemoNote[💡 今日 Demo 使用:<br/>AnythingLLM] -.-> Platform
Protocol[MCP 協定 + Google ADK]
subgraph Infrastructure [Infrastructure]
MCPServer[MCP Server<br/>部署至 Vertex AI]:::cloud
end
subgraph Resources [整合資源]
direction LR
GitLab:::tools
JIRA:::tools
Quip:::tools
API[內部 API]:::tools
end
Dev --> Platform
Platform --> Protocol
Protocol --> MCPServer
MCPServer --> GitLab
MCPServer --> JIRA
MCPServer --> Quip
MCPServer --> API
class DemoNote highlight
```
痛點:內部認證!
使用工具:AnythingLLM
---
- 任何工具都只需實作一次,真的嗎?(是這樣沒錯,但不是這樣 )
- 三種傳輸方式:本地端 `stdio` / 遠端 `SEE` / 對談、串流 `streamable HTTP`
- 痛點:因為技術演進很快,所以要跟的很快
- 痛點:工具不是很熟(非開發人員,但可以用 LLM 去開發)
工具:LeapCode
### MCP 如何整合工具?
```mermaid
flowchart TD
A[AnythingLLM] -->|MCP Protocol| B[GitHub MCP Server]
B --> C[search_code] & D[create_issue] & E[create_pull_request] & F[get_workflow_runs]
C & D & E & F -->|GitHub API| G[GitHub]
```
## Demo
* 1️⃣ Browser Use(開源)
* AI 驅動瀏覽器自動化、MCP 原生支援
* 2️⃣ 台股查詢 MCP Server(FastMCP)
* 50 行代碼快速建立、證交所 API
* 3️⃣ 企業文檔管理 MCP ⭐
* 合規檢查、敏感資料掃描
* 4️⃣ AnythingLLM 整合
* Web UI、RAG 文檔檢索
* 5️⃣ Google ADK Agent ⭐⭐⭐
* 投資分析自動化、3秒完成分析
### Demo 1 - Browser Use MCP
https://github.com/browser-use/browser-use
### Demo 2 - FastMCP 台股查詢
```python
from fastmcp import FastMCP
mcp = FastMCP("台股即時查詢")
@mcp.tool()
def get_tsmc_price() -> dict:
"""查詢台積電即時股價"""
return get_stock_data("2330")
@mcp.tool()
def get_tech_stocks():
"""科技股比較"""
return compare_stocks([
"2330", "2454", "2317"
])
# 啟動 Remote Server
mcp.run(transport="sse", port=8080)
```
### Demo 3 - Document MCP ⭐
整合到現有的 AI platform - AnythingLLM
Quickstart:
```bash
docker run -d -p 3001:3001 \
mintplexlabs/anythingllm
open http://localhost:3001
```
### Demo 4 - MCP Server
### Demo 5 - Google ADK Agent
程式碼範例:
```python
from google.adk.agents import Agent
from google.adk.tools import FunctionTool
# 建立 Agent(整合多個 MCP 工具)
agent = Agent(
name="investment_analyst",
model="gemini-2.0-flash-exp",
tools=[
FunctionTool(get_stock_price),
FunctionTool(search_documents),
# ... 更多 MCP 工具
]
)
# AI 自動推理與工具編排
response = agent.run("分析台積電是否值得投資")
```
### MCP 部屬方式比較
* Remote MCP
* Transport: SSE / HTTPStreamable
* 部署: Cloud Run / K8S
* 優勢:
* ✅ 一次部署,多處使用 / 跨平台支援
* ✅ 團隊共享 / 集中管理和更新
* 適用場景:
* 企業級工具服務
* Local MCP
* Transport: STDIO
* 部署: 本地機器
* 優勢:
* ✅ 速度快(無網路延遲)
* ✅ 安全性高(不經網路)
* ✅ 適合敏感資料
* 適用場景:
* 敏感資料處理
## Agentic 開發
> 如何高效開發你的 Agentic AI App