Class MpcWebFluxServerAutoConfiguration

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

@AutoConfiguration @ConditionalOnClass(io.modelcontextprotocol.server.transport.WebFluxSseServerTransport.class) @ConditionalOnProperty(prefix="spring.ai.mcp.server", name="transport", havingValue="WEBFLUX") public class MpcWebFluxServerAutoConfiguration 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 WebFluxSseServerTransport 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 WebFluxSseServerTransport 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
See Also:
  • Constructor Details

    • MpcWebFluxServerAutoConfiguration

      public MpcWebFluxServerAutoConfiguration()
  • Method Details

    • webFluxTransport

      @Bean @ConditionalOnMissingBean public io.modelcontextprotocol.server.transport.WebFluxSseServerTransport webFluxTransport(McpServerProperties serverProperties)
    • webfluxMcpRouterFunction

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