StdioMcpTransport
Namespace: Vercel.AI.Mcp
public sealed class StdioMcpTransport : IMcpTransport, IDisposableMCP over a child process using newline-delimited JSON-RPC messages.
Inheritance: object
Implements: IMcpTransport, IDisposable
Properties
Section titled “Properties”ProcessId
Section titled “ProcessId”public int ProcessId { get; }Child process id.
Value: int
StandardError
Section titled “StandardError”public StreamReader? StandardError { get; }The child’s stderr, when RedirectStandardError is true.
Value: StreamReader
Methods
Section titled “Methods”CallAsync(string, JsonElement, CancellationToken)
Section titled “CallAsync(string, JsonElement, CancellationToken)”public Task<JsonElement> CallAsync(string method, JsonElement parameters, CancellationToken cancellationToken)Calls <code class=“paramref”>method</code> and returns the JSON-RPC result.
Parameters
| Name | Type | Description |
|---|---|---|
method |
string | |
parameters |
JsonElement | |
cancellationToken |
CancellationToken |
Returns: Task<JsonElement>
CreateStartInfo(StdioMcpOptions)
Section titled “CreateStartInfo(StdioMcpOptions)”public static ProcessStartInfo CreateStartInfo(StdioMcpOptions options)Builds the process start info. The environment is replaced by Boolean%7d),
so the child does not inherit every variable of this process.
Parameters
| Name | Type | Description |
|---|---|---|
options |
StdioMcpOptions |
Returns: ProcessStartInfo
Dispose()
Section titled “Dispose()”public void Dispose()Kills the child process, if one was started.
Start(string, IReadOnlyList<string>?)
Section titled “Start(string, IReadOnlyList<string>?)”public static StdioMcpTransport Start(string fileName, IReadOnlyList<string>? arguments = null)Starts <code class=“paramref”>fileName</code> and speaks MCP on its stdin and stdout.
Parameters
| Name | Type | Description |
|---|---|---|
fileName |
string | |
arguments |
IReadOnlyList<string> |
Returns: StdioMcpTransport
Start(StdioMcpOptions)
Section titled “Start(StdioMcpOptions)”public static StdioMcpTransport Start(StdioMcpOptions options)Starts the server described by <code class=“paramref”>options</code>.
Parameters
| Name | Type | Description |
|---|---|---|
options |
StdioMcpOptions |
Returns: StdioMcpTransport
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product