Package com.onec.mcp

Class OnecMcpAutoConfiguration

java.lang.Object
com.onec.mcp.OnecMcpAutoConfiguration

@AutoConfiguration(after=UiAutoConfiguration.class, afterName="com.onec.auth.OnecAuthAutoConfiguration") @ConditionalOnClass({io.modelcontextprotocol.server.McpServer.class,io.modelcontextprotocol.server.transport.HttpServletStreamableServerTransportProvider.class,org.springframework.security.core.context.SecurityContextHolder.class}) @ConditionalOnBean(MetadataRegistry.class) @EnableConfigurationProperties(OnecMcpProperties.class) @ConditionalOnProperty(prefix="onec.mcp", name="enabled", havingValue="true", matchIfMissing=true) public class OnecMcpAutoConfiguration extends Object
Auto-configuration for the onec MCP server.

Mounts a Model Context Protocol streamable-HTTP endpoint that exposes the application's metadata-driven business model as tools. Tools are generated generically from the MetadataRegistry and every call is enforced through the same UiAccessService role model as the web UI, running as the authenticated user captured by McpPrincipalContext.

Requires Spring Security on the classpath (the identity bridge has no meaning without it); the /mcp HTTP Basic filter chain is contributed by McpSecurityConfiguration.

  • Constructor Details

    • OnecMcpAutoConfiguration

      public OnecMcpAutoConfiguration()
  • Method Details

    • onecMcpJsonMapper

      @Bean @ConditionalOnMissingBean public io.modelcontextprotocol.json.McpJsonMapper onecMcpJsonMapper()
    • metadataToolFactory

      @Bean @ConditionalOnMissingBean public MetadataToolFactory metadataToolFactory(MetadataRegistry registry, UiAccessService access, CatalogQueryService catalogQuery, DocumentQueryService documentQuery, RegisterQueryService registerQuery, CatalogCommandService catalogCommands, DocumentCommandService documentCommands, OnecMcpProperties properties, io.modelcontextprotocol.json.McpJsonMapper json)
    • onecMcpTransportProvider

      @Bean @ConditionalOnMissingBean public io.modelcontextprotocol.server.transport.HttpServletStreamableServerTransportProvider onecMcpTransportProvider(io.modelcontextprotocol.json.McpJsonMapper json, OnecMcpProperties properties)
    • onecMcpServletRegistration

      @Bean public org.springframework.boot.web.servlet.ServletRegistrationBean<io.modelcontextprotocol.server.transport.HttpServletStreamableServerTransportProvider> onecMcpServletRegistration(io.modelcontextprotocol.server.transport.HttpServletStreamableServerTransportProvider provider, OnecMcpProperties properties)
    • onecMcpServer

      @Bean @ConditionalOnMissingBean public io.modelcontextprotocol.server.McpSyncServer onecMcpServer(io.modelcontextprotocol.server.transport.HttpServletStreamableServerTransportProvider provider, MetadataToolFactory toolFactory, OnecMcpProperties properties, io.modelcontextprotocol.json.McpJsonMapper json)