Skip to content

Commit c689412

Browse files
kmoscoeclincoln8
andauthored
Update sample agent to connect to hosted MCP server by default (#139)
Co-authored-by: Christie Ellks <calinc@google.com>
1 parent 2ecca8f commit c689412

2 files changed

Lines changed: 10 additions & 11 deletions

File tree

Binary file not shown.

packages/datacommons-mcp/examples/sample_agents/basic_agent/agent.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66

77
from google.adk.agents.llm_agent import LlmAgent
88
from google.adk.tools.mcp_tool.mcp_toolset import (
9-
McpToolset,
10-
StdioConnectionParams,
11-
StdioServerParameters,
9+
MCPToolset,
10+
StreamableHTTPConnectionParams,
1211
)
1312

1413
from .instructions import AGENT_INSTRUCTIONS
@@ -28,14 +27,14 @@
2827
name="basic_agent",
2928
instruction=AGENT_INSTRUCTIONS,
3029
tools=[
31-
McpToolset(
32-
connection_params=StdioConnectionParams(
33-
timeout=10,
34-
server_params=StdioServerParameters(
35-
command="uvx",
36-
args=["datacommons-mcp", "serve", "stdio"],
37-
env={"DC_API_KEY": DC_API_KEY},
38-
),
30+
MCPToolset(
31+
connection_params=StreamableHTTPConnectionParams(
32+
url="https://api.datacommons.org/mcp",
33+
headers={
34+
"Content-Type": "application/json",
35+
"Accept": "application/json, text/event-stream",
36+
"X-API-Key": DC_API_KEY,
37+
},
3938
)
4039
)
4140
],

0 commit comments

Comments
 (0)