Class SSETransport.Builder

java.lang.Object
com.tnsai.mcp.client.SSETransport.Builder
Enclosing class:
SSETransport

public static class SSETransport.Builder extends Object
Builder for SSETransport.
  • Method Details

    • sseEndpoint

      public SSETransport.Builder sseEndpoint(String sseEndpoint)
      Sets the SSE endpoint URL for receiving events.
      Parameters:
      sseEndpoint - the SSE endpoint URL
      Returns:
      this builder
    • messageEndpoint

      public SSETransport.Builder messageEndpoint(String messageEndpoint)
      Sets the message endpoint URL for sending messages.
      Parameters:
      messageEndpoint - the message endpoint URL
      Returns:
      this builder
    • headers

      public SSETransport.Builder headers(Map<String,String> headers)
      Sets custom headers for all requests.
      Parameters:
      headers - the headers map
      Returns:
      this builder
    • apiKey

      public SSETransport.Builder apiKey(String apiKey)
      Sets the API key for Bearer authentication.
      Parameters:
      apiKey - the API key
      Returns:
      this builder
    • connectTimeout

      public SSETransport.Builder connectTimeout(Duration connectTimeout)
      Sets the connection timeout.
      Parameters:
      connectTimeout - the timeout duration
      Returns:
      this builder
    • readTimeout

      public SSETransport.Builder readTimeout(Duration readTimeout)
      Sets the read timeout for SSE stream.
      Parameters:
      readTimeout - the timeout duration
      Returns:
      this builder
    • maxRetries

      public SSETransport.Builder maxRetries(int maxRetries)
      Sets the maximum number of reconnection attempts.
      Parameters:
      maxRetries - the max retry count
      Returns:
      this builder
    • initialRetryDelay

      public SSETransport.Builder initialRetryDelay(Duration initialRetryDelay)
      Sets the initial retry delay for reconnection.
      Parameters:
      initialRetryDelay - the initial delay
      Returns:
      this builder
    • maxRetryDelay

      public SSETransport.Builder maxRetryDelay(Duration maxRetryDelay)
      Sets the maximum retry delay for reconnection.
      Parameters:
      maxRetryDelay - the max delay
      Returns:
      this builder
    • build

      public SSETransport build()
      Builds the SSETransport instance.
      Returns:
      a new SSETransport
      Throws:
      IllegalArgumentException - if sseEndpoint is not set