This is an automated email from the ASF dual-hosted git repository.

Croway pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git


The following commit(s) were added to refs/heads/main by this push:
     new bb373fd1639 CAMEL-27241: camel-mcp-server-starter - the Spring AI 
notes name 2.1
bb373fd1639 is described below

commit bb373fd1639933c9cec58a34217811ef72f17661
Author: croway <[email protected]>
AuthorDate: Fri Nov 20 15:20:01 2026 +0100

    CAMEL-27241: camel-mcp-server-starter - the Spring AI notes name 2.1
    
    The starter runs on Spring AI 2.1.0, but its Origin-rejection note and two 
code comments still named Spring AI 2.0.2.
    On 2.1.0 the behaviour they describe is unchanged: the Streamable HTTP, 
stateless and 2026-07-28 WebMVC transports answer
    an Origin rejection with HTTP 403 and a plain-text "Invalid Origin header" 
body, and the Streamable HTTP and stateless
    transport builders still only take the deprecated 
ServerTransportSecurityValidator.
    
    The stateless and 2026-07-28 tests now also assert the rejection body, as 
the Streamable HTTP test already does.
---
 .../camel-mcp-server-starter/src/main/doc/usage.adoc       |  7 ++++---
 .../CamelMcpServerStatelessTransportAutoConfiguration.java |  2 +-
 .../server/CamelMcpServerTransportAutoConfiguration.java   | 14 ++++++++------
 .../mcp/server/SpringBootMcpServerModernTest.java          |  4 +++-
 .../mcp/server/SpringBootMcpServerStatelessTest.java       |  4 +++-
 .../modules/ROOT/pages/starters/mcp-server.adoc            |  7 ++++---
 6 files changed, 23 insertions(+), 15 deletions(-)

diff --git 
a/components-starter/camel-mcp-server-starter/src/main/doc/usage.adoc 
b/components-starter/camel-mcp-server-starter/src/main/doc/usage.adoc
index 41d08923c61..41da5a93335 100644
--- a/components-starter/camel-mcp-server-starter/src/main/doc/usage.adoc
+++ b/components-starter/camel-mcp-server-starter/src/main/doc/usage.adoc
@@ -185,13 +185,14 @@ extraction are not active in that configuration. Select
 `spring.ai.mcp.server.protocol=STREAMABLE` (or `STATELESS` or `MODERN`) when
 those protections are required.
 
-With the Spring AI 2.0.2 WebMVC transport, an Origin rejection currently
-returns HTTP 403 with a plain-text `Invalid Origin header` response body.
+With the Spring AI 2.1 WebMVC transports (`STREAMABLE`, `STATELESS` and
+`MODERN`), an Origin rejection returns HTTP 403 with a plain-text
+`Invalid Origin header` response body.
 The rejection occurs before MCP request dispatch, but this response body is
 not the JSON-RPC error envelope returned by the Camel Main HTTP engine.
 Treat the HTTP status and pre-dispatch rejection as the enforced transport
 security boundary; the response-envelope difference remains a runtime parity
-limitation of the current Spring AI WebMVC transport.
+limitation of the Spring AI WebMVC transports.
 
 Origin validation is independent of CORS. Configure CORS separately when a
 browser client needs cross-origin response access; CORS response headers do
diff --git 
a/components-starter/camel-mcp-server-starter/src/main/java/org/apache/camel/springboot/mcp/server/CamelMcpServerStatelessTransportAutoConfiguration.java
 
