Repository navigation
CAMEL-27145: camel-mcp-server-starter - serve the Camel routes on the Spring AI stateless MCP server - #2112
Merged
Conversation
… Spring AI stateless MCP server With spring.ai.mcp.server.protocol=STATELESS, Spring AI auto-configures an McpStatelessSyncServer instead of an McpSyncServer, and the starter registered nothing. The engine now publishes into either server, and Camel's Origin validation and caller-context extraction are installed on the stateless WebMVC transport too. Each request is served without a session, so restarts and several instances without session affinity no longer end the client's session.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CAMEL-27145: the MCP server starter now serves the Camel
ai-tool,ai-resourceandai-promptroutes when Spring AI runs its stateless MCP server.Problem
With
spring.ai.mcp.server.protocol=STATELESS, Spring AI auto-configures anMcpStatelessSyncServerinstead of anMcpSyncServer.CamelMcpServerAutoConfigurationwas@ConditionalOnBean(McpSyncServer.class), so the starter silently registered nothing.Change
SpringAiMcpServerEnginepublishes into either Spring AI server through a small internal adapter. Handlers receive the MCP transport context, so the caller identity reaches the route as before.CamelMcpServerAutoConfigurationactivates on either server bean (AnyNestedCondition), and runs after Spring AI's stateless auto-configuration too.CamelMcpServerStatelessTransportAutoConfiguration: the counterpart ofCamelMcpServerTransportAutoConfigurationforSTATELESS. It installs Camel's Origin validation and caller-context extraction on Spring AI'sWebMvcStatelessServerTransport; an application-provided transport takes precedence.STREAMABLEorSTATELESS.Without a session, every request is served on its own: restarts and several instances without session affinity no longer end the client's session. Such clients receive no notifications (they see changed lists at their next list request), and a
GETon the endpoint is answered with 405 by Spring AI.MCP protocol version 2026-07-28 needs Spring AI 2.1.0 (
spring.ai.mcp.server.protocol=MODERN): CAMEL-27174.Tests
SpringBootMcpServerStatelessTest: the MCP SDK client lists and calls tools, the Spring Security caller reaches the route,initializereturns noMcp-Session-Id,GETis answered 405, and Origin is validated. The starter's 55 tests are green locally.Related: apache/camel#30343 (Camel Main / JBang side of CAMEL-27145).
Claude Code on behalf of Croway