Agent Mesh
Go a2aa2a-protocolagent-meshagentic-aiinferencemcpmeshmesh-networknetwork-securitynetworking-aip2p-network
canary: migrate the banana bot to mcp 2.x and pin the major
Antonio Ojea6b46e58d49ad
diff --git a/.github/k8s/sam-node-cop-template.yaml b/.github/k8s/sam-node-cop-template.yamlindex a4b1374c..0d3bcf2d 100644--- a/.github/k8s/sam-node-cop-template.yaml+++ b/.github/k8s/sam-node-cop-template.yaml@@ -42,7 +42,7 @@ spec:- "/bin/bash"- "-c"- |- pip install --no-cache-dir httpx mcp &&+ pip install --no-cache-dir httpx 'mcp>=2,<3' &&python -u /app/banana_bot_playground.pyenv:- name: SAM_MCP_URLdiff --git a/site/content/docs/snippets/banana_bot_playground.py b/site/content/docs/snippets/banana_bot_playground.pyindex 1b54f001..21e40cad 100644--- a/site/content/docs/snippets/banana_bot_playground.py+++ b/site/content/docs/snippets/banana_bot_playground.py@@ -6,7 +6,7 @@ import randomimport httpxfrom typing import Optional, Dict, Any, Listfrom mcp import ClientSession-from mcp.client.streamable_http import streamablehttp_client+from mcp.client.streamable_http import streamable_http_clientclass SamClient:"""Inlined SAM Client for self-contained execution."""@@ -25,8 +25,15 @@ class SamClient:headers = {"Accept": "application/json, text/event-stream"}if self.token:headers["Authorization"] = f"Bearer {self.token}"- self._sse_cm = streamablehttp_client(self.server_url, headers=headers)- read_stream, write_stream, _ = await self._sse_cm.__aenter__()+ self._http_client = httpx.AsyncClient(+ headers=headers,+ follow_redirects=True,+ # The SDK's SSE-friendly defaults; httpx's default 5s read timeout drops the stream.+ timeout=httpx.Timeout(30.0, read=300.0),+ )+ self._sse_cm = streamable_http_client(self.server_url, http_client=self._http_client)+ res = await self._sse_cm.__aenter__()+ read_stream, write_stream = res[0], res[1]self.session = ClientSession(read_stream, write_stream)await self.session.__aenter__()await self.session.initialize()@@ -36,8 +43,11 @@ class SamClient:await self.session.__aexit__(None, None, None)if self._sse_cm:await self._sse_cm.__aexit__(None, None, None)+ if getattr(self, "_http_client", None):+ await self._http_client.aclose()self.session = Noneself._sse_cm = None+ self._http_client = Noneasync def get_tools(self) -> List[Dict[str, Any]]:if not self.session: