Package com.tnsai.mcp.client
Class StreamableHttpTransport.Builder
java.lang.Object
com.tnsai.mcp.client.StreamableHttpTransport.Builder
- Enclosing class:
StreamableHttpTransport
Builder for StreamableHttpTransport.
-
Method Summary
Modifier and TypeMethodDescriptionSets the API key for Bearer authentication.build()Builds the StreamableHttpTransport instance.Sets the MCP server endpoint URL.Sets custom headers for all requests.Sets the request timeout.
-
Method Details
-
endpoint
Sets the MCP server endpoint URL.- Parameters:
endpoint- the 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. This merges with any existing custom headers rather than replacing them.- Parameters:
apiKey- the API key- Returns:
- this builder
-
timeout
Sets the request timeout.- Parameters:
timeout- the timeout duration- Returns:
- this builder
-
build
Builds the StreamableHttpTransport instance.- Returns:
- a new StreamableHttpTransport
- Throws:
IllegalArgumentException- if endpoint is not set
-