Skip to content

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

Closed
@AArnott

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).

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