文件历史

提交图

4 次代码提交

作者 SHA1 备注 提交日期
tjb-tech 373147907a test(mcp): use built-in exception groups on Python 3.11 2026-05-06 10:17:11 +00:00
Litianhui888 a98292b814 fix(mcp): isolate startup from failed servers
Treat per-server initialization cancellation as a connection failure instead of aborting overall startup, and suppress cleanup-time exception groups from half-open MCP sessions.
2026-05-06 10:13:35 +08:00
tjb-tech c6cc66c872 fix(mcp): tolerate tool-only servers and stdio cleanup errors 2026-04-08 13:54:54 +00:00
José Maia 050035e345 fix(mcp): handle disconnected server in call_tool and read_resource
call_tool() and read_resource() access self._sessions[server_name]
directly, which raises a raw KeyError if the MCP server failed to
connect, disconnected, or was cleared by close()/reconnect_all().

Replace bare dict access with .get() and raise a descriptive
McpServerNotConnectedError that includes the server's failure detail.
Also wrap session.call_tool()/read_resource() to catch transport-level
errors (broken pipe, closed connection) and surface them as the same
exception type.

McpToolAdapter and ReadMcpResourceTool now catch this error and return
ToolResult(is_error=True) so the model receives a clean error message
instead of crashing the turn.
2026-04-06 19:35:11 +01:00