Table of Contents

Class StdioTransport

Namespace
Mythosia.AI.Mcp.Transports
Assembly
Mythosia.AI.Mcp.dll

MCP transport over stdio โ€” launches a child process and communicates via stdin/stdout.

public sealed class StdioTransport : IMcpTransport, IAsyncDisposable
Inheritance
StdioTransport
Implements
Inherited Members

Constructors

StdioTransport(string, string?, string?, Dictionary<string, string>?)

Creates and starts a stdio transport with the given command and arguments.

public StdioTransport(string command, string? args = null, string? workingDirectory = null, Dictionary<string, string>? environmentVariables = null)

Parameters

command string

The executable to launch (e.g., "npx", "python", "node").

args string

Arguments to pass to the executable.

workingDirectory string

Optional working directory for the process.

environmentVariables Dictionary<string, string>

Optional additional environment variables.

Properties

IsConnected

Whether the transport is connected and operational

public bool IsConnected { get; }

Property Value

bool

Methods

DisposeAsync()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

public ValueTask DisposeAsync()

Returns

ValueTask

A task that represents the asynchronous dispose operation.

ReceiveAsync(CancellationToken)

Reads the next JSON message from the MCP server

public Task<string?> ReceiveAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task<string>

SendAsync(string, CancellationToken)

Sends a JSON message to the MCP server

public Task SendAsync(string json, CancellationToken cancellationToken = default)

Parameters

json string
cancellationToken CancellationToken

Returns

Task