Class McpServerAutoConfiguration

java.lang.Object
org.springframework.ai.mcp.server.common.autoconfigure.McpServerAutoConfiguration

@AutoConfiguration(afterName={"org.springframework.ai.mcp.server.common.autoconfigure.annotations.McpServerSpecificationFactoryAutoConfiguration","org.springframework.ai.mcp.server.common.autoconfigure.ToolCallbackConverterAutoConfiguration","org.springframework.ai.mcp.server.autoconfigure.McpServerSseWebFluxAutoConfiguration","org.springframework.ai.mcp.server.autoconfigure.McpServerSseWebMvcAutoConfiguration","org.springframework.ai.mcp.server.autoconfigure.McpServerStreamableHttpWebMvcAutoConfiguration","org.springframework.ai.mcp.server.autoconfigure.McpServerStreamableHttpWebFluxAutoConfiguration"}) @ConditionalOnClass(io.modelcontextprotocol.spec.McpSchema.class) @EnableConfigurationProperties({McpServerProperties.class,McpServerChangeNotificationProperties.class}) @ConditionalOnProperty(prefix="spring.ai.mcp.server", name="enabled", havingValue="true", matchIfMissing=true) @Conditional(NonStatelessServerCondition.class) public class McpServerAutoConfiguration extends Object
Auto-configuration for the Model Context Protocol (MCP) Server.

