Class SseHttpClientTransportAutoConfiguration

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

@AutoConfiguration @ConditionalOnClass({io.modelcontextprotocol.spec.McpSchema.class,io.modelcontextprotocol.client.McpSyncClient.class}) @EnableConfigurationProperties({org.springframework.ai.mcp.client.common.autoconfigure.properties.McpSseClientProperties.class,org.springframework.ai.mcp.client.common.autoconfigure.properties.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. It provides HTTP client-based SSE transport implementation for MCP client communication.

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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    List<org.springframework.ai.mcp.client.common.autoconfigure.NamedClientMcpTransport>
    sseHttpClientTransports(org.springframework.ai.mcp.client.common.autoconfigure.McpSseClientConnectionDetails connectionDetails, org.springframework.beans.factory.ObjectProvider<com.fasterxml.jackson.databind.ObjectMapper> objectMapperProvider, org.springframework.beans.factory.ObjectProvider<io.modelcontextprotocol.client.transport.customizer.McpSyncHttpClientRequestCustomizer> syncHttpRequestCustomizer, org.springframework.beans.factory.ObjectProvider<io.modelcontextprotocol.client.transport.customizer.McpAsyncHttpClientRequestCustomizer> asyncHttpRequestCustomizer)
    Creates a list of HTTP client-based SSE transports for MCP communication.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SseHttpClientTransportAutoConfiguration

      public SseHttpClientTransportAutoConfiguration()
  • Method Details

    • sseHttpClientTransports

      @Bean public List<org.springframework.ai.mcp.client.common.autoconfigure.NamedClientMcpTransport> sseHttpClientTransports(org.springframework.ai.mcp.client.common.autoconfigure.McpSseClientConnectionDetails connectionDetails, org.springframework.beans.factory.ObjectProvider<com.fasterxml.jackson.databind.ObjectMapper> objectMapperProvider, org.springframework.beans.factory.ObjectProvider<io.modelcontextprotocol.client.transport.customizer.McpSyncHttpClientRequestCustomizer> syncHttpRequestCustomizer, org.springframework.beans.factory.ObjectProvider<io.modelcontextprotocol.client.transport.customizer.McpAsyncHttpClientRequestCustomizer> asyncHttpRequestCustomizer)
      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
      • A sync or async HTTP request customizer. Sync takes precedence.
      Parameters:
      connectionDetails - the SSE client connection details containing server configurations
      objectMapperProvider - the provider for ObjectMapper or a new instance if not available
      syncHttpRequestCustomizer - provider for McpSyncHttpClientRequestCustomizer if available
      asyncHttpRequestCustomizer - provider fo McpAsyncHttpClientRequestCustomizer if available
      Returns:
      list of named MCP transports