Package com.tnsai.mcp.client
Class SSETransport.Builder
java.lang.Object
com.tnsai.mcp.client.SSETransport.Builder
- Enclosing class:
SSETransport
Builder for SSETransport.
-
Method Summary
Modifier and TypeMethodDescriptionSets the API key for Bearer authentication.build()Builds the SSETransport instance.connectTimeout(Duration connectTimeout) Sets the connection timeout.Sets custom headers for all requests.initialRetryDelay(Duration initialRetryDelay) Sets the initial retry delay for reconnection.maxRetries(int maxRetries) Sets the maximum number of reconnection attempts.maxRetryDelay(Duration maxRetryDelay) Sets the maximum retry delay for reconnection.messageEndpoint(String messageEndpoint) Sets the message endpoint URL for sending messages.readTimeout(Duration readTimeout) Sets the read timeout for SSE stream.sseEndpoint(String sseEndpoint) Sets the SSE endpoint URL for receiving events.
-
Method Details
-
sseEndpoint
Sets the SSE endpoint URL for receiving events.- Parameters:
sseEndpoint- the SSE endpoint URL- Returns:
- this builder
-
messageEndpoint
Sets the message endpoint URL for sending messages.- Parameters:
messageEndpoint- the message endpoint URL- Returns:
- this builder
-
headers
Sets custom headers for all requests.- Parameters:
headers- the headers map- Returns:
- this builder
-
apiKey
Sets the API key for Bearer authentication.- Parameters:
apiKey- the API key- Returns:
- this builder
-
connectTimeout
Sets the connection timeout.- Parameters:
connectTimeout- the timeout duration- Returns:
- this builder
-
readTimeout
Sets the read timeout for SSE stream.- Parameters:
readTimeout- the timeout duration- Returns:
- this builder
-
maxRetries
Sets the maximum number of reconnection attempts.- Parameters:
maxRetries- the max retry count- Returns:
- this builder
-
initialRetryDelay
Sets the initial retry delay for reconnection.- Parameters:
initialRetryDelay- the initial delay- Returns:
- this builder
-
maxRetryDelay
Sets the maximum retry delay for reconnection.- Parameters:
maxRetryDelay- the max delay- Returns:
- this builder
-
build
Builds the SSETransport instance.- Returns:
- a new SSETransport
- Throws:
IllegalArgumentException- if sseEndpoint is not set
-