Class McpWebFluxServerAutoConfiguration

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

@AutoConfiguration @ConditionalOnClass(io.modelcontextprotocol.server.transport.WebFluxSseServerTransportProvider.class) @ConditionalOnMissingBean(io.modelcontextprotocol.spec.McpServerTransportProvider.class) @Conditional(McpServerStdioDisabledCondition.class) public class McpWebFluxServerAutoConfiguration extends Object
Auto-configuration for MCP WebFlux Server Transport.

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

  • The WebFluxSseServerTransportProvider class is on the classpath (from mcp-spring-webflux dependency)
  • Spring WebFlux's RouterFunction class is available (from spring-boot-starter-webflux)
  • The spring.ai.mcp.server.transport property is set to WEBFLUX

The configuration provides:

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

Required dependencies:


 <dependency>
     <groupId>io.modelcontextprotocol.sdk</groupId>
     <artifactId>mcp-spring-webflux</artifactId>
 </dependency>
 <dependency>
     <groupId>org.springframework.boot</groupId>
     <artifactId>spring-boot-starter-webflux</artifactId>
 </dependency>
 
Since:
1.0.0
Author:
Christian Tzolov, Yanming Zhou
See Also:
  • Constructor Details

    • McpWebFluxServerAutoConfiguration

      public McpWebFluxServerAutoConfiguration()
  • Method Details

    • webFluxTransport

      @Bean @ConditionalOnMissingBean public io.modelcontextprotocol.server.transport.WebFluxSseServerTransportProvider webFluxTransport(org.springframework.beans.factory.ObjectProvider<com.fasterxml.jackson.databind.ObjectMapper> objectMapperProvider, McpServerProperties serverProperties)
    • webfluxMcpRouterFunction

      @Bean public org.springframework.web.reactive.function.server.RouterFunction<?> webfluxMcpRouterFunction(io.modelcontextprotocol.server.transport.WebFluxSseServerTransportProvider webFluxProvider)