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