Table of Contents

Method ConnectAsync

Namespace
LMKit.Mcp.Transport
Assembly
LM-Kit.NET.dll

ConnectAsync(CancellationToken)

Establishes the transport connection asynchronously.

public Task ConnectAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to cancel the connection attempt.

Returns

Task

A task representing the asynchronous connection operation.

Remarks

For stdio transport, this starts the subprocess. For HTTP transport, this may be a no-op since HTTP is connectionless (connection is established per-request).

This method is idempotent: calling it when already connected has no effect.

Exceptions

McpTransportException

Thrown when the connection cannot be established.

OperationCanceledException

Thrown when the operation is canceled.