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 Summary
ConstructorsConstructorDescriptionCustomMcpStreamableServerTransportProvider(org.springframework.context.ApplicationContext applicationContext, org.springframework.ai.mcp.server.webmvc.transport.WebMvcStreamableServerTransportProvider serverTransportProvider) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the wrapped transport.reactor.core.publisher.Mono<Void> org.springframework.web.servlet.function.RouterFunction<org.springframework.web.servlet.function.ServerResponse> reactor.core.publisher.Mono<Void> notifyClients(String method, Object params) voidsetSessionFactory(io.modelcontextprotocol.spec.McpStreamableServerSession.Factory sessionFactory) Installs the session factory, substituting the SDK's default one withMcpServerToolListingHandlerConfiguration.McpStreamableServerSessionFactoryso thattools/listis answered per scope.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.modelcontextprotocol.spec.McpServerTransportProviderBase
notifyClient
-
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 factoryserverTransportProvider- the real transport every call is delegated to
-
-
Method Details
-
protocolVersions
- Specified by:
protocolVersionsin interfaceio.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 withMcpServerToolListingHandlerConfiguration.McpStreamableServerSessionFactoryso thattools/listis answered per scope.- Specified by:
setSessionFactoryin interfaceio.modelcontextprotocol.spec.McpStreamableServerTransportProvider- Parameters:
sessionFactory- the factory the SDK built, expected to be itsDefaultMcpStreamableServerSessionFactory- Throws:
UnsupportedOperationException- for any other factory, whose handlers this class cannot read
-
notifyClients
- Specified by:
notifyClientsin interfaceio.modelcontextprotocol.spec.McpServerTransportProviderBase- Specified by:
notifyClientsin interfaceio.modelcontextprotocol.spec.McpStreamableServerTransportProvider- Parameters:
method- the notification methodparams- the notification parameters- Returns:
- completion of the broadcast by the wrapped transport
-
closeGracefully
- Specified by:
closeGracefullyin interfaceio.modelcontextprotocol.spec.McpServerTransportProviderBase- Specified by:
closeGracefullyin interfaceio.modelcontextprotocol.spec.McpStreamableServerTransportProvider- Returns:
- completion of the wrapped transport's graceful shutdown
-
close
public void close()Closes the wrapped transport.- Specified by:
closein interfaceio.modelcontextprotocol.spec.McpServerTransportProviderBase- Specified by:
closein interfaceio.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
-