Commit 399b743
authored
fix(mcp): restore compatibility with mcp 2.x (kyegomez#2128)
requirements.txt now allows mcp 2.x (kyegomez#2108), which renamed several
attributes. Three sites still read the 1.x spellings, and because they
all used getattr with a default, two of them failed silently rather
than raising.
- CallToolResult.isError -> is_error. The old name now always fell
through to the default, so every failed MCP tool call was reported to
the agent as a success.
- CallToolResult.structuredContent -> structured_content, same
silent-fallthrough shape.
- OAuthClientProvider dropped its timeout kwarg in 2.x, so building an
OAuth provider raised TypeError. The wait stays bounded because
callback_handler already closes over oauth.callback_timeout.
_mcp_tool_to_openai already handled inputSchema -> input_schema this
way; these sites were missed.
The test fixture server imported mcp.server.fastmcp, removed in 2.x,
so it could not start at all -- 28 tests errored in setup. FastMCP is
now MCPServer, behind a shim that still works on 1.x.
test_api_key_server_rejects_wrong_key asserted "401" in the error.
Rejection still works, but 2.x collapses every non-404 non-2xx response
into ErrorData(INTERNAL_ERROR, "Server returned an error response")
before it reaches us, so the status is unrecoverable. The assertion is
now version-gated rather than dropped: 1.x still requires the status.
tests/tools/test_mcp_manager.py: 85 passed (was 2 failed, 28 errors).
The 6 remaining failures in tests/tools/ are in test_base_tool.py and
test_parse_tools.py, and fail identically on unmodified master.1 parent 9f37b18 commit 399b743
3 files changed
Lines changed: 52 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1084 | 1084 | | |
1085 | 1085 | | |
1086 | 1086 | | |
1087 | | - | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
1088 | 1093 | | |
1089 | 1094 | | |
1090 | 1095 | | |
| |||
1144 | 1149 | | |
1145 | 1150 | | |
1146 | 1151 | | |
1147 | | - | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
1148 | 1156 | | |
1149 | 1157 | | |
1150 | 1158 | | |
| |||
1408 | 1416 | | |
1409 | 1417 | | |
1410 | 1418 | | |
1411 | | - | |
1412 | | - | |
1413 | | - | |
1414 | | - | |
1415 | | - | |
1416 | | - | |
1417 | | - | |
1418 | | - | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
1419 | 1431 | | |
1420 | 1432 | | |
1421 | 1433 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | 19 | | |
21 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
22 | 39 | | |
23 | 40 | | |
24 | 41 | | |
25 | 42 | | |
26 | 43 | | |
27 | | - | |
| 44 | + | |
28 | 45 | | |
29 | 46 | | |
30 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
527 | 528 | | |
528 | 529 | | |
529 | 530 | | |
530 | | - | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
531 | 541 | | |
532 | 542 | | |
533 | 543 | | |
| |||
0 commit comments