diff --git a/auto-configurations/mcp/spring-ai-autoconfigure-mcp-server/src/main/java/org/springframework/ai/mcp/server/autoconfigure/McpServerAutoConfiguration.java b/auto-configurations/mcp/spring-ai-autoconfigure-mcp-server/src/main/java/org/springframework/ai/mcp/server/autoconfigure/McpServerAutoConfiguration.java index 29928f73f..f57cc18dd 100644 --- a/auto-configurations/mcp/spring-ai-autoconfigure-mcp-server/src/main/java/org/springframework/ai/mcp/server/autoconfigure/McpServerAutoConfiguration.java +++ b/auto-configurations/mcp/spring-ai-autoconfigure-mcp-server/src/main/java/org/springframework/ai/mcp/server/autoconfigure/McpServerAutoConfiguration.java @@ -28,9 +28,11 @@ import io.modelcontextprotocol.server.McpServer; import io.modelcontextprotocol.server.McpServer.AsyncSpecification; import io.modelcontextprotocol.server.McpServer.SyncSpecification; import io.modelcontextprotocol.server.McpServerFeatures; +import io.modelcontextprotocol.server.McpServerFeatures.AsyncCompletionSpecification; import io.modelcontextprotocol.server.McpServerFeatures.AsyncPromptSpecification; import io.modelcontextprotocol.server.McpServerFeatures.AsyncResourceSpecification; import io.modelcontextprotocol.server.McpServerFeatures.AsyncToolSpecification; +import io.modelcontextprotocol.server.McpServerFeatures.SyncCompletionSpecification; import io.modelcontextprotocol.server.McpServerFeatures.SyncPromptSpecification; import io.modelcontextprotocol.server.McpServerFeatures.SyncResourceSpecification; import io.modelcontextprotocol.server.McpServerFeatures.SyncToolSpecification; @@ -173,6 +175,7 @@ public class McpServerAutoConfiguration { ObjectProvider> tools, ObjectProvider> resources, ObjectProvider> prompts, + ObjectProvider> completions, ObjectProvider>> rootsChangeConsumers, List toolCallbackProvider) { @@ -216,6 +219,15 @@ public class McpServerAutoConfiguration { + serverProperties.isPromptChangeNotification()); } + List completionSpecifications = completions.stream() + .flatMap(List::stream) + .toList(); + if (!CollectionUtils.isEmpty(completionSpecifications)) { + serverBuilder.completions(completionSpecifications); + capabilitiesBuilder.completions(); + logger.info("Registered completions: " + completionSpecifications.size()); + } + rootsChangeConsumers.ifAvailable(consumer -> { serverBuilder.rootsChangeHandler((exchange, roots) -> consumer.accept(exchange, roots)); logger.info("Registered roots change consumer"); @@ -270,6 +282,7 @@ public class McpServerAutoConfiguration { ObjectProvider> tools, ObjectProvider> resources, ObjectProvider> prompts, + ObjectProvider> completions, ObjectProvider>> rootsChangeConsumer, List toolCallbackProvider) { @@ -313,6 +326,15 @@ public class McpServerAutoConfiguration { + serverProperties.isPromptChangeNotification()); } + List completionSpecifications = completions.stream() + .flatMap(List::stream) + .toList(); + if (!CollectionUtils.isEmpty(completionSpecifications)) { + serverBuilder.completions(completionSpecifications); + capabilitiesBuilder.completions(); + logger.info("Registered completions: " + completionSpecifications.size()); + } + rootsChangeConsumer.ifAvailable(consumer -> { BiFunction, Mono> asyncConsumer = (exchange, roots) -> { consumer.accept(exchange, roots); diff --git a/pom.xml b/pom.xml index 1920f6925..d2107c267 100644 --- a/pom.xml +++ b/pom.xml @@ -308,7 +308,7 @@ 4.12.0 - 0.9.0 + 0.10.0-SNAPSHOT 4.13.1