Commit 8f8f7f4
authored
fix(deps): require mcp>=1.19.0 for in-process SDK MCP tools (#891)
## Problem
`create_sdk_mcp_server` tool handlers have returned `CallToolResult`
objects since v0.1.51 (PR #717). The `mcp` package's
`@server.call_tool()` decorator only accepts `CallToolResult` returns
from `mcp>=1.19.0`. With older versions it falls through the iterable
branch (pydantic models iterate as `(field, value)` tuples), fails
validation, and swallows the result into `_make_error_result(str(e))`.
Effect: in-process SDK MCP tools run their handler, but the model
receives a ~5KB pydantic "20 validation errors for CallToolResult" blob
with `is_error=True` instead of the actual output. Silent data loss.
This only bites users who `pip install -U claude-agent-sdk` in an
existing env — fresh installs pull latest `mcp` and work fine.
stdio/HTTP/SSE MCP servers are unaffected.
## Fix
Bump the floor: `mcp>=0.1.0` → `mcp>=1.19.0`.
## Verification
Boundary-tested with a direct `request_handlers[CallToolRequest]` repro:
| mcp version | result |
|---|---|
| 1.12.4 | ❌ `isError: True`, validation error blob |
| 1.18.0 | ❌ `isError: True`, validation error blob |
| **1.19.0** | ✅ `isError: False`, tool output returned |
| 1.27.0 | ✅ `isError: False`, tool output returned |
- `pip install -e . 'mcp==1.12.4'` → `ResolutionImpossible` (pin
enforced)
- Full `ClaudeSDKClient` e2e with `create_sdk_mcp_server`: tool result
reaches the model
- `pytest`: 755 passed, 3 skipped · `mypy`: clean · `ruff`: clean
Reported internally.1 parent 3600dd0 commit 8f8f7f4
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
0 commit comments