Class StreamableHttpHttpClientTransportAutoConfiguration

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

@AutoConfiguration @ConditionalOnClass({io.modelcontextprotocol.spec.McpSchema.class,io.modelcontextprotocol.client.McpSyncClient.class}) @EnableConfigurationProperties({org.springframework.ai.mcp.client.common.autoconfigure.properties.McpStreamableHttpClientProperties.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 StreamableHttpHttpClientTransportAutoConfiguration extends Object
Auto-configuration for Streamable HTTP client transport in the Model Context Protocol (MCP).

This configuration class sets up the necessary beans for Streamable HTTP client transport. It provides HTTP client-based Streamable HTTP transport implementation for MCP client communication.

Key features:

  • Creates HTTP client-based Streamable HTTP transports for configured MCP server connections
  • Configures ObjectMapper for JSON serialization/deserialization
  • Supports multiple named server connections with different URLs
  • Adds a sync or async HTTP request customizer. Sync takes precedence.
See Also:
  • HttpClientStreamableHttpTransport
  • McpStreamableHttpClientProperties
  • Constructor Summary

    Constructors
  • Method Summary

    Modifier and Type
    Method
    Description
    List<org.springframework.ai.mcp.client.common.autoconfigure.NamedClientMcpTransport>
    streamableHttpHttpClientTransports(org.springframework.ai.mcp.client.common.autoconfigure.properties.McpStreamableHttpClientProperties streamableProperties, 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 Streamable HTTP transports for MCP communication.

    Methods inherited from class Object

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

    • StreamableHttpHttpClientTransportAutoConfiguration

      public StreamableHttpHttpClientTransportAutoConfiguration()
  • Method Details

    • streamableHttpHttpClientTransports

      @Bean public List<org.springframework.ai.mcp.client.common.autoconfigure.NamedClientMcpTransport> streamableHttpHttpClientTransports(org.springframework.ai.mcp.client.common.autoconfigure.properties.McpStreamableHttpClientProperties streamableProperties, 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 Streamable HTTP transports for MCP communication.

      Each transport is configured with:

      • A new HttpClient instance
      • Server URL from properties
      • ObjectMapper for JSON processing
      Parameters:
      streamableProperties - the Streamable HTTP client properties 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