Class SseWebFluxTransportAutoConfiguration
java.lang.Object
org.springframework.ai.autoconfigure.mcp.client.SseWebFluxTransportAutoConfiguration
@AutoConfiguration
@ConditionalOnClass(io.modelcontextprotocol.client.transport.WebFluxSseClientTransport.class)
@EnableConfigurationProperties({McpSseClientProperties.class,McpClientCommonProperties.class})
@ConditionalOnProperty(prefix="spring.ai.mcp.client",
name="enabled",
havingValue="true",
matchIfMissing=true)
public class SseWebFluxTransportAutoConfiguration
extends Object
Auto-configuration for WebFlux-based Server-Sent Events (SSE) client transport in the
Model Context Protocol (MCP).
This configuration class sets up the necessary beans for SSE-based WebFlux transport, providing reactive transport implementation for MCP client communication when WebFlux is available on the classpath.
Key features:
- Creates WebFlux-based SSE transports for configured MCP server connections
- Configures WebClient.Builder for HTTP client operations
- Sets up ObjectMapper for JSON serialization/deserialization
- Supports multiple named server connections with different base URLs
- See Also:
-
WebFluxSseClientTransport
McpSseClientProperties
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.fasterxml.jackson.databind.ObjectMapper
Creates the default ObjectMapper if none is provided.org.springframework.web.reactive.function.client.WebClient.Builder
Creates the default WebClient.Builder if none is provided.webFluxClientTransports
(McpSseClientProperties sseProperties, org.springframework.web.reactive.function.client.WebClient.Builder webClientBuilderTemplate, com.fasterxml.jackson.databind.ObjectMapper objectMapper) Creates a list of WebFlux-based SSE transports for MCP communication.
-
Constructor Details
-
SseWebFluxTransportAutoConfiguration
public SseWebFluxTransportAutoConfiguration()
-
-
Method Details
-
webFluxClientTransports
@Bean public List<NamedClientMcpTransport> webFluxClientTransports(McpSseClientProperties sseProperties, org.springframework.web.reactive.function.client.WebClient.Builder webClientBuilderTemplate, com.fasterxml.jackson.databind.ObjectMapper objectMapper) Creates a list of WebFlux-based SSE transports for MCP communication.Each transport is configured with:
- A cloned WebClient.Builder with server-specific base URL
- ObjectMapper for JSON processing
- Server connection parameters from properties
- Parameters:
sseProperties
- the SSE client properties containing server configurationswebClientBuilderTemplate
- the template WebClient.Builder to clone for each connectionobjectMapper
- the ObjectMapper for JSON serialization/deserialization- Returns:
- list of named MCP transports
-
webClientBuilder
@Bean @ConditionalOnMissingBean public org.springframework.web.reactive.function.client.WebClient.Builder webClientBuilder()Creates the default WebClient.Builder if none is provided.This builder serves as a template for creating server-specific WebClient instances used in SSE transport implementation.
- Returns:
- the configured WebClient.Builder instance
-
objectMapper
@Bean @ConditionalOnMissingBean public com.fasterxml.jackson.databind.ObjectMapper objectMapper()Creates the default ObjectMapper if none is provided.This ObjectMapper is used for JSON serialization and deserialization in the SSE transport implementation.
- Returns:
- the configured ObjectMapper instance
-