Class McpServerToolListingHandlerConfiguration.CustomMcpStreamableServerTransportProvider

java.lang.Object
io.meeds.mcp.server.configuration.McpServerToolListingHandlerConfiguration.CustomMcpStreamableServerTransportProvider
All Implemented Interfaces:
io.modelcontextprotocol.spec.McpServerTransportProviderBase, io.modelcontextprotocol.spec.McpStreamableServerTransportProvider
Enclosing class:
McpServerToolListingHandlerConfiguration

public static class McpServerToolListingHandlerConfiguration.CustomMcpStreamableServerTransportProvider extends Object implements io.modelcontextprotocol.spec.McpStreamableServerTransportProvider
  • Constructor Details

    • CustomMcpStreamableServerTransportProvider

      public CustomMcpStreamableServerTransportProvider(org.springframework.context.ApplicationContext applicationContext, org.springframework.ai.mcp.server.webmvc.transport.WebMvcStreamableServerTransportProvider serverTransportProvider)
      Parameters:
      applicationContext - the application context handed to the substituted session factory
      serverTransportProvider - the real transport every call is delegated to
  • Method Details

    • protocolVersions

      public List<String> protocolVersions()
      Specified by:
      protocolVersions in interface io.modelcontextprotocol.spec.McpServerTransportProviderBase
      Returns:
      the protocol versions the wrapped transport supports
    • setSessionFactory

      public void setSessionFactory(io.modelcontextprotocol.spec.McpStreamableServerSession.Factory sessionFactory)
      Installs the session factory, substituting the SDK's default one with McpServerToolListingHandlerConfiguration.McpStreamableServerSessionFactory so that tools/list is answered per scope.
      Specified by:
      setSessionFactory in interface io.modelcontextprotocol.spec.McpStreamableServerTransportProvider
      Parameters:
      sessionFactory - the factory the SDK built, expected to be its DefaultMcpStreamableServerSessionFactory
      Throws:
      UnsupportedOperationException - for any other factory, whose handlers this class cannot read
    • 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
      Parameters:
      method - the notification method
      params - the notification parameters
      Returns:
      completion of the broadcast by the wrapped transport
    • 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
      Returns:
      completion of the wrapped transport's graceful shutdown
    • close

      public void close()
      Closes the wrapped transport.
      Specified by:
      close in interface io.modelcontextprotocol.spec.McpServerTransportProviderBase
      Specified by:
      close in interface io.modelcontextprotocol.spec.McpStreamableServerTransportProvider
    • getRouterFunction

      public org.springframework.web.servlet.function.RouterFunction<org.springframework.web.servlet.function.ServerResponse> getRouterFunction()
      Returns:
      the wrapped transport's router function, serving the MCP endpoint