Class McpServerSseWebMvcAutoConfiguration

java.lang.Object
org.springframework.ai.mcp.server.autoconfigure.McpServerSseWebMvcAutoConfiguration

@AutoConfiguration(before=org.springframework.ai.mcp.server.common.autoconfigure.McpServerAutoConfiguration.class) @EnableConfigurationProperties(org.springframework.ai.mcp.server.common.autoconfigure.properties.McpServerSseProperties.class) @ConditionalOnClass(io.modelcontextprotocol.server.transport.WebMvcSseServerTransportProvider.class) @ConditionalOnMissingBean(io.modelcontextprotocol.spec.McpServerTransportProvider.class) @Conditional({org.springframework.ai.mcp.server.common.autoconfigure.McpServerStdioDisabledCondition.class,org.springframework.ai.mcp.server.common.autoconfigure.McpServerAutoConfiguration.EnabledSseServerCondition.class}) public class McpServerSseWebMvcAutoConfiguration extends Object
Auto-configuration for MCP WebMvc Server Transport.

This configuration class sets up the WebMvc-specific transport components for the MCP server, providing Server-Sent Events (SSE) communication through Spring MVC. It is activated when:

  • The WebMvcSseServerTransport class is on the classpath (from mcp-spring-webmvc dependency)
  • Spring MVC's RouterFunction class is available (from spring-boot-starter-web)
  • The spring.ai.mcp.server.transport property is set to WEBMVC

The configuration provides:

  • A WebMvcSseServerTransport bean for handling SSE communication
  • A RouterFunction bean that sets up the SSE endpoint

Required dependencies:


 <dependency>
     <groupId>org.springframework.boot</groupId>
     <artifactId>spring-boot-starter-web</artifactId>
 </dependency>
 
Since:
1.0.0
Author:
Christian Tzolov, Yanming Zhou
See Also:
  • McpServerSseProperties
  • WebMvcSseServerTransportProvider
  • Constructor Details

    • McpServerSseWebMvcAutoConfiguration

      public McpServerSseWebMvcAutoConfiguration()
  • Method Details

    • webMvcSseServerTransportProvider

      @Bean @ConditionalOnMissingBean public io.modelcontextprotocol.server.transport.WebMvcSseServerTransportProvider webMvcSseServerTransportProvider(@Qualifier("mcpServerObjectMapper") com.fasterxml.jackson.databind.ObjectMapper objectMapper, org.springframework.ai.mcp.server.common.autoconfigure.properties.McpServerSseProperties serverProperties)
    • webMvcSseServerRouterFunction

      @Bean @ConditionalOnMissingBean(name="webMvcSseServerRouterFunction") public org.springframework.web.servlet.function.RouterFunction<org.springframework.web.servlet.function.ServerResponse> webMvcSseServerRouterFunction(io.modelcontextprotocol.server.transport.WebMvcSseServerTransportProvider transportProvider)