Commit 99cb442
committed
fix(mcp): pass timedelta to streamablehttp_client for old-SDK compat (codex P2)
Codex P2 review on #72: streamablehttp_client's timeout signature
drifted between mcp SDK releases. 1.8 / 1.9-era releases required
``datetime.timedelta`` and dereferenced ``.total_seconds()`` on the
value, so passing the loader's raw ``float`` raises ``AttributeError``
before discovery initializes. ~1.10+ widened the type to
``float | timedelta``, and the modern signature still happily accepts
``timedelta``.
Since cubepi's mcp floor is ``mcp>=1.0``, supporting only the modern
shape would silently break legitimate installs that pin an older
1.x SDK. Convert the timeout to a ``timedelta`` for streamable_http so
the loader works on every advertised mcp version. ``sse_client``'s
signature is unchanged across versions (always ``float``), so the
SSE branch is left alone.
Test: updated the streamable_transport regression test to assert the
recorded sh_calls receive ``timedelta`` values rather than raw floats.1 parent 9eeee29 commit 99cb442
2 files changed
Lines changed: 17 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
37 | 44 | | |
38 | 45 | | |
39 | 46 | | |
40 | | - | |
41 | | - | |
| 47 | + | |
| 48 | + | |
42 | 49 | | |
43 | 50 | | |
44 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
283 | 289 | | |
284 | 290 | | |
285 | 291 | | |
286 | | - | |
287 | | - | |
| 292 | + | |
| 293 | + | |
288 | 294 | | |
289 | 295 | | |
290 | 296 | | |
| |||
0 commit comments