[FEATURE] Expose MCP "notifications/cancelled" to the LLM
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
I have a long-running tool call. I would like to conversationally ask claude-code to "run tool X, but let's give up if it doesn't finish within 5 minutes". It doesn't seem capable of engaging with such a request.
When asked about why, it provides some details:
No, I cannot cancel or timeout MCP tool calls once they've started. Here's why:
MCP Tools (like X):
- Execute synchronously and block until completion
- No cancellation mechanism available
- No timeout parameter in the tool definition
- I must wait for them to complete or error out
This is different from Bash commands:
- Bash tool has run_in_background parameter
- Can monitor with BashOutput tool
- Can kill with KillShell tool
- Has configurable timeout (up to 10 minutes)
And yet in the MCP spec we see there's a cancellation API:
When a party wants to cancel an in-progress request, it sends a notifications/cancelled notification containing:
* The ID of the request to cancel
* An optional reason string that can be logged or displayed
I also observe that when I interrupt using the escape key, the request does cancel (though I haven't confirmed the mechanism), so this seems generally possible.
Proposed Solution
I'd like to enable claude-code to reason about long running MCP tool calls similarly to how it can reason about long-running bash commands.
Alternative Solutions
No response
Priority
Medium - Would be very helpful
Feature Category
MCP server integration
Use Case Example
No response
Additional Context
No response
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.