b/components-starter/camel-mcp-server-starter/src/main/java/org/apache/camel/springboot/mcp/server/CamelMcpServerStatelessTransportAutoConfiguration.java
index e66681717bd..ac37fa806ad 100644
--- 
a/components-starter/camel-mcp-server-starter/src/main/java/org/apache/camel/springboot/mcp/server/CamelMcpServerStatelessTransportAutoConfiguration.java
+++ 
b/components-starter/camel-mcp-server-starter/src/main/java/org/apache/camel/springboot/mcp/server/CamelMcpServerStatelessTransportAutoConfiguration.java
@@ -66,7 +66,7 @@ import tools.jackson.databind.json.JsonMapper;
 })
 public class CamelMcpServerStatelessTransportAutoConfiguration {
 
-    // Spring AI 2.0.2's builder still takes the deprecated 
ServerTransportSecurityValidator, see
+    // Spring AI 2.1's builder still takes the deprecated 
ServerTransportSecurityValidator, see
     // CamelMcpServerTransportAutoConfiguration#createOriginValidator
     @SuppressWarnings("deprecation")
     @Bean
diff --git 
a/components-starter/camel-mcp-server-starter/src/main/java/org/apache/camel/springboot/mcp/server/CamelMcpServerTransportAutoConfiguration.java
 
b/components-starter/camel-mcp-server-starter/src/main/java/org/apache/camel/springboot/mcp/server/CamelMcpServerTransportAutoConfiguration.java
index 09344da7b25..3efc0474be1 100644
--- 
a/components-starter/camel-mcp-server-starter/src/main/java/org/apache/camel/springboot/mcp/server/CamelMcpServerTransportAutoConfiguration.java
+++ 
b/components-starter/camel-mcp-server-starter/src/main/java/org/apache/camel/springboot/mcp/server/CamelMcpServerTransportAutoConfiguration.java
@@ -135,13 +135,15 @@ public class CamelMcpServerTransportAutoConfiguration {
     }
 
     /**
-     * Compatibility adapter for Spring AI 2.0.2. Its WebMVC provider builder
-     * still accepts ServerTransportSecurityValidator rather than the newer
-     * ServerHttpHeaderValidator. The validation itself is performed by the
-     * non-deprecated SDK validator above.
+     * Compatibility adapter for Spring AI 2.1. Its WebMVC Streamable HTTP and
+     * stateless transport builders still accept 
ServerTransportSecurityValidator
+     * rather than the newer ServerHttpHeaderValidator, which only its MCP
+     * protocol version 2026-07-28 transport takes. The validation itself is
+     * performed by the non-deprecated SDK validator above.
      *
      * Remove this adapter when Spring AI exposes httpHeaderValidator(...) on
-     * WebMvcStreamableServerTransportProvider.Builder.
+     * WebMvcStreamableServerTransportProvider.Builder and
+     * WebMvcStatelessServerTransport.Builder.
      */
     @SuppressWarnings("deprecation")
     public static ServerTransportSecurityValidator 
createOriginValidator(String configuredAllowedOrigins) {
@@ -150,7 +152,7 @@ public class CamelMcpServerTransportAutoConfiguration {
     }
 
     /**
-     * Adapts Spring AI 2.0.2's legacy map-based callback to the MCP SDK
+     * Adapts Spring AI 2.1's legacy map-based callback to the MCP SDK
      * HeaderAccessor API.
      */
     private static final class MapHeaderAccessor implements HeaderAccessor {
diff --git 
a/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerModernTest.java
 
b/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerModernTest.java
index 5a937bf06bf..21898eb51a8 100644
--- 
a/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerModernTest.java
+++ 
b/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerModernTest.java
@@ -256,7 +256,9 @@ public class SpringBootMcpServerModernTest {
 
         assertThat(post(DISCOVER, discover).statusCode()).isEqualTo(200);
         assertThat(post(DISCOVER, withOrigin(discover, 
"http://localhost:3000";)).statusCode()).isEqualTo(200);
-        assertThat(post(DISCOVER, withOrigin(discover, 
"https://attacker.example";)).statusCode()).isEqualTo(403);
+        HttpResponse<String> rejected = post(DISCOVER, withOrigin(discover, 
"https://attacker.example";));
+        assertThat(rejected.statusCode()).isEqualTo(403);
+        assertThat(rejected.body()).contains("Invalid Origin header");
     }
 
     private McpSyncClient client() {
diff --git 
a/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerStatelessTest.java
 
b/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerStatelessTest.java
index 147f6672c54..def6afa3984 100644
--- 
a/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerStatelessTest.java
+++ 
b/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerStatelessTest.java
@@ -163,7 +163,9 @@ public class SpringBootMcpServerStatelessTest {
     @Test
     void originIsValidated() throws Exception {
         assertThat(post(INITIALIZE, 
"http://localhost:3000";).statusCode()).isEqualTo(200);
-        assertThat(post(INITIALIZE, 
"https://attacker.example";).statusCode()).isEqualTo(403);
+        HttpResponse<String> rejected = post(INITIALIZE, 
"https://attacker.example";);
+        assertThat(rejected.statusCode()).isEqualTo(403);
+        assertThat(rejected.body()).contains("Invalid Origin header");
     }
 
     private HttpResponse<String> post(String body, String origin) throws 
Exception {
diff --git a/docs/spring-boot/modules/ROOT/pages/starters/mcp-server.adoc 
b/docs/spring-boot/modules/ROOT/pages/starters/mcp-server.adoc
index 90adc9d660f..a6ce3c965dd 100644
--- a/docs/spring-boot/modules/ROOT/pages/starters/mcp-server.adoc
+++ b/docs/spring-boot/modules/ROOT/pages/starters/mcp-server.adoc
@@ -380,13 +380,14 @@ extraction are not active in that configuration. Select
 `spring.ai.mcp.server.protocol=STREAMABLE` (or `STATELESS` or `MODERN`) when
 those protections are required.
 
-With the Spring AI 2.0.2 WebMVC transport, an Origin rejection currently
-returns HTTP 403 with a plain-text `Invalid Origin header` response body.
+With the Spring AI 2.1 WebMVC transports (`STREAMABLE`, `STATELESS` and
+`MODERN`), an Origin rejection returns HTTP 403 with a plain-text
+`Invalid Origin header` response body.
 The rejection occurs before MCP request dispatch, but this response body is
 not the JSON-RPC error envelope returned by the Camel Main HTTP engine.
 Treat the HTTP status and pre-dispatch rejection as the enforced transport
 security boundary; the response-envelope difference remains a runtime parity
-limitation of the current Spring AI WebMVC transport.
+limitation of the Spring AI WebMVC transports.
 
 Origin validation is independent of CORS. Configure CORS separately when a
 browser client needs cross-origin response access; CORS response headers do

Reply via email to