QuiteMcpClientAutoConfiguration

Enhanced auto-configuration for Model Context Protocol (MCP) client support.

This configuration extends Spring AI's McpClientAutoConfiguration with additional resilience handling to prevent runtime exceptions during MCP client initialization from disrupting the Agent Platform startup. Failed client initializations are logged but do not prevent the application from starting successfully.

Key differences from base Spring AI configuration:

  • Exception Resilience: Wraps client initialization in try-catch blocks to handle failures gracefully
  • Startup Protection: Prevents MCP client failures from blocking Agent Platform startup
  • Error Logging: Failed initializations are logged with client names for troubleshooting
  • Partial Success: Successfully initialized clients are added to the context even if others fail

Configuration Properties:

  • spring.ai.mcp.client.enabled - Enable/disable MCP client support (default: true)
  • spring.ai.mcp.client.type - Client type: SYNC or ASYNC (default: SYNC)
  • spring.ai.mcp.client.name - Client implementation name
  • spring.ai.mcp.client.version - Client implementation version
  • spring.ai.mcp.client.request-timeout - Request timeout duration
  • spring.ai.mcp.client.initialized - Whether to initialize clients on creation

The configuration is activated after the transport-specific auto-configurations (Stdio, SSE HTTP, and SSE WebFlux) to ensure proper initialization order. At least one transport must be available for the clients to be created.

Key features:

  • Synchronous and Asynchronous Client Support:
    • Creates and configures MCP clients based on available transports
    • Supports both blocking (sync) and non-blocking (async) operations
    • Automatic client initialization with failure resilience
  • Integration Support:
    • Sets up tool callbacks for Spring AI integration
    • Supports multiple named transports
    • Proper lifecycle management with automatic cleanup
  • Customization Options:
    • Extensible through McpSyncClientCustomizer and McpAsyncClientCustomizer
    • Configurable timeouts and client information
    • Support for custom transport implementations

See also

McpClientAutoConfiguration
McpSyncClient
McpAsyncClient
McpClientCommonProperties
McpSyncClientCustomizer
McpAsyncClientCustomizer
StdioTransportAutoConfiguration

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
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.
Link copied to clipboard
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.