Files
`src/services/mcp/client.py`, `src/services/mcp/transport.py`, `src/tool_system/tools/mcp_tool_wrapper.py` (or equivalent)
Background
PR #135 explicitly defers MCP cancellation:
MCP tools: out-of-process JSON-RPC; transport-level cancellation is a cross-cutting change across the entire MCP client.
Verification
`grep -rn abort_controller src/services/mcp/` returns nothing on HEAD `e1832a0`. JSON-RPC requests block until the upstream server replies (or hits its own timeout).
Impact
A user running a slow MCP tool (e.g. a database query, a remote API call exposed by a plugin) cannot cancel mid-call. If the server hangs or is slow to respond, the REPL hangs with it until the (often generous) MCP request timeout. ESC has no effect on the in-flight call.
Fix sketch
JSON-RPC 2.0 supports `$/cancelRequest` (per LSP/MCP convention). Plumb the abort signal through `McpClient.call_tool`:
- Track the in-flight request id per call.
- On abort, send `$/cancelRequest` with that id.
- Return an `AbortError` from the call without waiting for the server's response.
Servers that ignore the cancel notification still leak a request server-side, but the client unblocks immediately. Cover with a fake-MCP-server regression test that pins the cancellation latency.
Files
`src/services/mcp/client.py`, `src/services/mcp/transport.py`, `src/tool_system/tools/mcp_tool_wrapper.py` (or equivalent)
Background
PR #135 explicitly defers MCP cancellation:
Verification
`grep -rn abort_controller src/services/mcp/` returns nothing on HEAD `e1832a0`. JSON-RPC requests block until the upstream server replies (or hits its own timeout).
Impact
A user running a slow MCP tool (e.g. a database query, a remote API call exposed by a plugin) cannot cancel mid-call. If the server hangs or is slow to respond, the REPL hangs with it until the (often generous) MCP request timeout. ESC has no effect on the in-flight call.
Fix sketch
JSON-RPC 2.0 supports `$/cancelRequest` (per LSP/MCP convention). Plumb the abort signal through `McpClient.call_tool`:
Servers that ignore the cancel notification still leak a request server-side, but the client unblocks immediately. Cover with a fake-MCP-server regression test that pins the cancellation latency.