Since:
1.0.0
Author:
Christian Tzolov
See Also:
  • Nested Class Summary

    Nested Classes
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    io.modelcontextprotocol.spec.McpSchema.ServerCapabilities.Builder
     
    io.modelcontextprotocol.server.McpAsyncServer
    mcpAsyncServer(io.modelcontextprotocol.spec.McpServerTransportProviderBase transportProvider, io.modelcontextprotocol.spec.McpSchema.ServerCapabilities.Builder capabilitiesBuilder, McpServerProperties serverProperties, McpServerChangeNotificationProperties changeNotificationProperties, org.springframework.beans.factory.ObjectProvider<List<io.modelcontextprotocol.server.McpServerFeatures.AsyncToolSpecification>> tools, org.springframework.beans.factory.ObjectProvider<List<io.modelcontextprotocol.server.McpServerFeatures.AsyncResourceSpecification>> resources, org.springframework.beans.factory.ObjectProvider<List<io.modelcontextprotocol.server.McpServerFeatures.AsyncResourceTemplateSpecification>> resourceTemplates, org.springframework.beans.factory.ObjectProvider<List<io.modelcontextprotocol.server.McpServerFeatures.AsyncPromptSpecification>> prompts, org.springframework.beans.factory.ObjectProvider<List<io.modelcontextprotocol.server.McpServerFeatures.AsyncCompletionSpecification>> completions, org.springframework.beans.factory.ObjectProvider<BiConsumer<io.modelcontextprotocol.server.McpAsyncServerExchange,List<io.modelcontextprotocol.spec.McpSchema.Root>>> rootsChangeConsumer)
     
    io.modelcontextprotocol.server.McpSyncServer
    mcpSyncServer(io.modelcontextprotocol.spec.McpServerTransportProviderBase transportProvider, io.modelcontextprotocol.spec.McpSchema.ServerCapabilities.Builder capabilitiesBuilder, McpServerProperties serverProperties, McpServerChangeNotificationProperties changeNotificationProperties, org.springframework.beans.factory.ObjectProvider<List<io.modelcontextprotocol.server.McpServerFeatures.SyncToolSpecification>> tools, org.springframework.beans.factory.ObjectProvider<List<io.modelcontextprotocol.server.McpServerFeatures.SyncResourceSpecification>> resources, org.springframework.beans.factory.ObjectProvider<List<io.modelcontextprotocol.server.McpServerFeatures.SyncResourceTemplateSpecification>> resourceTemplates, org.springframework.beans.factory.ObjectProvider<List<io.modelcontextprotocol.server.McpServerFeatures.SyncPromptSpecification>> prompts, org.springframework.beans.factory.ObjectProvider<List<io.modelcontextprotocol.server.McpServerFeatures.SyncCompletionSpecification>> completions, org.springframework.beans.factory.ObjectProvider<BiConsumer<io.modelcontextprotocol.server.McpSyncServerExchange,List<io.modelcontextprotocol.spec.McpSchema.Root>>> rootsChangeConsumers, org.springframework.core.env.Environment environment)
     
    io.modelcontextprotocol.spec.McpServerTransportProviderBase
    stdioServerTransport(org.springframework.beans.factory.ObjectProvider<com.fasterxml.jackson.databind.ObjectMapper> objectMapperProvider)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • McpServerAutoConfiguration

      public McpServerAutoConfiguration()
  • Method Details

    • stdioServerTransport

      @Bean @ConditionalOnMissingBean public io.modelcontextprotocol.spec.McpServerTransportProviderBase stdioServerTransport(org.springframework.beans.factory.ObjectProvider<com.fasterxml.jackson.databind.ObjectMapper> objectMapperProvider)
    • capabilitiesBuilder

      @Bean @ConditionalOnMissingBean public io.modelcontextprotocol.spec.McpSchema.ServerCapabilities.Builder capabilitiesBuilder()
    • mcpSyncServer

      @Bean @ConditionalOnProperty(prefix="spring.ai.mcp.server", name="type", havingValue="SYNC", matchIfMissing=true) public io.modelcontextprotocol.server.McpSyncServer mcpSyncServer(io.modelcontextprotocol.spec.McpServerTransportProviderBase transportProvider, io.modelcontextprotocol.spec.McpSchema.ServerCapabilities.Builder capabilitiesBuilder, McpServerProperties serverProperties, McpServerChangeNotificationProperties changeNotificationProperties, org.springframework.beans.factory.ObjectProvider<List<io.modelcontextprotocol.server.McpServerFeatures.SyncToolSpecification>> tools, org.springframework.beans.factory.ObjectProvider<List<io.modelcontextprotocol.server.McpServerFeatures.SyncResourceSpecification>> resources, org.springframework.beans.factory.ObjectProvider<List<io.modelcontextprotocol.server.McpServerFeatures.SyncResourceTemplateSpecification>> resourceTemplates, org.springframework.beans.factory.ObjectProvider<List<io.modelcontextprotocol.server.McpServerFeatures.SyncPromptSpecification>> prompts, org.springframework.beans.factory.ObjectProvider<List<io.modelcontextprotocol.server.McpServerFeatures.SyncCompletionSpecification>> completions, org.springframework.beans.factory.ObjectProvider<BiConsumer<io.modelcontextprotocol.server.McpSyncServerExchange,List<io.modelcontextprotocol.spec.McpSchema.Root>>> rootsChangeConsumers, org.springframework.core.env.Environment environment)
    • mcpAsyncServer

      @Bean @ConditionalOnProperty(prefix="spring.ai.mcp.server", name="type", havingValue="ASYNC") public io.modelcontextprotocol.server.McpAsyncServer mcpAsyncServer(io.modelcontextprotocol.spec.McpServerTransportProviderBase transportProvider, io.modelcontextprotocol.spec.McpSchema.ServerCapabilities.Builder capabilitiesBuilder, McpServerProperties serverProperties, McpServerChangeNotificationProperties changeNotificationProperties, org.springframework.beans.factory.ObjectProvider<List<io.modelcontextprotocol.server.McpServerFeatures.AsyncToolSpecification>> tools, org.springframework.beans.factory.ObjectProvider<List<io.modelcontextprotocol.server.McpServerFeatures.AsyncResourceSpecification>> resources, org.springframework.beans.factory.ObjectProvider<List<io.modelcontextprotocol.server.McpServerFeatures.AsyncResourceTemplateSpecification>> resourceTemplates, org.springframework.beans.factory.ObjectProvider<List<io.modelcontextprotocol.server.McpServerFeatures.AsyncPromptSpecification>> prompts, org.springframework.beans.factory.ObjectProvider<List<io.modelcontextprotocol.server.McpServerFeatures.AsyncCompletionSpecification>> completions, org.springframework.beans.factory.ObjectProvider<BiConsumer<io.modelcontextprotocol.server.McpAsyncServerExchange,List<io.modelcontextprotocol.spec.McpSchema.Root>>> rootsChangeConsumer)