Class McpSseServer

java.lang.Object
com.github.thought2code.mcp.annotated.server.McpServerBase
com.github.thought2code.mcp.annotated.server.McpSseServer
All Implemented Interfaces:
McpServer

public class McpSseServer extends McpServerBase
MCP server implementation for HTTP Server-Sent Events (SSE) mode.

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:
  • Constructor Details

    • McpSseServer

      public McpSseServer(McpServerConfiguration configuration)
      Constructs a new McpSseServer with 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.SyncSpecification that 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:
      • HttpServletSseServerTransportProvider
      • McpServerSSE
      • McpJsonMapper
    • 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: