MCP TypeScript SDK (V2)
    Preparing search index...

    Server transport for stdio: this communicates with an MCP client by reading from the current process' stdin and writing to stdout.

    This transport is only available in Node.js environments.

    const server = new McpServer({ name: 'my-server', version: '1.0.0' });
    const transport = new StdioServerTransport();
    await server.connect(transport);

    Implements

    Index

    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.)

    Methods