Skip to content

Commit 8f8f7f4

Browse files
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

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ dependencies = [
2828
"anyio>=4.0.0",
2929
"sniffio>=1.0.0",
3030
"typing_extensions>=4.0.0; python_version<'3.11'",
31-
"mcp>=0.1.0",
31+
"mcp>=1.19.0",
3232
]
3333

3434
[project.optional-dependencies]

0 commit comments

Comments
 (0)