mcpAsyncClients

open fun mcpAsyncClients(mcpAsyncClientConfigurer: McpAsyncClientConfigurer, commonProperties: McpClientCommonProperties, transportsProvider: ObjectProvider<List<NamedClientMcpTransport>>, clientMcpAsyncHandlersRegistry: ObjectProvider<ClientMcpAsyncHandlersRegistry>): List<McpAsyncClient>

Creates a list of McpAsyncClient instances based on the available transports.

This method overrides the base Spring AI implementation to add exception handling during client initialization. Clients that fail to initialize are logged and excluded from the returned list, allowing the application to start with partially available MCP functionality rather than failing completely.

Each successfully configured client includes:

  • Client information (name and version) from common properties
  • Request timeout settings
  • Custom configurations through McpAsyncClientConfigurer
  • Handler registrations for sampling, elicitation, logging, progress, and resource changes

If initialization is enabled in properties, the clients are automatically initialized with error resilience using reactive blocking.

Return

list of successfully initialized MCP async clients (may be empty if all fail)

Parameters

mcpAsyncClientConfigurer

the configurer for customizing client creation

commonProperties

common MCP client properties

transportsProvider

provider of named MCP transports

clientMcpAsyncHandlersRegistry

registry for client-side asynchronous handlers