-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Labels
Description
When creating NamedClientMcpTransport, support ability to customize WebClient per connection name.
Current code creates the WebClient like webClientBuilderProvider.getIfAvailable(WebClient::builder):
public List<NamedClientMcpTransport> streamableHttpWebFluxClientTransports(
McpStreamableHttpClientProperties streamableProperties,
ObjectProvider<WebClient.Builder> webClientBuilderProvider,
ObjectProvider<ObjectMapper> objectMapperProvider) {
var webClientBuilderTemplate = webClientBuilderProvider.getIfAvailable(WebClient::builder);
return streamableProperties.map(streamableProperty -> {
var transport = newTransport(webClientBuilderTemplate, streamableProperty)
streamableHttpTransports.add(new NamedClientMcpTransport(transport))
}).toList();
}Please make the code read something like webClientFactory.create(connectionName, WebClient::builder):
public List<NamedClientMcpTransport> streamableHttpWebFluxClientTransports(
McpStreamableHttpClientProperties streamableProperties,
WebClientFactory webClientFactory,
ObjectProvider<ObjectMapper> objectMapperProvider) {
return streamableProperties.map(streamableProperty -> {
var connectionName = streamableProperty.connectionName()
var webClientBuilder = webClientFactory.create(connectionName, WebClient::builder);
var transport = newTransport(webClientBuilderTemplate, streamableProperty)
streamableHttpTransports.add(new NamedClientMcpTransport(transport))
}).toList();
}Context
This will allow WebClient and underlying http client to be much more easily customized on a per connectionName basis.