The Model Context Protocol (MCP) supports optional cancellation of in-progress requests through notification messages. Either side can send a cancellation notification to indicate that a previously-issued request should be terminated.
When a party wants to cancel an in-progress request, it sends a notifications/cancelled
notification containing:
initialize
request MUST NOT be cancelled by clientsDue to network latency, cancellation notifications may arrive after request processing has completed, and potentially after a response has already been sent.
Both parties MUST handle these race conditions gracefully:
Invalid cancellation notifications SHOULD be ignored:
This maintains the “fire and forget” nature of notifications while allowing for race conditions in asynchronous communication.
The Model Context Protocol (MCP) supports optional cancellation of in-progress requests through notification messages. Either side can send a cancellation notification to indicate that a previously-issued request should be terminated.
When a party wants to cancel an in-progress request, it sends a notifications/cancelled
notification containing:
initialize
request MUST NOT be cancelled by clientsDue to network latency, cancellation notifications may arrive after request processing has completed, and potentially after a response has already been sent.
Both parties MUST handle these race conditions gracefully:
Invalid cancellation notifications SHOULD be ignored:
This maintains the “fire and forget” nature of notifications while allowing for race conditions in asynchronous communication.