Repository navigation
Python: [Bug]: Claw step 3 sample fails to connect to Foundry Toolbox with mcp 2.x #9594
Description
Description
python/samples/02-agents/harness/build_your_own_claw/claw_step03_scaling_capabilities.py cannot connect to a Foundry Toolbox since the MCP 2.x migration (#9236). When FOUNDRY_TOOLBOX_ENDPOINT is set, _connect_foundry_toolbox() fails before the agent starts:
ValueError: not enough values to unpack (expected 3, got 2)
In mcp 2.x, mcp.client.streamable_http.streamable_http_client yields TransportStreams, which is (read_stream, write_stream). The sample still unpacks the 1.x three-tuple:
read, write, _ = await stack.enter_async_context(streamable_http_client(url=url, http_client=http_client))The sample also builds the client with httpx.AsyncClient, while mcp 2.x types http_client as httpx2.AsyncClient. The declarative invoke_foundry_toolbox_mcp sample was already moved to import httpx2 as httpx for this reason.
harness is in SAMPLE_TYPING_EXCLUDES, so the samples type-check sweep does not catch it. Pyright on the file reports both problems (Tuple size mismatch; expected 3 but received 2 and "httpx._client.AsyncClient" is not assignable to "httpx2._client.AsyncClient").
Reproduction
I ran the sample's own _connect_foundry_toolbox() against a local mcp 2.3.0 MCPServer served over streamable HTTP, with the token provider stubbed:
| result | |
|---|---|
main |
ValueError: not enough values to unpack (expected 3, got 2) |
unpack two values + httpx2 client |
session initializes, list_tools() returns the server's tools |
Expected behavior
Step 3 connects to the Foundry Toolbox MCP endpoint and loads its skills.
Proposed fix
Unpack read, write = ..., and import httpx2 as httpx (with the PEP 723 dependency changed from httpx to httpx2), matching the declarative toolbox sample. I have a PR ready.
Package Versions
agent-framework-core from main at 8be57da, mcp 2.3.0.
Python Version
3.13
AI Assistance
Claude Code helped find the breakage (by type-checking excluded samples), build the local MCP server reproduction, and draft this report. I verified the reproduction locally.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
github-actions commentedon Oct 22, 2026
🤖 Automated triage reproduction notes (agent-authored — trust but verify)
Agent analysis
The bug is in
python/samples/02-agents/harness/build_your_own_claw/claw_step03_scaling_capabilities.py::_connect_foundry_toolboxat line 228, where enablingFOUNDRY_TOOLBOX_MCP_SERVER_URLcauses a three-value unpack of MCP 2.x’s two-value transport streams. Minimal repro: invoke_connect_foundry_toolbox()with MCP 2.3.0 or an async transport context yielding(read_stream, write_stream)and observe theValueErrorbeforeClientSessionconstruction.python/tests/samples/harness/test_claw_step03_foundry_toolbox.pymcp 2.3.0