Class ProtocolBridge

java.lang.Object
org.atmosphere.annotation.ProtocolBridge

public final class ProtocolBridge extends Object
Reflective bridge that registers protocol endpoints (MCP, A2A) for @ManagedService classes without requiring compile-time dependencies on the protocol modules.

When atmosphere-mcp or atmosphere-a2a is on the classpath, this bridge scans the managed service instance for protocol annotations (@McpTool, @AgentSkill, etc.) and registers the corresponding handlers alongside the main WebSocket/SSE handler.

All protocol classes are accessed via reflection to avoid circular dependencies — atmosphere-runtime (cpr) cannot depend on atmosphere-mcp or atmosphere-a2a.

  • Method Details

    • tryRegisterMcp

      public static void tryRegisterMcp(AtmosphereFramework framework, Object instance, String basePath)
      Attempts to register an MCP endpoint for the given instance. Silently returns if atmosphere-mcp is not on the classpath or the instance has no @McpTool/@McpResource/@McpPrompt methods.
      Parameters:
      framework - the atmosphere framework
      instance - the @ManagedService instance to scan
      basePath - the base path of the managed service (e.g. "/chat")
    • tryRegisterA2a

      public static void tryRegisterA2a(AtmosphereFramework framework, Object instance, String basePath)
      Attempts to register an A2A endpoint for the given instance. Silently returns if atmosphere-a2a is not on the classpath or the instance has no @AgentSkill + @AgentSkillHandler methods.
      Parameters:
      framework - the atmosphere framework
      instance - the @ManagedService instance to scan
      basePath - the base path of the managed service (e.g. "/chat")