Package io.modelcontextprotocol.spec
Class DefaultMcpStreamableServerSessionFactory
java.lang.Object
io.modelcontextprotocol.spec.DefaultMcpStreamableServerSessionFactory
- All Implemented Interfaces:
McpStreamableServerSession.Factory
public class DefaultMcpStreamableServerSessionFactory
extends Object
implements McpStreamableServerSession.Factory
A default implementation of
McpStreamableServerSession.Factory.- Author:
- Dariusz Jędrzejczyk
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultMcpStreamableServerSessionFactory(Duration requestTimeout, McpStreamableServerSession.InitRequestHandler initRequestHandler, Map<String, McpRequestHandler<?>> requestHandlers, Map<String, McpNotificationHandler> notificationHandlers) Constructs an instance -
Method Summary
Modifier and TypeMethodDescriptionstartSession(McpSchema.InitializeRequest initializeRequest) Given an initialize request, create a composite for the session initialization
-
Constructor Details
-
DefaultMcpStreamableServerSessionFactory
public DefaultMcpStreamableServerSessionFactory(Duration requestTimeout, McpStreamableServerSession.InitRequestHandler initRequestHandler, Map<String, McpRequestHandler<?>> requestHandlers, Map<String, McpNotificationHandler> notificationHandlers) Constructs an instance- Parameters:
requestTimeout- timeout for requestsinitRequestHandler- initialization request handlerrequestHandlers- map of MCP request handlers keyed by method namenotificationHandlers- map of MCP notification handlers keyed by method name
-
-
Method Details
-
startSession
public McpStreamableServerSession.McpStreamableServerSessionInit startSession(McpSchema.InitializeRequest initializeRequest) Description copied from interface:McpStreamableServerSession.FactoryGiven an initialize request, create a composite for the session initialization- Specified by:
startSessionin interfaceMcpStreamableServerSession.Factory- Parameters:
initializeRequest- the initialization request from the client- Returns:
- a composite allowing the session to start
-