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
commandstringThe executable to launch (e.g., "npx", "python", "node").
argsstringArguments to pass to the executable.
workingDirectorystringOptional working directory for the process.
environmentVariablesDictionary<string, string>Optional additional environment variables.
Properties
IsConnected
Whether the transport is connected and operational
public bool IsConnected { get; }
Property Value
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
cancellationTokenCancellationToken
Returns
SendAsync(string, CancellationToken)
Sends a JSON message to the MCP server
public Task SendAsync(string json, CancellationToken cancellationToken = default)
Parameters
jsonstringcancellationTokenCancellationToken