Skip to content

Copilot CLI should send MCP cancellation requests #4759

Description

@rroesch1

Summary

Copilot CLI does not send an MCP cancellation request when a tool call is
waiting for an in-flight URL-mode elicitation to complete. If the user
cancels the tool call while the authentication browser flow is pending, the
MCP server remains blocked until the elicitation or authentication flow
eventually returns.

Steps to reproduce

  1. Start an MCP server that uses URL-mode elicitation for authentication.
  2. Invoke a tool that triggers authentication.
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"_meta":{"progressToken":1},"name":"foo","arguments":{}}}
  1. Accept the Elicitation Request
{"jsonrpc":"2.0","id":1,"result":{"action":"accept"}
  1. Cancel the tool call from Copilot CLI without finishing the authentication flow in the browser

Actual behavior

  • Copilot CLI does not send an MCP cancellation request for the pending tool call.
  • The server-side elicitation remains in flight.
  • The tool call does not terminate promptly after the user cancels it.
  • The server can remain blocked until the authentication flow's timeout

Expected behavior

When the user cancels the tool call, Copilot CLI should send an MCP
cancellation request for the associated in-flight request, as specified by
the MCP cancellation protocol. The server should then observe cancellation
through the request context and promptly terminate the pending elicitation and
tool call.

Impact

We have an MCP server that synchronizes elicitation requests to ensure that parallel tool calls do not trigger the same authentication flow multiple times.

If the user cancels the authentication flow (for example, by canceling the tool call), the server cannot release the synchronization lock because the client does not send an MCP cancellation request. As a result, the pending elicitation remains blocked, and all subsequent tool calls that require the same lock are also blocked until the authentication flow eventually times out or completes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions