Skip to content

McpClientFactory.CreateAsync incorrectly claims "Initialization timed out" #325

Description

@AArnott

Describe the bug

When the CancellationToken passed to McpClientFactory.CreateAsync in canceled before the method completes, it throws an ModelContextProtocol.McpException with the message "Initialization timed out".

This doesn't conform to .NET conventions.

To Reproduce

IMcpClient client = await McpClientFactory.CreateAsync(
   configuration.CreateClientTransport(id),
   clientOptions,
   cancellationToken: new CancellationToken(true));

Expected behavior

I expect an OperationCanceledException that merely expresses the operation is canceled -- not that something timed out (as there was in fact no timer).

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions