Class McpSseServer
- All Implemented Interfaces:
McpServer
This class extends McpServerBase and provides an MCP server implementation that uses
Server-Sent Events for HTTP-based real-time communication. SSE mode allows the server to push
updates to clients over a single HTTP connection.
Note: This mode has been deprecated in favor of STREAMABLE mode. Consider using McpStreamableServer for new implementations.
The server uses Jetty HTTP server for handling HTTP connections and provides SSE endpoints for real-time communication with MCP clients.
- Author:
- codeboyzhou
- See Also:
-
McpServerBaseMcpStreamableServerMcpStdioServerHttpServletSseServerTransportProviderJettyHttpServer
-
Field Summary
Fields inherited from class com.github.thought2code.mcp.annotated.server.McpServerBase
configuration -
Constructor Summary
ConstructorsConstructorDescriptionMcpSseServer(McpServerConfiguration configuration) Constructs a newMcpSseServerwith the specified configuration. -
Method Summary
Modifier and TypeMethodDescriptionio.modelcontextprotocol.server.McpServer.SyncSpecification<?>Creates and returns a synchronization specification for SSE mode.voidStarts the HTTP server for SSE mode.Methods inherited from class com.github.thought2code.mcp.annotated.server.McpServerBase
createSyncServer, defineCapabilities, registerComponents
-
Constructor Details
-
McpSseServer
Constructs a newMcpSseServerwith the specified configuration.- Parameters:
configuration- the server configuration containing SSE settings
-
-
Method Details
-
createSyncSpecification
public io.modelcontextprotocol.server.McpServer.SyncSpecification<?> createSyncSpecification()Creates and returns a synchronization specification for SSE mode.This method creates an
McpServer.SyncSpecificationthat uses Server-Sent Events transport provider for real-time communication. It configures the transport provider with SSE-specific settings from the server configuration.Note: This method logs a deprecation warning as SSE mode is deprecated in favor of STREAMABLE mode.
- Returns:
- a synchronization specification configured for SSE transport
- See Also:
-
HttpServletSseServerTransportProviderMcpServerSSEMcpJsonMapper
-
startHttpServer
public void startHttpServer()Starts the HTTP server for SSE mode.This method creates and starts a Jetty HTTP server that handles SSE connections. The server is configured with the transport provider and bound to the port specified in the server configuration.
- See Also:
-
JettyHttpServerHttpServletSseServerTransportProvider
-