Class SseHttpClientTransportAutoConfiguration

java.lang.Object
org.springframework.ai.autoconfigure.mcp.client.SseHttpClientTransportAutoConfiguration

@AutoConfiguration(after=SseWebFluxTransportAutoConfiguration.class) @ConditionalOnClass({io.modelcontextprotocol.spec.McpSchema.class,io.modelcontextprotocol.client.McpSyncClient.class}) @ConditionalOnMissingClass("io.modelcontextprotocol.client.transport.public class 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:
  • Constructor Details

    • SseHttpClientTransportAutoConfiguration

      public SseHttpClientTransportAutoConfiguration()
  • Method Details

    • mcpHttpClientTransports

      @Bean public List<NamedClientMcpTransport> mcpHttpClientTransports(McpSseClientProperties sseProperties, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
      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 configurations
      objectMapper - the ObjectMapper for JSON serialization/deserialization
      Returns:
      list of named MCP transports
    • 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