OptionalauthAn OAuth client provider to use for authentication.
When an authProvider is specified and the connection is started:
authProvider.authProvider is used to refresh the token.OAuthClientProvider.redirectToAuthorization is called, and an UnauthorizedError will be thrown from connect/start.After the user has finished authorizing via their user agent, and is redirected back to the MCP client application, call StreamableHTTPClientTransport.finishAuth with the authorization code before retrying the connection.
If an authProvider is not provided, and auth is required, an UnauthorizedError will be thrown.
UnauthorizedError might also be thrown when sending any message over the transport, indicating that the session has expired, and needs to be re-authed and reconnected.
OptionalreconnectionOptions to configure the reconnection behavior.
OptionalrequestCustomizes HTTP requests to the server.
OptionalsessionSession 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.
Configuration options for the
StreamableHTTPClientTransport.