Skip to content

Commit 023e171

Browse files
declan-scaleclaude
andcommitted
fix(tutorials): pin mcp<2 for uvx-spawned MCP servers in 020_state_machine
mcp 2.0.0 renamed `McpError` to `MCPError` and split types out into a separate `mcp_types` package. `mcp-server-time` and `mcp-server-fetch` still import the 1.x name, so both now die at import: ImportError: cannot import name 'McpError' from 'mcp.shared.exceptions' ... -> mcp.shared.exceptions.McpError: Connection closed uvx builds each server its own isolated environment and resolves `mcp` unpinned there, so the `mcp==1.23.0` this project installs does not apply. With every server dead the deep research agent emits "Starting deep research..." and then makes zero tool calls, so test_agent.py's `uses_tool_requests` assertion fails (and the streaming test times out waiting for the same content). This is why the job passed at 03:48 today and failed at 14:08 with no code change in between: mcp 2.0.0 landed in the gap. Constraining uvx to mcp<2 restores all three servers. Verified by completing an MCP initialize + tools/list handshake against the exact argv this file now produces: mcp-server-time tools=['get_current_time', 'convert_time'] openai-websearch-mcp tools=['openai_web_search'] mcp-server-fetch tools=['fetch'] The 30s test timeout is left alone; both tests passed in 21.1s total when the servers worked. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent acbb9d4 commit 023e171

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

examples/tutorials/10_async/10_temporal/020_state_machine/project/workflows/deep_research/performing_deep_research.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,28 @@
1313

1414
logger = make_logger(__name__)
1515

16+
# These reference MCP servers still import the mcp 1.x API (``McpError``), which
17+
# mcp 2.0.0 renamed to ``MCPError``. uvx gives each server its own isolated env and
18+
# resolves ``mcp`` unpinned there, ignoring the version this project pins, so without
19+
# this constraint every server dies at import and the agent silently makes zero tool
20+
# calls. Drop the pin once the servers support mcp 2.x.
21+
_MCP_PIN = ["--with", "mcp<2"]
22+
1623
MCP_SERVERS = [
1724
StdioServerParameters(
1825
command="uvx",
19-
args=["mcp-server-time", "--local-timezone", "America/Los_Angeles"],
26+
args=[*_MCP_PIN, "mcp-server-time", "--local-timezone", "America/Los_Angeles"],
2027
),
2128
StdioServerParameters(
2229
command="uvx",
23-
args=["openai-websearch-mcp"],
30+
args=[*_MCP_PIN, "openai-websearch-mcp"],
2431
env={
2532
"OPENAI_API_KEY": os.environ.get("OPENAI_API_KEY", "")
2633
}
2734
),
2835
StdioServerParameters(
2936
command="uvx",
30-
args=["mcp-server-fetch"],
37+
args=[*_MCP_PIN, "mcp-server-fetch"],
3138
),
3239
]
3340

0 commit comments

Comments
 (0)