Package org.atmosphere.annotation
Class ProtocolBridge
java.lang.Object
org.atmosphere.annotation.ProtocolBridge
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 Summary
Modifier and TypeMethodDescriptionstatic voidtryRegisterA2a(AtmosphereFramework framework, Object instance, String basePath) Attempts to register an A2A endpoint for the given instance.static voidtryRegisterMcp(AtmosphereFramework framework, Object instance, String basePath) Attempts to register an MCP endpoint for the given instance.
-
Method Details
-
tryRegisterMcp
Attempts to register an MCP endpoint for the given instance. Silently returns ifatmosphere-mcpis not on the classpath or the instance has no@McpTool/@McpResource/@McpPromptmethods.- Parameters:
framework- the atmosphere frameworkinstance- the@ManagedServiceinstance to scanbasePath- the base path of the managed service (e.g."/chat")
-
tryRegisterA2a
Attempts to register an A2A endpoint for the given instance. Silently returns ifatmosphere-a2ais not on the classpath or the instance has no@AgentSkill+@AgentSkillHandlermethods.- Parameters:
framework- the atmosphere frameworkinstance- the@ManagedServiceinstance to scanbasePath- the base path of the managed service (e.g."/chat")
-