google / google/adk-python-community

ADK with MCPToolSet not working connecting to local MCPServer

Đang mở
#33 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
182
Fork
75
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

1. I have created venv for adk project
2. In the same env I am running FastMCP MCP server http://localhost:8000
3. Instead of using MCP client - i wanted to use ADK as a client and calling tool from MCP server
4. My ADK API server is running like
adk api_server --host localhost --port 8000
5. When I am make a call to this server which in turn goes to MCP and call the tool its not working. I am getting error
Fail to load 'adk-google-models' module. 'module' object is not callable

Flow

Running venv where MCP server is running and ADK is running. ADK is the client calling tool defined in MCP server.

Code
root_agent = LlmAgent(
# Use the latest stable Flash model identifier
model="gemini-2.5-flash",
name="gemini_flash_agent",
description=("Agent to answer questions about weather in a city."),
instruction="Use the data from a URL provided by the user",
generate_content_config=generate_content_config,
tools= [McpToolset (
connection_params=StreamableHttpConnectionParams(
url="http://localhost:9000/mcp",
timeout=10,
),
tool_filter['get_weather']. // Weather tool running on MCP server
#sub_agents=[],
# ... other agent parameters
),
],
)

MCP code:

import io

from fastmcp import FastMCP
from fastmcp.utilities.types import Image

# Create server - dependencies are now in fastmcp.json
mcp = FastMCP("Screenshot Demo")

@mcp.tool
def get_weather(city: str) -> dict:
"""Gets the current weather for a specific city."""
# In a real app, this would call a weather API
return {"city": city, "temperature": "72F", "forecast": "Sunny"}

if __name__ == "__main__":
import asyncio

asyncio.run(mcp.run_async())

testing calling MCP:

curl -X POST http://localhost:8000/run \
-H "Content-Type: application/json" \
-d '{
"app_name": "adk-google-models",
"user_id": "test1",
"session_id": "test1session",
"new_message": {
"role": "user",
"parts": [
{"text": "What is the weather in cityxxx"}
]
}
}'

anyone have idea what is missing?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện yêu cầu POST tới ADK api_server và kiểm tra cách mô-đun app_name được tải, sau đó kiểm tra URL kết nối MCP và các cổng được McpToolset cùng máy chủ FastMCP sử dụng. So sánh lỗi module-not-callable được báo cáo với cấu hình agent được hiển thị. Hoàn thành khi yêu cầu tới được get_weather và trả về phản hồi thời tiết như mong đợi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
api, backend
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
48/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.