Class SseHttpClientTransportAutoConfiguration
java.lang.Object
org.springframework.ai.mcp.client.autoconfigure.SseHttpClientTransportAutoConfiguration
@AutoConfiguration(after=SseWebFluxTransportAutoConfiguration.class)
@ConditionalOnClass({io.modelcontextprotocol.spec.McpSchema.class,io.modelcontextprotocol.client.McpSyncClient.class})
@ConditionalOnMissingClass("io.modelcontextprotocol.client.transport.WebFluxSseClientTransport")
@EnableConfigurationProperties({McpSseClientProperties.class,McpClientCommonProperties.class})
@ConditionalOnProperty(prefix="spring.ai.mcp.client",
name="enabled",
havingValue="true",
matchIfMissing=true)
public class SseHttpClientTransportAutoConfiguration
extends Object
Auto-configuration for Server-Sent Events (SSE) HTTP client transport in the Model
Context Protocol (MCP).
This configuration class sets up the necessary beans for SSE-based HTTP client transport when WebFlux is not available. It provides HTTP client-based SSE transport implementation for MCP client communication.
The configuration is activated after the WebFlux SSE transport auto-configuration to ensure proper fallback behavior when WebFlux is not available.
Key features:
- Creates HTTP client-based SSE transports for configured MCP server connections
- Configures ObjectMapper for JSON serialization/deserialization
- Supports multiple named server connections with different URLs
- See Also:
-
HttpClientSseClientTransport
McpSseClientProperties
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionmcpHttpClientTransports
(McpSseClientProperties sseProperties, org.springframework.beans.factory.ObjectProvider<com.fasterxml.jackson.databind.ObjectMapper> objectMapperProvider) Creates a list of HTTP client-based SSE transports for MCP communication.
-
Constructor Details
-
SseHttpClientTransportAutoConfiguration
public SseHttpClientTransportAutoConfiguration()
-
-
Method Details
-
mcpHttpClientTransports
@Bean public List<NamedClientMcpTransport> mcpHttpClientTransports(McpSseClientProperties sseProperties, org.springframework.beans.factory.ObjectProvider<com.fasterxml.jackson.databind.ObjectMapper> objectMapperProvider) Creates a list of HTTP client-based SSE transports for MCP communication.Each transport is configured with:
- A new HttpClient instance
- Server URL from properties
- ObjectMapper for JSON processing
- Parameters:
sseProperties
- the SSE client properties containing server configurationsobjectMapperProvider
- the provider for ObjectMapper or a new instance if not available- Returns:
- list of named MCP transports
-