Skip to content

Agent Mesh

sdk: retire the sam-mcp-python sidecar wrapper

Antonio Ojea09f9881bbd41
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index a0c5d3c8..72b58ab1 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -45,7 +45,6 @@ updates:
- package-ecosystem: "pip"
directories:
- - "/sam-mcp-python"
- "/cmd/chaos-agent"
- "/tests/e2e/docker/*"
- "/development/examples/*"
diff --git a/.github/workflows/test_python.yml b/.github/workflows/test_python.yml
deleted file mode 100644
index 4485d3b5..00000000
--- a/.github/workflows/test_python.yml
+++ /dev/null
@@ -1,37 +0,0 @@
-name: Python SDK Test
-
-on:
- push:
- branches: [ main ]
- paths:
- - 'sam-mcp-python/**'
- pull_request:
- branches: [ main ]
- paths:
- - 'sam-mcp-python/**'
-
-permissions:
- contents: read
-
-jobs:
- test_python:
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- with:
- persist-credentials: false
-
- - name: Set up Go
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
- with:
- go-version: '1.22'
-
- - name: Set up Python
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
- with:
- python-version: '3.10'
-
- - name: Run Python unit tests
- run: make test-python
-
diff --git a/Makefile b/Makefile
index b39e2672..868f922d 100644
--- a/Makefile
+++ b/Makefile
@@ -156,15 +156,6 @@ test:
CGO_ENABLED=1 go test -v -race -count 1 $(if $(WHAT),-run $(WHAT)) ./...
CGO_ENABLED=1 go -C cmd/nano-init test -race -count 1 $(if $(WHAT),-run $(WHAT)) ./...
-.PHONY: test-python test-python-e2e
-test-python:
- python3 -m venv sam-mcp-python/.venv
- ./sam-mcp-python/.venv/bin/pip install -e ./sam-mcp-python[test]
- ./sam-mcp-python/.venv/bin/pytest sam-mcp-python/tests/unit
-
-test-python-e2e: build docker-build
- bats --verbose-run tests/e2e/python_sdk_test.bats
-
e2e-test: build docker-build
bats -j 10 --verbose-run $(if $(WHAT),--filter "$(WHAT)") tests/e2e/
diff --git a/sam-mcp-python/README.md b/sam-mcp-python/README.md
deleted file mode 100644
index 2a1c8131..00000000
--- a/sam-mcp-python/README.md
+++ /dev/null
@@ -1,38 +0,0 @@
-# SAM Python SDK (sam-mcp-python)
-
-The official Python SDK for SAM.
-
-This SDK acts as a "Thin Client" that connects to the local Go node via a Unix Domain Socket and communicates using the Model Context Protocol (MCP) over JSON-RPC 2.0.
-
-## Installation
-
-```bash
-pip install .
-```
-
-## Usage
-
-```python
-import asyncio
-from sam_mcp.client import SamClient
-
-async def main():
- async with SamClient() as client:
- tools = await client.get_tools()
- print("Available tools:", tools)
-
- result = await client.call_tool("echo", {"message": "hello"})
- print("Result:", result)
-
-if __name__ == "__main__":
- asyncio.run(main())
-```
-
-## Development
-
-### Running Tests
-
-```bash
-pytest tests/unit
-pytest tests/e2e
-```
diff --git a/sam-mcp-python/examples/gemini_agent.py b/sam-mcp-python/examples/gemini_agent.py
deleted file mode 100644
index 7a2bb436..00000000
--- a/sam-mcp-python/examples/gemini_agent.py
+++ /dev/null
@@ -1,148 +0,0 @@
-import asyncio
-import os
-import sys
-from google import genai
-from google.genai import types
-from sam_mcp.client import SamClient
-
-# Helper to recursively map MCP (JSON Schema) types to Gemini (OpenAPI Schema) types
-def to_gemini_schema(mcp_schema: dict) -> dict:
- if not isinstance(mcp_schema, dict):
- return mcp_schema
-
- gemini_schema = {}
- for k, v in mcp_schema.items():
- if k == "type" and isinstance(v, str):
- # Gemini expects uppercase types (e.g. 'STRING', 'OBJECT')
- gemini_schema[k] = v.upper()
- elif k == "properties" and isinstance(v, dict):
- gemini_schema[k] = {prop_name: to_gemini_schema(prop_val) for prop_name, prop_val in v.items()}
- elif k == "items" and isinstance(v, dict):
- gemini_schema[k] = to_gemini_schema(v)
- else:
- gemini_schema[k] = v
-
- return gemini_schema
-
-async def run_agent():
- # 1. Connect to local SAM Node
- # By default, connects to http://localhost:8080/mcp
- print("Connecting to local SAM Node...")
- client = SamClient()
- try:
- await client.connect()
- except Exception as e:
- print(f"Error: Failed to connect to local SAM Node: {e}")
- print("Make sure sam-node is running (e.g. 'sam-node run --bind-addr 127.0.0.1:8080')")
- sys.exit(1)
-
- print("Successfully connected!")
-
- # 2. Get available tools from the Mesh
- mcp_tools = await client.get_tools()
- print(f"Discovered {len(mcp_tools)} tools in the mesh.")
- for t in mcp_tools:
- print(f" - {t['name']}: {t.get('description', '')}")
-
- # 3. Build Gemini Tool Declarations
- gemini_functions = []
- for tool in mcp_tools:
- # Build parameters schema
- params_schema = to_gemini_schema(tool.get("inputSchema", {}))
-
- # Define the function declaration
- decl = types.FunctionDeclaration(
- name=tool["name"],
- description=tool.get("description", ""),
- parameters=params_schema
- )
- gemini_functions.append(decl)
-
- # Wrap function declarations into a Gemini Tool
- gemini_tools = [types.Tool(function_declarations=gemini_functions)]
-
- # 4. Initialize Gemini Client
- # Requires GEMINI_API_KEY environment variable
- api_key = os.environ.get("GEMINI_API_KEY")
- if not api_key:
- print("\nWarning: GEMINI_API_KEY environment variable not set.")
- print("Please export it to run the AI agent: export GEMINI_API_KEY=\"your-key\"")
- await client.close()
- sys.exit(1)
-
- ai = genai.Client(api_key=api_key)
- # Using the recommended model for function calling
- model_name = "gemini-2.5-flash"
-
- print(f"\nInitialized Gemini Agent ({model_name}) with Mesh Tools.")
- print("You can now ask questions! Type 'exit' or 'quit' to stop.")
- print("-" * 60)
-
- # 5. Interactive Chat Loop
- # We use chat session to maintain history
- chat = ai.chats.create(
- model=model_name,
- config=types.GenerateContentConfig(
- tools=gemini_tools,
- system_instruction="You are an AI agent running inside the Sovereign Agent Mesh (SAM). "
- "You have access to tools registered by other peers in the mesh. "
- "If a user asks you to perform a task, check if there's a tool that can solve it. "
- "Always prioritize using tools to explore or interact with the mesh."
- )
- )
-
- while True:
- try:
- user_input = await asyncio.to_thread(input, "\nYou > ")
- if user_input.lower() in ["exit", "quit"]:
- break
- if not user_input.strip():
- continue
-
- # Send message to Gemini
- response = chat.send_message(user_input)
-
- # Handle function calling loop (Gemini might make multiple calls sequentially)
- while response.function_calls:
- for call in response.function_calls:
- print(f"\n[Agent wants to call tool: {call.name} with args: {call.args}]")
-
- # Convert Gemini args Map to normal dict
- args = dict(call.args) if call.args else {}
-
- # Call the tool via local SAM Node
- try:
- result = await client.call_tool(call.name, args)
- print(f"[Tool Result]: {result}")
-
- # Send tool response back to Gemini
- response = chat.send_message(
- types.Part.from_function_response(
- name=call.name,
- response={"result": result}
- )
- )
- except Exception as tool_err:
- print(f"[Tool Error]: {tool_err}")
- # Send error back to model so it knows it failed
- response = chat.send_message(
- types.Part.from_function_response(
- name=call.name,
- response={"error": str(tool_err)}
- )
- )
-
- # Print Gemini's final response text
- if response.text:
- print(f"\nAgent > {response.text}")
-
- except KeyboardInterrupt:
- break
- except Exception as e:
- print(f"Error during interaction: {e}")
-
- await client.close()
- print("\nDisconnected. Goodbye!")
-
-if __name__ == "__main__":
- asyncio.run(run_agent())
diff --git a/sam-mcp-python/pyproject.toml b/sam-mcp-python/pyproject.toml
deleted file mode 100644
index e851d3b5..00000000
--- a/sam-mcp-python/pyproject.toml
+++ /dev/null
@@ -1,33 +0,0 @@
-[build-system]
-requires = ["setuptools>=84.0.0"]
-build-backend = "setuptools.build_meta"
-
-[project]
-name = "sam-mcp"
-version = "0.1.0"
-description = "Python SDK for SAM agent mesh nodes, using MCP"
-readme = "README.md"
-requires-python = ">=3.10"
-dependencies = [
- "mcp>=2.2.0,<3",
- "httpx2>=2.13.0",
-]
-
-[project.optional-dependencies]
-langchain = [
- "langchain-core>=1.6.3",
-]
-test = [
- "pytest>=9.1.1",
- "pytest-asyncio>=1.4.0",
-]
-
-[tool.hatch.build.targets.sdist]
-include = ["src"]
-
-[tool.hatch.build.targets.wheel]
-packages = ["src/sam_mcp"]
-
-[tool.pytest.ini_options]
-pythonpath = ["src"]
-asyncio_mode = "strict"
diff --git a/sam-mcp-python/src/sam_mcp/__init__.py b/sam-mcp-python/src/sam_mcp/__init__.py
deleted file mode 100644
index 1a06e96b..00000000
--- a/sam-mcp-python/src/sam_mcp/__init__.py
+++ /dev/null
@@ -1,3 +0,0 @@
-"""SAM MCP Python SDK."""
-
-__version__ = "0.1.0"
diff --git a/sam-mcp-python/src/sam_mcp/adapters/__init__.py b/sam-mcp-python/src/sam_mcp/adapters/__init__.py
deleted file mode 100644
index 6bc465bf..00000000
--- a/sam-mcp-python/src/sam_mcp/adapters/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-"""Adapters for popular frameworks."""
diff --git a/sam-mcp-python/src/sam_mcp/adapters/langchain.py b/sam-mcp-python/src/sam_mcp/adapters/langchain.py
deleted file mode 100644
index 18f85541..00000000
--- a/sam-mcp-python/src/sam_mcp/adapters/langchain.py
+++ /dev/null
@@ -1,68 +0,0 @@
-from typing import Any, Dict, List
-from ..client import SamClient
-
-def get_langchain_tools(client: SamClient, tools: List[Dict[str, Any]]) -> List[Any]:
- """Converts MCP tools into LangChain-compatible StructuredTool objects.
-
- Requires `langchain-core` and `pydantic` to be installed.
- """
- try:
- from langchain_core.tools import StructuredTool
- from pydantic import create_model, Field
- except ImportError:
- raise ImportError(
- "langchain-core and pydantic are required to use this adapter. "
- "Install them or ensure they are available via langchain."
- )
-
- lc_tools = []
- for tool in tools:
- name = tool.get("name")
- description = tool.get("description", "")
- input_schema = tool.get("inputSchema", {})
-
- properties = input_schema.get("properties", {})
- required = input_schema.get("required", [])
-
- fields = {}
- for prop_name, prop_schema in properties.items():
- prop_type = prop_schema.get("type")
- prop_desc = prop_schema.get("description", "")
-
- python_type = Any
- if prop_type == "string":
- python_type = str
- elif prop_type == "integer":
- python_type = int
- elif prop_type == "number":
- python_type = float
- elif prop_type == "boolean":
- python_type = bool
- elif prop_type == "array":
- python_type = list
- elif prop_type == "object":
- python_type = dict
-
- default = ... if prop_name in required else None
-
- fields[prop_name] = (python_type, Field(default=default, description=prop_desc))
-
- args_schema = None
- if fields:
- args_schema = create_model(f"{name}Schema", **fields)
-
- # Capture the tool name in the closure
- def make_call(tool_name=name):
- async def call_remote_tool(**kwargs):
- return await client.call_tool(tool_name, kwargs)
- return call_remote_tool
-
- lc_tool = StructuredTool.from_function(
- name=name,
- description=description,
- coroutine=make_call(name),
- args_schema=args_schema
- )
- lc_tools.append(lc_tool)
-
- return lc_tools
diff --git a/sam-mcp-python/src/sam_mcp/client.py b/sam-mcp-python/src/sam_mcp/client.py
deleted file mode 100644
index 5a4a36f0..00000000
--- a/sam-mcp-python/src/sam_mcp/client.py
+++ /dev/null
@@ -1,85 +0,0 @@
-import asyncio
-import os
-from typing import Any, Dict, List, Optional
-import httpx2
-from mcp import ClientSession
-from mcp.client.streamable_http import streamable_http_client
-
-
-def _dump(model: Any) -> Any:
- # mcp 2.x fields are snake_case in Python; by_alias keeps the MCP wire shape
- # (inputSchema, isError) that callers and the adapters were written against.
- if hasattr(model, "model_dump"):
- return model.model_dump(by_alias=True, mode="json")
- return model
-
-
-class SamClient:
- """High-level developer interface for SAM MCP using official SDK."""
-
- def __init__(self, server_url: Optional[str] = None, token: Optional[str] = None):
- if server_url is None:
- server_url = os.environ.get("SAM_MCP_URL", "http://localhost:8080/mcp")
- if token is None:
- token = os.environ.get("SAM_API_TOKEN")
- self.server_url = server_url
- self.token = token
- self.session: Optional[ClientSession] = None
- self._sh_cm = None
-
- async def connect(self):
- """Connects to the SAM node via Streamable HTTP."""
- headers = {"Accept": "application/json, text/event-stream"}
- if self.token:
- headers["X-Sam-Authentication"] = f"Bearer {self.token}"
-
- # mcp 2.x speaks httpx2; an httpx client here is accepted but drops
- # server-initiated messages.
- self._http_client = httpx2.AsyncClient(
- headers=headers,
- follow_redirects=True,
- # The SDK's SSE-friendly defaults; the default 5s read timeout drops the stream.
- timeout=httpx2.Timeout(30.0, read=300.0),
- )
- try:
- self._sh_cm = streamable_http_client(self.server_url, http_client=self._http_client)
- read_stream, write_stream = await self._sh_cm.__aenter__()
- self.session = ClientSession(read_stream, write_stream)
- await self.session.__aenter__()
- await self.session.initialize()
- except Exception:
- await self.close()
- raise
-
- async def close(self):
- """Closes the connection."""
- if self.session:
- await self.session.__aexit__(None, None, None)
- if self._sh_cm:
- await self._sh_cm.__aexit__(None, None, None)
- if hasattr(self, '_http_client') and self._http_client:
- await self._http_client.aclose()
- self.session = None
- self._sh_cm = None
- self._http_client = None
-
- async def get_tools(self) -> List[Dict[str, Any]]:
- """Returns available mesh tools as wire-format dicts (camelCase keys such as inputSchema)."""
- if not self.session:
- raise RuntimeError("Not connected")
- resp = await self.session.list_tools()
- return [_dump(t) for t in resp.tools]
-
- async def call_tool(self, name: str, arguments: Dict[str, Any]) -> Dict[str, Any]:
- """Executes a tool over the mesh and returns the wire-format result dict."""
- if not self.session:
- raise RuntimeError("Not connected")
- resp = await self.session.call_tool(name, arguments)
- return _dump(resp)
-
- async def __aenter__(self):
- await self.connect()
- return self
-
- async def __aexit__(self, exc_type, exc_val, exc_tb):
- await self.close()
diff --git a/sam-mcp-python/test_client.py b/sam-mcp-python/test_client.py
deleted file mode 100644
index d8eeb974..00000000
--- a/sam-mcp-python/test_client.py
+++ /dev/null
@@ -1,27 +0,0 @@
-import asyncio
-import os
-import sys
-from sam_mcp.client import SamClient
-
-async def main():
- url = os.environ.get("SAM_MCP_URL", "http://sam-node-1:8080/mcp")
- print(f"Connecting to {url}")
- try:
- async with SamClient(server_url=url) as client:
- # Test get_tools
- tools = await client.get_tools()
- print(f"TOOLS_COUNT:{len(tools)}")
-
- # Test call_tool (get_mesh_info is a standard tool in sam-node)
- result = await client.call_tool("get_mesh_info", {})
- print(f"CALL_RESULT:{result}")
-
- sys.exit(0)
- except Exception as e:
- import traceback
- print(f"ERROR:{e}")
- traceback.print_exc()
- sys.exit(1)
-
-if __name__ == "__main__":
- asyncio.run(main())
diff --git a/sam-mcp-python/tests/unit/test_unit.py b/sam-mcp-python/tests/unit/test_unit.py
deleted file mode 100644
index 71323f7c..00000000
--- a/sam-mcp-python/tests/unit/test_unit.py
+++ /dev/null
@@ -1,54 +0,0 @@
-import asyncio
-import pytest
-from unittest.mock import AsyncMock, MagicMock, patch
-from sam_mcp.client import SamClient
-from sam_mcp.adapters.langchain import get_langchain_tools
-
-# Client Tests
-async def test_client_get_tools():
- with patch("sam_mcp.client.streamable_http_client") as mock_sh_client, \
- patch("sam_mcp.client.ClientSession") as MockClientSession:
-
- mock_cm = AsyncMock()
- mock_sh_client.return_value = mock_cm
- mock_cm.__aenter__.return_value = (MagicMock(), MagicMock())
- mock_cm.__aexit__ = AsyncMock()
-
- mock_session = MockClientSession.return_value
- mock_session.__aenter__ = AsyncMock(return_value=mock_session)
- mock_session.__aexit__ = AsyncMock()
- mock_session.initialize = AsyncMock()
-
- mock_tool = MagicMock()
- mock_tool.name = "test_tool"
- mock_tool.model_dump.return_value = {"name": "test_tool", "inputSchema": {"type": "object"}}
-
- mock_resp = MagicMock()
- mock_resp.tools = [mock_tool]
- mock_session.list_tools = AsyncMock(return_value=mock_resp)
-
- async with SamClient(server_url="http://localhost:8080/mcp") as client:
- tools = await client.get_tools()
- assert len(tools) == 1
- assert tools[0]["name"] == "test_tool"
- mock_tool.model_dump.assert_called_once_with(by_alias=True, mode="json")
-
-# Adapter Tests
-def test_langchain_adapter():
- class MockClient:
- pass
-
- client = MockClient()
- tools = [{"name": "test_tool", "description": "A test tool"}]
-
- # We need to mock langchain-core and pydantic imports if they are not installed
- with patch.dict("sys.modules", {"langchain_core.tools": MagicMock(), "pydantic": MagicMock()}):
- from langchain_core.tools import StructuredTool
-
- mock_structured_tool = MagicMock()
- StructuredTool.from_function.return_value = mock_structured_tool
-
- lc_tools = get_langchain_tools(client, tools)
- assert len(lc_tools) == 1
- assert lc_tools[0] == mock_structured_tool
diff --git a/site/content/docs/guides/connecting-agents.md b/site/content/docs/guides/connecting-agents.md
index ea7c8b04..af08ddf4 100644
--- a/site/content/docs/guides/connecting-agents.md
+++ b/site/content/docs/guides/connecting-agents.md
@@ -207,11 +207,14 @@ async with streamable_http_client("http://127.0.0.1:8080/mcp", http_client=http)
tools = await session.list_tools()
```
-The repository's `sam-mcp-python` package wraps this in a `SamClient`.
-`sam-mcp-python/examples/gemini_agent.py` is a complete agent that maps the
-node's tools to Gemini function calls with the `google-genai` SDK. For
-inference, point any OpenAI SDK at `http://127.0.0.1:8080/v1` with the token
-as `api_key`, or at the socket with no key.
+`site/content/docs/snippets/agent_demo.py` in the repository is a complete
+version of this example. For inference, point any OpenAI SDK at
+`http://127.0.0.1:8080/v1` with the token as `api_key`, or at the socket with
+no key.
+
+Native SDKs that join the mesh from inside the agent process, without a
+`sam-node` sidecar, are being built under `sdk/` in the repository; see
+`sdk/README.md` for their status.
## A note on trust
diff --git a/site/content/docs/snippets/agent_demo.py b/site/content/docs/snippets/agent_demo.py
index 260038ca..54dfead1 100644
--- a/site/content/docs/snippets/agent_demo.py
+++ b/site/content/docs/snippets/agent_demo.py
@@ -1,31 +1,43 @@
import asyncio
import os
import sys
-from sam_mcp.client import SamClient
+
+import httpx
+from mcp import ClientSession
+from mcp.client.streamable_http import streamable_http_client
+
async def main():
- # Connect to the local SAM node's MCP SSE endpoint
- # By default, sam-node listens at 127.0.0.1:8080
+ # Connect to the local SAM node's MCP endpoint.
+ # By default, sam-node listens at 127.0.0.1:8080.
url = os.environ.get("SAM_MCP_URL", "http://127.0.0.1:8080/mcp")
+ token = os.environ.get("SAM_API_TOKEN", "")
print(f"Connecting to SAM Node at {url}")
+ headers = {"X-Sam-Authentication": f"Bearer {token}"} if token else {}
try:
- async with SamClient(server_url=url) as client:
- # Discover available tools provided by the SAM node
- tools = await client.get_tools()
- print(f"Discovered {len(tools)} tools:")
- for tool in tools:
- print(f" - {tool['name']}: {tool['description']}")
-
- # Call the get_mesh_info tool to get information about the mesh
- print("\nCalling get_mesh_info tool...")
- result = await client.call_tool("get_mesh_info", {})
- print("Result:")
- print(result)
+ async with httpx.AsyncClient(headers=headers) as http:
+ async with streamable_http_client(url, http_client=http) as (read, write):
+ async with ClientSession(read, write) as session:
+ await session.initialize()
+
+ # Discover available tools provided by the SAM node
+ tools = (await session.list_tools()).tools
+ print(f"Discovered {len(tools)} tools:")
+ for tool in tools:
+ print(f" - {tool.name}: {tool.description}")
+
+ # Call the get_mesh_info tool to get information about the mesh
+ print("\nCalling get_mesh_info tool...")
+ result = await session.call_tool("get_mesh_info", {})
+ print("Result:")
+ for block in result.content:
+ print(getattr(block, "text", block))
except Exception as e:
print(f"Error connecting to SAM Node: {e}")
sys.exit(1)
+
if __name__ == "__main__":
asyncio.run(main())
diff --git a/tests/e2e/docs_snippets.bats b/tests/e2e/docs_snippets.bats
index a8b79f7b..4dcb5b4e 100644
--- a/tests/e2e/docs_snippets.bats
+++ b/tests/e2e/docs_snippets.bats
@@ -29,13 +29,11 @@ teardown() {
# Run the agent_demo.py snippet inside a container
run docker run --rm \
--network "${MESH_NETWORK}" \
- -v "$(pwd)/sam-mcp-python:/sam-mcp-python" \
-v "$(pwd)/site/content/docs/snippets:/snippets" \
- -e PYTHONPATH=/sam-mcp-python/src \
-e SAM_MCP_URL="http://${node1_name}:8080/mcp" \
-e SAM_API_TOKEN="secret-token" \
python:3.12 \
- bash -c 'pip install mcp httpx && python3 /snippets/agent_demo.py'
+ bash -c 'pip install "mcp>=2,<3" httpx && python3 /snippets/agent_demo.py'
echo "agent_demo.py output: $output"
diff --git a/tests/e2e/python_sdk_test.bats b/tests/e2e/python_sdk_test.bats
deleted file mode 100644
index 79cb7c5c..00000000
--- a/tests/e2e/python_sdk_test.bats
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/env bats
-
-load "lib/container_mesh.bash"
-
-setup() {
- mesh_setup_env
-}
-
-teardown() {
- if [[ "${BATS_TEST_COMPLETED:-0}" -ne 1 ]]; then
- echo "Node 1 logs on failure (filtered):"
- docker logs "${MESH_PREFIX}-node-1" 2>&1 | grep -i -E 'mcp|request|error|fatal|panic' || true
- fi
- mesh_cleanup_env
-}
-
-@test "Python SDK: Connect, get tools, and call tool" {
- run mesh_start_mock_oidc
- [[ "$status" -eq 0 ]]
-
- run mesh_start_router
- [[ "$status" -eq 0 ]]
-
- run mesh_start_node 1 "--log-level debug"
- [[ "$status" -eq 0 ]]
-
- local node1_name="${MESH_PREFIX}-node-1"
- mesh_wait_for_mcp_ready 1 30
-
- # Use the Python SDK to interact with the node
- run docker run --rm \
- --network "${MESH_NETWORK}" \
- -v "$(pwd)/sam-mcp-python:/sam-mcp-python" \
- -e PYTHONPATH=/sam-mcp-python/src \
- -e SAM_API_TOKEN=secret-token \
- -e SAM_MCP_URL="http://${node1_name}:8080/mcp" \
- python:3.12 \
- bash -c 'pip install mcp httpx && python3 /sam-mcp-python/test_client.py'
- echo "Python SDK output: $output"
- if [[ "$status" -ne 0 ]]; then
- echo "Node 1 logs:"
- docker logs "${node1_name}"
- fi
- [[ "$status" -eq 0 ]]
- [[ "$output" == *"TOOLS_COUNT:"* ]]
- [[ "$output" == *"CALL_RESULT:"* ]]
-}