Croway opened a new pull request, #30343: URL: https://github.com/apache/camel/pull/30343
[CAMEL-27145](https://issues.apache.org/jira/browse/CAMEL-27145): the Camel Main / JBang MCP endpoint (`/mcp`, Vert.x engine) can now be served without sessions, so it keeps working across restarts and behind several instances without session affinity. ## What users get | Option | Values | Effect | |---|---|---| | `camel.server.mcp-protocol-era` | `dual` (default), `legacy`, `modern` | `dual` serves, on the same endpoint, the protocol versions that open with `initialize` (with a session, as before) **and** MCP protocol version 2026-07-28 (no session). `legacy` behaves as before 4.24; `modern` serves only 2026-07-28. | | `camel.server.mcp-stateless` | `false` (default), `true` | Serves the clients that open with `initialize` without a session (no `Mcp-Session-Id`), as the streamable HTTP transport allows since 2025-03-26. 2026-07-28 clients never get a session. | - With `dual`, the protocol version in the request body decides; the `MCP-Protocol-Version`, `Mcp-Method` and `Mcp-Name` headers are checked against it (HTTP 400, `-32020` on mismatch). A request is never served under the other protocol's rules. - Origin, Host and OAuth checks apply to every request. A request without a session does not need a token subject. - Serving 2026-07-28 is documented as a preview: it uses the `io.modelcontextprotocol.modern` server of the MCP Java SDK, which may still change before 3.0. `mcp-protocol-era=legacy` is the opt-out (upgrade guide entry). ## How - MCP Java SDK 2.1.0 → 2.2.0 (the legacy API is unchanged; the SDK now notifies `resources/list_changed` on template removal, so Camel's workaround is removed from both engines). - `McpProtocolEraClassifier`: decides the era from the body, cross-checks the header. - `VertxMcpModernTransport` + `McpModernCatalog`: Vert.x counterpart of the SDK's `HttpServletMcpTransport` (header validation, JSON or SSE answers, `subscriptions/listen`, keep-alive) over repositories filled as `ai-tool`/`ai-resource`/`ai-prompt` routes start and stop. - `VertxMcpStatelessServerTransport`: Vert.x counterpart of the SDK's `HttpServletStatelessServerTransport` for `mcp-stateless`. - `McpServerInfo` gains `protocolEra` and `stateless` (compatibility constructors kept); engines that do not support them (Spring Boot, Quarkus, stdio) get a startup warning when they are set. - Docs: `mcp-server.adoc` "Protocol versions" and "Serving without sessions", Main options, upgrade guide. ## Tests - Unit: `camel-mcp-server-api` 129, `camel-mcp-server` 172, green locally (new: classifier, protocol eras over HTTP, the SDK 2026-07-28 client for tools/resources/templates/prompts/`subscriptions/listen`, the SDK legacy client across a server restart with `mcp-stateless`, OAuth on both paths, Main properties). - `OfficialMcpModernConformanceIT` (opt-in, `-Dofficial-mcp-conformance`): the `@modelcontextprotocol/conformance` 2026-07-28 requirements against `mcp-protocol-era=modern`. Every transport, header and version check passes; the baseline lists features Camel does not offer on any version (multi round-trip input, tasks, completions, rich tool content). The existing `OfficialMcpConformanceIT` baseline was already stale on `main` (`prompts-list`, `dns-rebinding-protection` now pass) and is fixed here. - Manual, on Kubernetes (3 replicas, Service without session affinity, one connection per request): - default (`dual`): legacy client with a session 4/12 (only its pod), 0/12 after a rolling restart; 2026-07-28 client 12/12 across pods, and after the restart; - `mcp-stateless=true`: legacy client 12/12 across pods and 12/12 after the restart without re-initializing. ## Related - Camel Spring Boot: the starter now works with Spring AI's `spring.ai.mcp.server.protocol=STATELESS` (separate PR). - Camel Quarkus: quarkus-mcp-server already serves 2026-07-28; test and docs in a separate PR. - Spring Boot support of 2026-07-28 waits for Spring AI 2.1.0 GA: CAMEL-27174. _Claude Code on behalf of Croway_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
