Package su.onno.mcp

Class OnnoMcpAutoConfiguration

java.lang.Object
su.onno.mcp.OnnoMcpAutoConfiguration

@AutoConfiguration(after=UiAutoConfiguration.class, afterName="su.onno.auth.OnnoAuthAutoConfiguration") @ConditionalOnClass({io.modelcontextprotocol.server.McpServer.class,io.modelcontextprotocol.server.transport.HttpServletStreamableServerTransportProvider.class,org.springframework.security.core.context.SecurityContextHolder.class}) @ConditionalOnBean(MetadataRegistry.class) @EnableConfigurationProperties(OnnoMcpProperties.class) @ConditionalOnProperty(prefix="onno.mcp", name="enabled", havingValue="true", matchIfMissing=true) public class OnnoMcpAutoConfiguration extends Object
Auto-configuration for the onno 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

    • OnnoMcpAutoConfiguration

      public OnnoMcpAutoConfiguration()
  • Method Details

    • onnoMcpJsonMapper

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

      @Bean @ConditionalOnMissingBean public MetadataToolFactory metadataToolFactory(MetadataRegistry registry, ProcessDefinitions processDefinitions, UiAccessService access, CatalogQueryService catalogQuery, DocumentQueryService documentQuery, RegisterQueryService registerQuery, CatalogCommandService catalogCommands, DocumentCommandService documentCommands, OnnoMcpProperties properties, UiProperties uiProperties, io.modelcontextprotocol.json.McpJsonMapper json)
    • annotatedMcpToolProvider

      @Bean public McpToolProvider annotatedMcpToolProvider(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory, OnnoMcpProperties properties, UiProperties uiProperties, io.modelcontextprotocol.json.McpJsonMapper json)
    • onnoMcpTransportProvider

      @Bean @ConditionalOnMissingBean public io.modelcontextprotocol.server.transport.HttpServletStreamableServerTransportProvider onnoMcpTransportProvider(io.modelcontextprotocol.json.McpJsonMapper json, OnnoMcpProperties properties)
    • onnoMcpServletRegistration

      @Bean public org.springframework.boot.web.servlet.ServletRegistrationBean<io.modelcontextprotocol.server.transport.HttpServletStreamableServerTransportProvider> onnoMcpServletRegistration(io.modelcontextprotocol.server.transport.HttpServletStreamableServerTransportProvider provider, OnnoMcpProperties properties)
    • onnoMcpServer

      @Bean @ConditionalOnMissingBean public io.modelcontextprotocol.server.McpSyncServer onnoMcpServer(io.modelcontextprotocol.server.transport.HttpServletStreamableServerTransportProvider provider, List<McpToolProvider> toolProviders, OnnoMcpProperties properties)