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

    Configuration options for the StreamableHTTPClientTransport.

    type StreamableHTTPClientTransportOptions = {
        authProvider?: AuthProvider | OAuthClientProvider;
        fetch?: FetchLike;
        protocolVersion?: string;
        reconnectionOptions?: StreamableHTTPReconnectionOptions;
        reconnectionScheduler?: ReconnectionScheduler;
        requestInit?: RequestInit;
        sessionId?: string;
    }
    Index

    Properties

    An OAuth client provider to use for authentication.

    token() is called before every request to obtain the bearer token. When the server responds with 401, onUnauthorized() is called (if provided) to refresh credentials, then the request is retried once. If the retry also gets 401, or onUnauthorized is not provided, UnauthorizedError is thrown.

    For simple bearer tokens: { token: async () => myApiKey }.

    For OAuth flows, pass an OAuthClientProvider implementation directly — the transport adapts it to AuthProvider internally. Interactive flows: after UnauthorizedError, redirect the user, then call finishAuth with the authorization code before reconnecting.

    fetch?: FetchLike

    Custom fetch implementation used for all network requests.

    protocolVersion?: string

    The MCP protocol version to include in the mcp-protocol-version header on all requests. When reconnecting with a preserved sessionId, set this to the version negotiated during the original handshake so the reconnected transport continues sending the required header.

    reconnectionOptions?: StreamableHTTPReconnectionOptions

    Options to configure the reconnection behavior.

    reconnectionScheduler?: ReconnectionScheduler

    Custom scheduler for reconnection attempts. If not provided, setTimeout is used. See ReconnectionScheduler.

    requestInit?: RequestInit

    Customizes HTTP requests to the server.

    sessionId?: string

    Session ID for the connection. This is used to identify the session on the server. When not provided and connecting to a server that supports session IDs, the server will generate a new session ID.