CAMEL-24353: camel-mcp-server - selectable target server type for VertxMcpServerEngine - #25329
Conversation
…txMcpServerEngine The engine hardwired its router lookup to the main HTTP server. The new targetServerType property (default 'server') lets it register the MCP endpoint on the management HTTP server router instead, which ManagementHttpServer already binds in the registry with SERVER_TYPE_MANAGEMENT. An explicit management target never falls back to the public server; the bare-VertxPlatformHttpServer single-router fallback is kept for the default target only. Unblocks CAMEL-23853: the JBang dev-tools MCP can drive this SDK-backed engine directly (tools built from its ToolRegistry) instead of hand-rolling the streamable HTTP protocol. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
davsclaus
left a comment
There was a problem hiding this comment.
Clean, well-scoped enabler for CAMEL-23853. The change is backward-compatible (default SERVER_TYPE_SERVER preserves existing behavior), security-conscious (explicit management target never silently falls back to the public server), and well-tested (positive + negative cases, AssertJ assertions, proper cleanup).
One minor observation: setTargetServerType(null) would cause an unhelpful NPE in lookupRouter() — a Objects.requireNonNull in the setter would be more defensive, though this is non-blocking since the API is internal.
LGTM.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of Claus Ibsen (@davsclaus)
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 9 tested, 29 compile-only — current: 9 all testedMaveniverse Scalpel detected 38 affected modules (current approach: 9).
|
JIRA: CAMEL-24353 — the small enabler for CAMEL-23853 / #25203 discussed here.
VertxMcpServerEnginehardwired its router lookup to the main HTTP server (isMainServer()). This adds atargetServerTypeproperty (defaultserver, unchanged behavior) so the engine can register the MCP endpoint on the management HTTP server router instead —ManagementHttpServeralready binds itsVertxPlatformHttpRouterwithSERVER_TYPE_MANAGEMENTin the registry, so this is pure selection, no new plumbing.Semantics:
managementtarget never falls back to the public server (dev tools must not silently end up on the exposed port).VertxPlatformHttpServer(which carries no server type) is kept for the default target only.With this, #25203 can drive the SDK-backed engine directly —
initialize(...)+toolAdded(...)with tools built from the JBangToolRegistry— and drop its hand-rolled JSON-RPC engine while gaining the full streamable transport (sessions, SSE, GET replay, DELETE,tools/list_changed).Testing
VertxMcpServerEngineTargetServerTypeTest:managementwith both servers running: full MCP conversation (SDK client) on the management port, 404 on the main port — also exercises the bridge-less, hand-built-tools usage exactly as CAMEL-23853: Embed MCP server on camel run/dev and Camel Main #25203 would.managementtarget with no management server: fails fast with anIllegalStateExceptionnaming the management server, even though a main-server router is present.Full
camel-mcp-servermodule suite green (10 tests).This PR was written by Claude Code on behalf of Federico Mariani (@Croway).
🤖 Generated with Claude Code