Skip to content

cannot work with "mcp.map.qq.com" Streamable HTTP or SSE #3397

@zsq2010

Description

@zsq2010

Docs
https://lbs.qq.com/service/MCPServer/MCPServerGuide/userGuide


./adk_agent_samples/mcp_agent/agent.py

import os
from google.adk.agents import LlmAgent
from google.adk.tools.mcp_tool.mcp_toolset import MCPToolset
from google.adk.tools.mcp_tool.mcp_session_manager import (
SseConnectionParams,
StreamableHTTPConnectionParams,
)

你的腾讯地图 API Key

TENCENT_MAP_API_KEY = "xxxxx" // warn: fill in your key....

腾讯地图 MCP 端点

SSE (Server-Sent Events) 方式

TENCENT_MAP_SSE_URL = (
f"https://mcp.map.qq.com/sse?key={TENCENT_MAP_API_KEY}&format=0"
)

Streamable HTTP 方式

TENCENT_MAP_STREAMABLE_HTTP_URL = (
f"https://mcp.map.qq.com/mcp?key={TENCENT_MAP_API_KEY}&format=0"
)

root_agent = LlmAgent(
model="gemini-2.0-flash",
name="tencent_map_agent", #
instruction="You are a helpful assistant that can answer map-related questions using Tencent Map tools.",
tools=[
# 工具集1: 使用 SSE 方式连接
MCPToolset(
connection_params=SseConnectionParams(
url=TENCENT_MAP_SSE_URL,
timeout=30.0, # 增加连接超时时间
sse_read_timeout=60.0, # 增加读取超时时间
)
),
# 工具集2: 使用 Streamable HTTP 方式连接
MCPToolset(
connection_params=StreamableHTTPConnectionParams(
url=TENCENT_MAP_STREAMABLE_HTTP_URL,
timeout=30.0, # 增加连接超时时间
sse_read_timeout=60.0, # 增加读取超时时间
)
),
],
)

I cannnot connect both ways

Metadata

Metadata

Assignees

Labels

mcp[Component] Issues about MCP supporttools[Component] This issue is related to tools

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions