@modelcontextprotocol/sdk
    Preparing search index...

    Class StdioClientTransport

    Client transport for stdio: this will connect to a server by spawning a process and communicating with it over stdin/stdout.

    This transport is only available in Node.js environments.

    Implements

    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    Properties

    onclose?: () => void

    Callback for when the connection is closed for any reason.

    This should be invoked when close() is called as well.

    onerror?: (error: Error) => void

    Callback for when an error occurs.

    Note that errors are not necessarily fatal; they are used for reporting any kind of exceptional condition out of band.

    onmessage?: (message: JSONRPCMessage) => void

    Callback for when a message (request or response) is received over the connection.

    Includes the requestInfo and authInfo if the transport is authenticated.

    The requestInfo can be used to get the original request information (headers, etc.)

    Accessors

    • get pid(): number | null

      The child process pid spawned by this transport.

      This is only available after the transport has been started.

      Returns number | null

    • get stderr(): Stream | null

      The stderr stream of the child process, if StdioServerParameters.stderr was set to "pipe" or "overlapped".

      If stderr piping was requested, a PassThrough stream is returned immediately, allowing callers to attach listeners before the start method is invoked. This prevents loss of any early error output emitted by the child process.

      Returns Stream | null

    Methods

    • Sends a JSON-RPC message (request or response).

      If present, relatedRequestId is used to indicate to the transport which incoming request to associate this outgoing message with.

      Parameters

      Returns Promise<void>