Class StdioMcpClient
Stdio transport — spawns an external process, exchanges newline-delimited
UTF-8 JSON-RPC frames over stdin/stdout, drains stderr to the logger.
All stdin writes are serialised through a .
public sealed class StdioMcpClient : McpClientBase, IMcpClient, IAsyncDisposable
Inheritance
Implements
Inherited Members
McpClientBase.CallToolAsync(string, JsonNode?, CancellationToken),McpClientBase.DisposeAsync(),McpClientBase.Initialize,McpClientBase.InitializeAsync(CancellationToken),McpClientBase.ListToolsAsync(CancellationToken),McpClientBase.Logger,McpClientBase.OnFrameReceived(string),McpClientBase.OnTransportFailed(string?),McpClientBase.SendFrameAsync(string, CancellationToken),McpClientBase.ServerName,McpClientBase.StartTransportAsync(CancellationToken),McpClientBase.Status,McpClientBase.StopTransportAsync()
Methods
SendFrameAsync(string, CancellationToken)
Writes a single JSON frame to the server. Implementations must serialize concurrent writes.
protected override Task SendFrameAsync(string frameJson, CancellationToken cancellationToken)
StartTransportAsync(CancellationToken)
Brings up the byte-level transport (e.g. spawn process, open HTTP/SSE channels).
protected override Task StartTransportAsync(CancellationToken cancellationToken)
StopTransportAsync()
Tears the transport down. Should not throw on already-stopped state.
protected override Task StopTransportAsync()
Constructors
StdioMcpClient(string, McpTransport, ILogger)
Creates a new stdio MCP client.