Class WebMvcStatelessServerTransport
java.lang.Object
io.modelcontextprotocol.server.transport.WebMvcStatelessServerTransport
- All Implemented Interfaces:
McpStatelessServerTransport
Implementation of a WebMVC based
McpStatelessServerTransport.
This is the non-reactive version of
io.modelcontextprotocol.server.transport.WebFluxStatelessServerTransport
- Author:
- Christian Tzolov
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for creating instances ofWebMvcStatelessServerTransport. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Create a builder for the server.reactor.core.publisher.Mono<Void>org.springframework.web.servlet.function.RouterFunction<org.springframework.web.servlet.function.ServerResponse>Returns the WebMVC router function that defines the transport's HTTP endpoints.voidsetMcpHandler(McpStatelessServerHandler mcpHandler) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.modelcontextprotocol.spec.McpStatelessServerTransport
close, protocolVersions
-
Method Details
-
setMcpHandler
- Specified by:
setMcpHandlerin interfaceMcpStatelessServerTransport
-
closeGracefully
- Specified by:
closeGracefullyin interfaceMcpStatelessServerTransport
-
getRouterFunction
public org.springframework.web.servlet.function.RouterFunction<org.springframework.web.servlet.function.ServerResponse> getRouterFunction()Returns the WebMVC 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 handling two HTTP methods:
- GET {messageEndpoint} - Unsupported, returns 405 METHOD NOT ALLOWED
- POST {messageEndpoint} - For handling client requests and notifications
- Returns:
- The configured
RouterFunctionfor handling HTTP requests
-
builder
Create a builder for the server.- Returns:
- a fresh
WebMvcStatelessServerTransport.Builderinstance.
-