-
Notifications
You must be signed in to change notification settings - Fork 2k
Lazy mcp client and toolcallback resolution #4671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,13 +51,33 @@ | |
| import org.springframework.context.annotation.Configuration; | ||
|
|
||
| /** | ||
| * Auto-configuration for MCP client specification factory. | ||
| * | ||
| * <p> | ||
| * <strong>Note:</strong> This configuration is now obsolete and disabled by default. | ||
| * Specification creation has been moved to | ||
| * {@link org.springframework.ai.mcp.client.common.autoconfigure.McpClientAutoConfiguration.McpSyncClientInitializer} | ||
| * and | ||
| * {@link org.springframework.ai.mcp.client.common.autoconfigure.McpClientAutoConfiguration.McpAsyncClientInitializer} | ||
| * which use {@link org.springframework.beans.factory.SmartInitializingSingleton} to defer | ||
| * client creation until after all singleton beans have been initialized. This ensures | ||
| * that all beans with MCP-annotated methods are scanned before specifications are | ||
| * created. | ||
| * | ||
| * <p> | ||
| * This class is kept for backwards compatibility but can be safely removed in future | ||
| * versions. | ||
| * | ||
| * @author Christian Tzolov | ||
| * @author Fu Jian | ||
| * @deprecated Since 1.1.0, specifications are now created dynamically after all singleton | ||
| * beans are initialized. This class will be removed in a future release. | ||
| */ | ||
| @Deprecated(since = "1.1.0", forRemoval = true) | ||
| @AutoConfiguration(after = McpClientAnnotationScannerAutoConfiguration.class) | ||
| @ConditionalOnClass(McpLogging.class) | ||
| @ConditionalOnProperty(prefix = McpClientAnnotationScannerProperties.CONFIG_PREFIX, name = "enabled", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @tzolov – flipping the condition to havingValue="false" unintentionally re-enables this (deprecated) auto-configuration whenever a user sets spring.ai.mcp.client.annotation-scanner.enabled=false. In 1.1.0‑M2 that property meant “turn it off”; with this change the same setting now activates it, so existing apps that disabled the scanner will regress. If the goal is to keep it off by default, the condition should probably remain tied to true (with a new default of false) or be removed entirely. |
||
| havingValue = "true", matchIfMissing = true) | ||
| havingValue = "false") // Disabled by default - changed from "true" to "false" | ||
| public class McpClientSpecificationFactoryAutoConfiguration { | ||
|
|
||
| @Configuration(proxyBeanMethods = false) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it can use clients instead of mcpClients. after all. the mcpClients is deprecated and mcpClientsReference is too long