Class WebFluxStreamableServerTransportProvider

java.lang.Object
io.modelcontextprotocol.server.transport.WebFluxStreamableServerTransportProvider
All Implemented Interfaces:
io.modelcontextprotocol.spec.McpServerTransportProviderBase, io.modelcontextprotocol.spec.McpStreamableServerTransportProvider

public class WebFluxStreamableServerTransportProvider extends Object implements io.modelcontextprotocol.spec.McpStreamableServerTransportProvider
Implementation of a WebFlux based McpStreamableServerTransportProvider.
Author:
Dariusz Jędrzejczyk
  • Field Details

  • Method Details

    • protocolVersions

      public List<String> protocolVersions()
      Specified by:
      protocolVersions in interface io.modelcontextprotocol.spec.McpServerTransportProviderBase
    • setSessionFactory

      public void setSessionFactory(io.modelcontextprotocol.spec.McpStreamableServerSession.Factory sessionFactory)
      Specified by:
      setSessionFactory in interface io.modelcontextprotocol.spec.McpStreamableServerTransportProvider
    • notifyClients

      public reactor.core.publisher.Mono<Void> notifyClients(String method, Object params)
      Specified by:
      notifyClients in interface io.modelcontextprotocol.spec.McpServerTransportProviderBase
      Specified by:
      notifyClients in interface io.modelcontextprotocol.spec.McpStreamableServerTransportProvider
    • closeGracefully

      public reactor.core.publisher.Mono<Void> closeGracefully()
      Specified by:
      closeGracefully in interface io.modelcontextprotocol.spec.McpServerTransportProviderBase
      Specified by:
      closeGracefully in interface io.modelcontextprotocol.spec.McpStreamableServerTransportProvider
    • getRouterFunction

      public org.springframework.web.reactive.function.server.RouterFunction<?> getRouterFunction()
      Returns the WebFlux router function that defines the transport's HTTP endpoints. This router function should be integrated into the application's web configuration.

      The router function defines one endpoint with three methods:

      • GET {messageEndpoint} - For the client listening SSE stream
      • POST {messageEndpoint} - For receiving client messages
      • DELETE {messageEndpoint} - For removing sessions
      Returns:
      The configured RouterFunction for handling HTTP requests
    • builder