> For the complete documentation index, see [llms.txt](https://docs.talordata.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.talordata.com/cn-tw/serp-api/integration/mcp-integration/google-adk-integration.md).

# Google ADK 集成

將Google Agent Development Kit（ADK）連接到TalorData MCP服務器（60多個工具），以實現Gemini支持的代理的Web搜索和結構化提取。

### 遠程 MCP

{% stepper %}
{% step %}

#### 獲取**您的 API 令牌**

* 前往 [SERP API-API Token](https://dashboard.talordata.com/scraping/serp-api/api-token/) 創建 API Token
* 複製您的 API Token（格式如下：`sk_7qBRe***************************`）

{% endstep %}

{% step %}

#### 安裝**所需**軟**件包**

```
pip install google-adk
```

{% endstep %}

{% step %}

#### 配寘您的MCP服務器

```
from google.adk.agents import Agent
from google.adk.tools.mcp_tool.mcp_session_manager import StreamableHTTPServerParams
from google.adk.tools.mcp_tool.mcp_toolset import McpToolset

TALORDATA_API_TOKEN = "YOUR_TALORDATA_API_TOKEN"

root_agent = Agent(
model="gemini-2.5-pro",
name="TALORdata_agent",
instruction="""Help users access web data using TalorData""",
tools=[
    McpToolset(
        connection_params=StreamableHTTPServerParams(
            url=f"https://mcp.talordata.com/TALORDATA_API_TOKEN/mcp",
        ),
    )
],
)
```

{% endstep %}

{% step %}

#### 設定環境變量（可選）

為了提高安全性，您可以將 API 令牌存儲為環境變量：

```
import os
TALORDATA_API_TOKEN = os.getenv("TALORDATA_API_TOKEN")
```

`.env`然後，在項目目錄中創建一個文件：

```
TALORDATA_API_TOKEN=your_TalorData_api_token_here
```

{% endstep %}

{% step %}

#### 測試一下是否有效

* 請替換`YOUR_TALORDATA_API_TOKEN`為您的實際 TalorData API Token
* 運行您的Google ADK腳本
* 你應該看到代理執行網絡搜索並提供全面的回復。

{% endstep %}

{% step %}

#### 監控使用情况

在 TalorData [**SERP API-使用記錄**](https://dashboard.talordata.com/scraping/serp-api/history) 中查看您的 API 使用情况。

{% endstep %}
{% endstepper %}
