mcpSyncClients

open fun mcpSyncClients(mcpSyncClientConfigurer: McpSyncClientConfigurer, commonProperties: McpClientCommonProperties, transportsProvider: ObjectProvider<List<NamedClientMcpTransport>>, clientMcpSyncHandlersRegistry: ObjectProvider<ClientMcpSyncHandlersRegistry>): List<McpSyncClient>

Creates a list of McpSyncClient 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 McpSyncClientConfigurer
  • Handler registrations for sampling, elicitation, logging, progress, and resource changes

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

Return

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

Parameters

mcpSyncClientConfigurer

the configurer for customizing client creation

commonProperties

common MCP client properties

transportsProvider

provider of named MCP transports

clientMcpSyncHandlersRegistry

registry for client-side synchronous handlers