Class McpServerModernWebFluxAutoConfiguration

java.lang.Object
org.springframework.ai.mcp.server.webflux.autoconfigure.McpServerModernWebFluxAutoConfiguration

@AutoConfiguration(after={McpServerModernAutoConfiguration.class,McpServerJsonMapperAutoConfiguration.class}) @ConditionalOnClass({io.modelcontextprotocol.modern.server.McpServer.class,WebFluxMcpTransport.class}) @ConditionalOnBean(io.modelcontextprotocol.modern.server.McpServer.class) @EnableConfigurationProperties(McpServerModernProperties.class) @Conditional({McpServerStdioDisabledCondition.class,EnabledModernServerCondition.class}) public class McpServerModernWebFluxAutoConfiguration extends Object
Auto-configuration of the WebFlux transport for the 2026-07-28 ("modern") MCP server. Active when spring.ai.mcp.server.protocol=MODERN and stdio is disabled.

A ServerHttpHeaderValidator bean, when present, validates Origin and Host headers. A McpTransportContextExtractor<ServerRequest> bean, when present, derives the transport context from the request; otherwise the transport context is empty. Every McpServerCustomizer<WebFluxMcpTransport.Builder> bean is applied, in order, to the transport builder.

Since:
2.1.0
Author:
Christian Tzolov
  • Constructor Details

    • McpServerModernWebFluxAutoConfiguration

      public McpServerModernWebFluxAutoConfiguration()
  • Method Details

    • webFluxMcpTransport

      @Bean @ConditionalOnMissingBean public WebFluxMcpTransport webFluxMcpTransport(io.modelcontextprotocol.modern.server.McpServer mcpServer, @Qualifier("mcpServerJsonMapper") tools.jackson.databind.json.JsonMapper jsonMapper, McpServerModernProperties modernProperties, org.springframework.beans.factory.ObjectProvider<io.modelcontextprotocol.server.transport.ServerHttpHeaderValidator> headerValidator, org.springframework.beans.factory.ObjectProvider<io.modelcontextprotocol.server.McpTransportContextExtractor<org.springframework.web.reactive.function.server.ServerRequest>> contextExtractor, org.springframework.beans.factory.ObjectProvider<McpServerCustomizer<WebFluxMcpTransport.Builder>> customizers)
    • webFluxModernServerRouterFunction

      @Bean @ConditionalOnMissingBean(name="webFluxModernServerRouterFunction") public org.springframework.web.reactive.function.server.RouterFunction<?> webFluxModernServerRouterFunction(WebFluxMcpTransport webFluxMcpTransport)
    • webFluxMcpTransportLifecycle

      @Bean public org.springframework.context.SmartLifecycle webFluxMcpTransportLifecycle(WebFluxMcpTransport webFluxMcpTransport)