Class WebFluxStreamableServerTransportProvider.Builder

java.lang.Object
io.modelcontextprotocol.server.transport.WebFluxStreamableServerTransportProvider.Builder
Enclosing class:
WebFluxStreamableServerTransportProvider

public static class WebFluxStreamableServerTransportProvider.Builder extends Object
Builder for creating instances of WebFluxStreamableServerTransportProvider.

This builder provides a fluent API for configuring and creating instances of WebFluxStreamableServerTransportProvider with custom settings.

  • Method Details

    • jsonMapper

      public WebFluxStreamableServerTransportProvider.Builder jsonMapper(io.modelcontextprotocol.json.McpJsonMapper jsonMapper)
      Sets the McpJsonMapper to use for JSON serialization/deserialization of MCP messages.
      Parameters:
      jsonMapper - The McpJsonMapper instance. Must not be null.
      Returns:
      this builder instance
      Throws:
      IllegalArgumentException - if jsonMapper is null
    • messageEndpoint

      public WebFluxStreamableServerTransportProvider.Builder messageEndpoint(String messageEndpoint)
      Sets the endpoint URI where clients should send their JSON-RPC messages.
      Parameters:
      messageEndpoint - The message endpoint URI. Must not be null.
      Returns:
      this builder instance
      Throws:
      IllegalArgumentException - if messageEndpoint is null
    • contextExtractor

      public WebFluxStreamableServerTransportProvider.Builder contextExtractor(McpTransportContextExtractor<org.springframework.web.reactive.function.server.ServerRequest> contextExtractor)
      Sets the context extractor that allows providing the MCP feature implementations to inspect HTTP transport level metadata that was present at HTTP request processing time. This allows to extract custom headers and other useful data for use during execution later on in the process.
      Parameters:
      contextExtractor - The contextExtractor to fill in a McpTransportContext.
      Returns:
      this builder instance
      Throws:
      IllegalArgumentException - if contextExtractor is null
    • disallowDelete

      public WebFluxStreamableServerTransportProvider.Builder disallowDelete(boolean disallowDelete)
      Sets whether the session removal capability is disabled.
      Parameters:
      disallowDelete - if true, the DELETE endpoint will not be supported and sessions won't be deleted.
      Returns:
      this builder instance
    • keepAliveInterval

      public WebFluxStreamableServerTransportProvider.Builder keepAliveInterval(Duration keepAliveInterval)
      Sets the keep-alive interval for the server transport.
      Parameters:
      keepAliveInterval - The interval for sending keep-alive messages. If null, no keep-alive will be scheduled.
      Returns:
      this builder instance
    • build

      Builds a new instance of WebFluxStreamableServerTransportProvider with the configured settings.
      Returns:
      A new WebFluxStreamableServerTransportProvider instance
      Throws:
      IllegalStateException - if required parameters are not set