Table of Contents

Method CloseAsync

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

CloseAsync(CancellationToken)

Closes the transport connection gracefully.

Task CloseAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to cancel the close operation.

Returns

Task

A task representing the asynchronous close operation.

Remarks

For stdio transport, this terminates the subprocess. For HTTP transport, this cancels any pending requests and closes the SSE connection if active.

This method is idempotent: calling it when already closed has no effect. After closing, the transport can potentially be reconnected by calling ConnectAsync(CancellationToken).