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:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList<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.
-
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 configurationsobjectMapperProvider- the provider for ObjectMapper or a new instance if not availablesyncHttpRequestCustomizer- provider forMcpSyncHttpClientRequestCustomizerif availableasyncHttpRequestCustomizer- provider foMcpAsyncHttpClientRequestCustomizerif available- Returns:
- list of named MCP transports
-