[
https://issues.apache.org/jira/browse/CAMEL-24310?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Federico Mariani reassigned CAMEL-24310:
----------------------------------------
Assignee: Federico Mariani
> camel-mcp-server module: bridge, McpServerEngine SPI and default engine
> -----------------------------------------------------------------------
>
> Key: CAMEL-24310
> URL: https://issues.apache.org/jira/browse/CAMEL-24310
> Project: Camel
> Issue Type: Sub-task
> Components: camel-ai
> Reporter: Federico Mariani
> Assignee: Federico Mariani
> Priority: Major
> Labels: ai, mcp
>
> Create the {{camel-mcp-server}} module(s) under components/camel-ai, split
> into a runtime-agnostic bridge + SPI and a default serving engine (mirroring
> the {{PlatformHttpEngine}} precedent so other runtimes can plug native
> servers — the camel-quarkus extension will provide a
> quarkus-mcp-server-backed engine).
> h3. camel-mcp-server (bridge + SPI)
> * {{McpServerEngine}} SPI: {{initialize(McpServerInfo)}},
> {{toolAdded(McpServerTool)}}, {{toolRemoved(String)}}. Single logical MCP
> server per CamelContext.
> * {{McpServerTool}}: name, description, pre-built input JSON Schema string
> AND structured {{ParameterDef}} map (both already carried by {{AiToolSpec}},
> engines pick whichever fits), and a blocking {{McpToolCallHandler}} returning
> {{McpToolCallResult(text, isError)}}.
> * The bridge (internal CamelContext service): filters {{AiToolRegistry}} by
> {{mcp-tags}} (never the untagged default pool), fails fast on flat-namespace
> name collisions, subscribes to the registry listener (CAMEL-24309), wraps
> each {{AiToolSpec}} into an {{McpServerTool}} whose handler creates the
> exchange from the tool's consumer, calls {{AiToolExecutor}} with the
> configured timeout, and maps {{AiToolResult}} to a *pre-sanitized*
> {{McpToolCallResult}} — engines can never see or leak raw route exception
> messages.
> * Engine resolution: registry bean of type {{McpServerEngine}} wins;
> otherwise FactoryFinder
> ({{META-INF/services/org/apache/camel/mcp/server-engine}});
> enabled-but-no-engine fails startup with a clear message.
> * MUST NOT depend on the MCP Java SDK or platform-http — add a build-level
> enforcer rule so no SDK type can leak into the SPI jar (a compile-time leak
> would drag Reactor back onto the Quarkus classpath).
> h3. camel-mcp-server-engine-default
> * Official MCP Java SDK: {{io.modelcontextprotocol.sdk:mcp-core}} +
> {{mcp-json-jackson2}} (version already managed in the parent POM for
> camel-openai).
> * Streamable HTTP transport following the camel-a2a pattern: discover a
> {{RestConsumerFactory}} (typically platform-http) at startup, register the
> MCP endpoint with {{useStreaming=true}} (see {{A2AConsumer}}), stream SSE via
> a queue-backed {{InputStream}} emitter (see {{SseQueueInputStream}} /
> {{A2AStreamEmitter}}). POST answering {{application/json}} or
> {{text/event-stream}}, long-lived GET SSE channel for notifications,
> {{Mcp-Session-Id}} session management, DELETE for session termination.
> * Declared as a *runtime* dependency of {{camel-mcp-server}} so plain Camel
> users need a single dependency; downstream runtimes (camel-quarkus) exclude
> it.
> Register both modules in {{MojoHelper.getComponentPath()}} for the camel-ai
> parent folder.
> ----
> _This issue was drafted by Claude Code on behalf of Federico Mariani._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)