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.git


The following commit(s) were added to refs/heads/main by this push:
     new e8a80a39c267 CAMEL-27246: camel-spring-ai-chat - streamableHttp 
transport for the MCP servers of the mcpServer option
e8a80a39c267 is described below

commit e8a80a39c267a4745969a03976513f560967b35d
Author: croway <[email protected]>
AuthorDate: Thu Nov 19 14:55:41 2026 +0100

    CAMEL-27246: camel-spring-ai-chat - streamableHttp transport for the MCP 
servers of the mcpServer option
    
    mcpServer.<name>.transportType=streamableHttp connects to an MCP server with
    the Streamable HTTP transport of the MCP SDK 
(HttpClientStreamableHttpTransport),
    with the same url and oauthProfile properties as sse. The url is the URL of 
the
    MCP endpoint, path and query included; a url without a path uses /mcp.
    
    The sse transport keeps working and is documented as deprecated, since the 
MCP
    specification 2025-03-26 replaced HTTP+SSE by Streamable HTTP.
---
 .../camel/catalog/components/spring-ai-chat.json   |   2 +-
 .../catalog/docs/spring-ai-chat-component.adoc     |  84 +++++-
 .../component/springai/chat/spring-ai-chat.json    |   2 +-
 .../src/main/docs/spring-ai-chat-component.adoc    |  84 +++++-
 .../springai/chat/SpringAiChatConfiguration.java   |   9 +-
 .../springai/chat/mcp/SpringAiChatMcpManager.java  |  69 ++++-
 .../chat/SpringAiChatMcpStreamableHttpTest.java    | 333 +++++++++++++++++++++
 .../chat/StubOAuthClientAuthenticationFactory.java |  47 +++
 .../camel/oauth-client-authentication-factory      |  17 ++
 .../dsl/SpringAiChatEndpointBuilderFactory.java    |  18 +-
 10 files changed, 619 insertions(+), 46 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/spring-ai-chat.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/spring-ai-chat.json
index a0b33d304f37..e03af782c92c 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/spring-ai-chat.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/spring-ai-chat.json
@@ -86,7 +86,7 @@
     "entityClass": { "index": 16, "kind": "parameter", "displayName": "Entity 
Class", "group": "advanced", "label": "advanced", "required": false, "type": 
"string", "javaType": "java.lang.Class<java.lang.Object>", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.springai.chat.SpringAiChatConfiguration", 
"configurationField": "configuration", "description": "The Java class to use 
for entity response conversion using ChatClient.ent [...]
     "maxFileSize": { "index": 17, "kind": "parameter", "displayName": "Max 
File Size", "group": "advanced", "label": "advanced", "required": false, 
"type": "integer", "javaType": "long", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": 1048576, "configurationClass": 
"org.apache.camel.component.springai.chat.SpringAiChatConfiguration", 
"configurationField": "configuration", "description": "Maximum file size in 
bytes for multimodal content (images, audio, PDFs, etc [...]
     "maxTokens": { "index": 18, "kind": "parameter", "displayName": "Max 
Tokens", "group": "advanced", "label": "advanced", "required": false, "type": 
"integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.springai.chat.SpringAiChatConfiguration", 
"configurationField": "configuration", "description": "Maximum tokens in the 
response." },
-    "mcpServer": { "index": 19, "kind": "parameter", "displayName": "Mcp 
Server", "group": "advanced", "label": "advanced", "required": false, "type": 
"object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", 
"prefix": "mcpServer.", "multiValue": true, "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.springai.chat.SpringAiChatConfiguration", 
"configurationField": "configuration", "description": "MCP server config [...]
+    "mcpServer": { "index": 19, "kind": "parameter", "displayName": "Mcp 
Server", "group": "advanced", "label": "advanced", "required": false, "type": 
"object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", 
"prefix": "mcpServer.", "multiValue": true, "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.springai.chat.SpringAiChatConfiguration", 
"configurationField": "configuration", "description": "MCP server config [...]
     "mcpTimeout": { "index": 20, "kind": "parameter", "displayName": "Mcp 
Timeout", "group": "advanced", "label": "advanced", "required": false, "type": 
"integer", "javaType": "int", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": 20, "configurationClass": 
"org.apache.camel.component.springai.chat.SpringAiChatConfiguration", 
"configurationField": "configuration", "description": "Timeout in seconds for 
MCP operations including tool execution and initialization" },
     "outputClass": { "index": 21, "kind": "parameter", "displayName": "Output 
Class", "group": "advanced", "label": "advanced", "required": false, "type": 
"string", "javaType": "java.lang.Class<java.lang.Object>", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.springai.chat.SpringAiChatConfiguration", 
"configurationField": "configuration", "description": "The Java class to use 
for BEAN output format conversion. Required when ou [...]
     "outputFormat": { "index": 22, "kind": "parameter", "displayName": "Output 
Format", "group": "advanced", "label": "advanced", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.springai.chat.SpringAiChatConfiguration", 
"configurationField": "configuration", "description": "The output format for 
structured output conversion (BEAN, MAP, LIST). Used in conjunctio [...]
diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/spring-ai-chat-component.adoc
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/spring-ai-chat-component.adoc
index a00434c853df..757593a769b7 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/spring-ai-chat-component.adoc
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/spring-ai-chat-component.adoc
@@ -1198,7 +1198,61 @@ The component supports connecting to MCP servers, 
enabling the LLM to use tools
 external MCP-compatible services. This follows the same pattern as the
 xref:openai-component.adoc[OpenAI component]'s MCP support.
 
-Configure MCP servers using the `mcpServer.<name>.<property>` prefix notation:
+Configure MCP servers using the `mcpServer.<name>.<property>` prefix notation. 
The `transportType`
+property selects how the component connects to the server:
+
+* `streamableHttp`: the Streamable HTTP transport of the MCP specification, 
for remote servers such as
+  the ones served by xref:others:mcp-server.adoc[Camel MCP Server]. Requires 
`url`.
+* `stdio`: starts the server as a local process and talks to it over standard 
input and output.
+  Requires `command`, and optionally `args`.
+* `sse` (deprecated): the HTTP+SSE transport, for servers that do not support 
Streamable HTTP yet.
+  Requires `url`.
+
+==== Streamable HTTP Transport
+
+[tabs]
+====
+Java::
++
+[source,java]
+----
+// Connect to an MCP server via Streamable HTTP
+from("direct:chat")
+    .to("spring-ai-chat:chat?chatModel=#chatModel"
+        + "&mcpServer.api.transportType=streamableHttp"
+        + "&mcpServer.api.url=http://mcp-server:8080/mcp";);
+----
+
+XML::
++
+[source,xml]
+----
+<route>
+  <from uri="direct:chat"/>
+  <to 
uri="spring-ai-chat:chat?chatModel=#chatModel&amp;mcpServer.api.transportType=streamableHttp&amp;mcpServer.api.url=http://mcp-server:8080/mcp"/>
+</route>
+----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+    from:
+      uri: direct:chat
+      steps:
+        - to:
+            uri: spring-ai-chat:chat
+            parameters:
+              chatModel: "#chatModel"
+              mcpServer.api.transportType: streamableHttp
+              mcpServer.api.url: "http://mcp-server:8080/mcp";
+----
+====
+
+The `url` is the URL of the MCP endpoint of the server, path included, for 
example
+`http://mcp-server:8080/mcp` or `https://example.com/api/mcp`. When the URL 
has no path, such as
+`http://mcp-server:8080`, the component uses `/mcp`.
 
 ==== Stdio Transport
 
@@ -1244,7 +1298,10 @@ YAML::
 ----
 ====
 
-==== SSE Transport
+==== SSE Transport (Deprecated)
+
+NOTE: The HTTP+SSE transport is deprecated: the MCP specification 2025-03-26 
replaced it by Streamable HTTP.
+Prefer `transportType=streamableHttp` when the server supports it.
 
 [tabs]
 ====
@@ -1299,8 +1356,8 @@ from("direct:chat")
         + "&mcpServer.fs.transportType=stdio"
         + "&mcpServer.fs.command=npx"
         + "&mcpServer.fs.args=-y,@modelcontextprotocol/server-filesystem,/tmp"
-        + "&mcpServer.weather.transportType=sse"
-        + "&mcpServer.weather.url=http://weather-mcp:3001/sse";);
+        + "&mcpServer.weather.transportType=streamableHttp"
+        + "&mcpServer.weather.url=http://weather-mcp:8080/mcp";);
 ----
 
 XML::
@@ -1309,7 +1366,7 @@ XML::
 ----
 <route>
   <from uri="direct:chat"/>
-  <to 
uri="spring-ai-chat:chat?chatModel=#chatModel&amp;mcpServer.fs.transportType=stdio&amp;mcpServer.fs.command=npx&amp;mcpServer.fs.args=-y,@modelcontextprotocol/server-filesystem,/tmp&amp;mcpServer.weather.transportType=sse&amp;mcpServer.weather.url=http://weather-mcp:3001/sse"/>
+  <to 
uri="spring-ai-chat:chat?chatModel=#chatModel&amp;mcpServer.fs.transportType=stdio&amp;mcpServer.fs.command=npx&amp;mcpServer.fs.args=-y,@modelcontextprotocol/server-filesystem,/tmp&amp;mcpServer.weather.transportType=streamableHttp&amp;mcpServer.weather.url=http://weather-mcp:8080/mcp"/>
 </route>
 ----
 
@@ -1328,14 +1385,15 @@ YAML::
               mcpServer.fs.transportType: stdio
               mcpServer.fs.command: npx
               mcpServer.fs.args: 
"-y,@modelcontextprotocol/server-filesystem,/tmp"
-              mcpServer.weather.transportType: sse
-              mcpServer.weather.url: "http://weather-mcp:3001/sse";
+              mcpServer.weather.transportType: streamableHttp
+              mcpServer.weather.url: "http://weather-mcp:8080/mcp";
 ----
 ====
 
 ==== OAuth Authentication for MCP Servers
 
-For MCP servers requiring authentication, configure an OAuth profile per 
server.
+For MCP servers requiring authentication, configure an OAuth profile per 
server. The component sends
+the token in the `Authorization` header of the `streamableHttp` and `sse` 
transports.
 This requires `camel-oauth` on the classpath:
 
 [tabs]
@@ -1346,8 +1404,8 @@ Java::
 ----
 from("direct:chat")
     .to("spring-ai-chat:chat?chatModel=#chatModel"
-        + "&mcpServer.api.transportType=sse"
-        + "&mcpServer.api.url=http://secure-mcp:3001/sse";
+        + "&mcpServer.api.transportType=streamableHttp"
+        + "&mcpServer.api.url=https://secure-mcp/mcp";
         + "&mcpServer.api.oauthProfile=keycloak");
 ----
 
@@ -1357,7 +1415,7 @@ XML::
 ----
 <route>
   <from uri="direct:chat"/>
-  <to 
uri="spring-ai-chat:chat?chatModel=#chatModel&amp;mcpServer.api.transportType=sse&amp;mcpServer.api.url=http://secure-mcp:3001/sse&amp;mcpServer.api.oauthProfile=keycloak"/>
+  <to 
uri="spring-ai-chat:chat?chatModel=#chatModel&amp;mcpServer.api.transportType=streamableHttp&amp;mcpServer.api.url=https://secure-mcp/mcp&amp;mcpServer.api.oauthProfile=keycloak"/>
 </route>
 ----
 
@@ -1373,8 +1431,8 @@ YAML::
             uri: spring-ai-chat:chat
             parameters:
               chatModel: "#chatModel"
-              mcpServer.api.transportType: sse
-              mcpServer.api.url: "http://secure-mcp:3001/sse";
+              mcpServer.api.transportType: streamableHttp
+              mcpServer.api.url: "https://secure-mcp/mcp";
               mcpServer.api.oauthProfile: keycloak
 ----
 ====
diff --git 
a/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/generated/resources/META-INF/org/apache/camel/component/springai/chat/spring-ai-chat.json
 
b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/generated/resources/META-INF/org/apache/camel/component/springai/chat/spring-ai-chat.json
index a0b33d304f37..e03af782c92c 100644
--- 
a/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/generated/resources/META-INF/org/apache/camel/component/springai/chat/spring-ai-chat.json
+++ 
b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/generated/resources/META-INF/org/apache/camel/component/springai/chat/spring-ai-chat.json
@@ -86,7 +86,7 @@
     "entityClass": { "index": 16, "kind": "parameter", "displayName": "Entity 
Class", "group": "advanced", "label": "advanced", "required": false, "type": 
"string", "javaType": "java.lang.Class<java.lang.Object>", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.springai.chat.SpringAiChatConfiguration", 
"configurationField": "configuration", "description": "The Java class to use 
for entity response conversion using ChatClient.ent [...]
     "maxFileSize": { "index": 17, "kind": "parameter", "displayName": "Max 
File Size", "group": "advanced", "label": "advanced", "required": false, 
"type": "integer", "javaType": "long", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": 1048576, "configurationClass": 
"org.apache.camel.component.springai.chat.SpringAiChatConfiguration", 
"configurationField": "configuration", "description": "Maximum file size in 
bytes for multimodal content (images, audio, PDFs, etc [...]
     "maxTokens": { "index": 18, "kind": "parameter", "displayName": "Max 
Tokens", "group": "advanced", "label": "advanced", "required": false, "type": 
"integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.springai.chat.SpringAiChatConfiguration", 
"configurationField": "configuration", "description": "Maximum tokens in the 
response." },
-    "mcpServer": { "index": 19, "kind": "parameter", "displayName": "Mcp 
Server", "group": "advanced", "label": "advanced", "required": false, "type": 
"object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", 
"prefix": "mcpServer.", "multiValue": true, "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.springai.chat.SpringAiChatConfiguration", 
"configurationField": "configuration", "description": "MCP server config [...]
+    "mcpServer": { "index": 19, "kind": "parameter", "displayName": "Mcp 
Server", "group": "advanced", "label": "advanced", "required": false, "type": 
"object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", 
"prefix": "mcpServer.", "multiValue": true, "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.springai.chat.SpringAiChatConfiguration", 
"configurationField": "configuration", "description": "MCP server config [...]
     "mcpTimeout": { "index": 20, "kind": "parameter", "displayName": "Mcp 
Timeout", "group": "advanced", "label": "advanced", "required": false, "type": 
"integer", "javaType": "int", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": 20, "configurationClass": 
"org.apache.camel.component.springai.chat.SpringAiChatConfiguration", 
"configurationField": "configuration", "description": "Timeout in seconds for 
MCP operations including tool execution and initialization" },
     "outputClass": { "index": 21, "kind": "parameter", "displayName": "Output 
Class", "group": "advanced", "label": "advanced", "required": false, "type": 
"string", "javaType": "java.lang.Class<java.lang.Object>", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.springai.chat.SpringAiChatConfiguration", 
"configurationField": "configuration", "description": "The Java class to use 
for BEAN output format conversion. Required when ou [...]
     "outputFormat": { "index": 22, "kind": "parameter", "displayName": "Output 
Format", "group": "advanced", "label": "advanced", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.springai.chat.SpringAiChatConfiguration", 
"configurationField": "configuration", "description": "The output format for 
structured output conversion (BEAN, MAP, LIST). Used in conjunctio [...]
diff --git 
a/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/main/docs/spring-ai-chat-component.adoc
 
b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/main/docs/spring-ai-chat-component.adoc
index a00434c853df..757593a769b7 100644
--- 
a/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/main/docs/spring-ai-chat-component.adoc
+++ 
b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/main/docs/spring-ai-chat-component.adoc
@@ -1198,7 +1198,61 @@ The component supports connecting to MCP servers, 
enabling the LLM to use tools
 external MCP-compatible services. This follows the same pattern as the
 xref:openai-component.adoc[OpenAI component]'s MCP support.
 
-Configure MCP servers using the `mcpServer.<name>.<property>` prefix notation:
+Configure MCP servers using the `mcpServer.<name>.<property>` prefix notation. 
The `transportType`
+property selects how the component connects to the server:
+
+* `streamableHttp`: the Streamable HTTP transport of the MCP specification, 
for remote servers such as
+  the ones served by xref:others:mcp-server.adoc[Camel MCP Server]. Requires 
`url`.
+* `stdio`: starts the server as a local process and talks to it over standard 
input and output.
+  Requires `command`, and optionally `args`.
+* `sse` (deprecated): the HTTP+SSE transport, for servers that do not support 
Streamable HTTP yet.
+  Requires `url`.
+
+==== Streamable HTTP Transport
+
+[tabs]
+====
+Java::
++
+[source,java]
+----
+// Connect to an MCP server via Streamable HTTP
+from("direct:chat")
+    .to("spring-ai-chat:chat?chatModel=#chatModel"
+        + "&mcpServer.api.transportType=streamableHttp"
+        + "&mcpServer.api.url=http://mcp-server:8080/mcp";);
+----
+
+XML::
++
+[source,xml]
+----
+<route>
+  <from uri="direct:chat"/>
+  <to 
uri="spring-ai-chat:chat?chatModel=#chatModel&amp;mcpServer.api.transportType=streamableHttp&amp;mcpServer.api.url=http://mcp-server:8080/mcp"/>
+</route>
+----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+    from:
+      uri: direct:chat
+      steps:
+        - to:
+            uri: spring-ai-chat:chat
+            parameters:
+              chatModel: "#chatModel"
+              mcpServer.api.transportType: streamableHttp
+              mcpServer.api.url: "http://mcp-server:8080/mcp";
+----
+====
+
+The `url` is the URL of the MCP endpoint of the server, path included, for 
example
+`http://mcp-server:8080/mcp` or `https://example.com/api/mcp`. When the URL 
has no path, such as
+`http://mcp-server:8080`, the component uses `/mcp`.
 
 ==== Stdio Transport
 
@@ -1244,7 +1298,10 @@ YAML::
 ----
 ====
 
-==== SSE Transport
+==== SSE Transport (Deprecated)
+
+NOTE: The HTTP+SSE transport is deprecated: the MCP specification 2025-03-26 
replaced it by Streamable HTTP.
+Prefer `transportType=streamableHttp` when the server supports it.
 
 [tabs]
 ====
@@ -1299,8 +1356,8 @@ from("direct:chat")
         + "&mcpServer.fs.transportType=stdio"
         + "&mcpServer.fs.command=npx"
         + "&mcpServer.fs.args=-y,@modelcontextprotocol/server-filesystem,/tmp"
-        + "&mcpServer.weather.transportType=sse"
-        + "&mcpServer.weather.url=http://weather-mcp:3001/sse";);
+        + "&mcpServer.weather.transportType=streamableHttp"
+        + "&mcpServer.weather.url=http://weather-mcp:8080/mcp";);
 ----
 
 XML::
@@ -1309,7 +1366,7 @@ XML::
 ----
 <route>
   <from uri="direct:chat"/>
-  <to 
uri="spring-ai-chat:chat?chatModel=#chatModel&amp;mcpServer.fs.transportType=stdio&amp;mcpServer.fs.command=npx&amp;mcpServer.fs.args=-y,@modelcontextprotocol/server-filesystem,/tmp&amp;mcpServer.weather.transportType=sse&amp;mcpServer.weather.url=http://weather-mcp:3001/sse"/>
+  <to 
uri="spring-ai-chat:chat?chatModel=#chatModel&amp;mcpServer.fs.transportType=stdio&amp;mcpServer.fs.command=npx&amp;mcpServer.fs.args=-y,@modelcontextprotocol/server-filesystem,/tmp&amp;mcpServer.weather.transportType=streamableHttp&amp;mcpServer.weather.url=http://weather-mcp:8080/mcp"/>
 </route>
 ----
 
@@ -1328,14 +1385,15 @@ YAML::
               mcpServer.fs.transportType: stdio
               mcpServer.fs.command: npx
               mcpServer.fs.args: 
"-y,@modelcontextprotocol/server-filesystem,/tmp"
-              mcpServer.weather.transportType: sse
-              mcpServer.weather.url: "http://weather-mcp:3001/sse";
+              mcpServer.weather.transportType: streamableHttp
+              mcpServer.weather.url: "http://weather-mcp:8080/mcp";
 ----
 ====
 
 ==== OAuth Authentication for MCP Servers
 
-For MCP servers requiring authentication, configure an OAuth profile per 
server.
+For MCP servers requiring authentication, configure an OAuth profile per 
server. The component sends
+the token in the `Authorization` header of the `streamableHttp` and `sse` 
transports.
 This requires `camel-oauth` on the classpath:
 
 [tabs]
@@ -1346,8 +1404,8 @@ Java::
 ----
 from("direct:chat")
     .to("spring-ai-chat:chat?chatModel=#chatModel"
-        + "&mcpServer.api.transportType=sse"
-        + "&mcpServer.api.url=http://secure-mcp:3001/sse";
+        + "&mcpServer.api.transportType=streamableHttp"
+        + "&mcpServer.api.url=https://secure-mcp/mcp";
         + "&mcpServer.api.oauthProfile=keycloak");
 ----
 
@@ -1357,7 +1415,7 @@ XML::
 ----
 <route>
   <from uri="direct:chat"/>
-  <to 
uri="spring-ai-chat:chat?chatModel=#chatModel&amp;mcpServer.api.transportType=sse&amp;mcpServer.api.url=http://secure-mcp:3001/sse&amp;mcpServer.api.oauthProfile=keycloak"/>
+  <to 
uri="spring-ai-chat:chat?chatModel=#chatModel&amp;mcpServer.api.transportType=streamableHttp&amp;mcpServer.api.url=https://secure-mcp/mcp&amp;mcpServer.api.oauthProfile=keycloak"/>
 </route>
 ----
 
@@ -1373,8 +1431,8 @@ YAML::
             uri: spring-ai-chat:chat
             parameters:
               chatModel: "#chatModel"
-              mcpServer.api.transportType: sse
-              mcpServer.api.url: "http://secure-mcp:3001/sse";
+              mcpServer.api.transportType: streamableHttp
+              mcpServer.api.url: "https://secure-mcp/mcp";
               mcpServer.api.oauthProfile: keycloak
 ----
 ====
diff --git 
a/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/main/java/org/apache/camel/component/springai/chat/SpringAiChatConfiguration.java
 
b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/main/java/org/apache/camel/component/springai/chat/SpringAiChatConfiguration.java
index efc52d243400..33818ae44254 100644
--- 
a/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/main/java/org/apache/camel/component/springai/chat/SpringAiChatConfiguration.java
+++ 
b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/main/java/org/apache/camel/component/springai/chat/SpringAiChatConfiguration.java
@@ -154,9 +154,9 @@ public class SpringAiChatConfiguration implements Cloneable 
{
 
     @UriParam(prefix = "mcpServer.", multiValue = true, label = "advanced",
               description = "MCP server configurations. Define servers using 
prefix notation: "
-                            + "mcpServer.<name>.transportType=stdio|sse, "
+                            + 
"mcpServer.<name>.transportType=streamableHttp|stdio|sse (sse is deprecated), "
                             + "mcpServer.<name>.command=<cmd> (stdio), 
mcpServer.<name>.args=<comma-separated> (stdio), "
-                            + "mcpServer.<name>.url=<url> (sse), "
+                            + "mcpServer.<name>.url=<url> 
(streamableHttp/sse), "
                             + "mcpServer.<name>.oauthProfile=<profile> (OAuth 
profile for HTTP auth, requires camel-oauth)")
     private Map<String, Object> mcpServer;
 
@@ -549,8 +549,9 @@ public class SpringAiChatConfiguration implements Cloneable 
{
 
     /**
      * MCP server configurations for Model Context Protocol integration. 
Define servers using prefix notation:
-     * mcpServer.&lt;name&gt;.transportType=stdio|sse, 
mcpServer.&lt;name&gt;.command=&lt;cmd&gt; (stdio),
-     * mcpServer.&lt;name&gt;.args=&lt;comma-separated&gt; (stdio), 
mcpServer.&lt;name&gt;.url=&lt;url&gt; (sse).
+     * mcpServer.&lt;name&gt;.transportType=streamableHttp|stdio|sse (sse is 
deprecated),
+     * mcpServer.&lt;name&gt;.command=&lt;cmd&gt; (stdio), 
mcpServer.&lt;name&gt;.args=&lt;comma-separated&gt; (stdio),
+     * mcpServer.&lt;name&gt;.url=&lt;url&gt; (streamableHttp/sse).
      * <p>
      * <strong>Note:</strong> Using this component with MCP alongside the 
camel-openai component with MCP may lead to
      * MCP SDK version conflicts. The spring-ai-chat component uses MCP SDK 
version managed by Spring AI BOM while
diff --git 
a/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/main/java/org/apache/camel/component/springai/chat/mcp/SpringAiChatMcpManager.java
 
b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/main/java/org/apache/camel/component/springai/chat/mcp/SpringAiChatMcpManager.java
index 919819855cf6..d3b8f97b6a60 100644
--- 
a/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/main/java/org/apache/camel/component/springai/chat/mcp/SpringAiChatMcpManager.java
+++ 
b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/main/java/org/apache/camel/component/springai/chat/mcp/SpringAiChatMcpManager.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.component.springai.chat.mcp;
 
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.http.HttpRequest;
 import java.time.Duration;
 import java.util.ArrayList;
@@ -26,6 +28,7 @@ import java.util.Map;
 import io.modelcontextprotocol.client.McpClient;
 import io.modelcontextprotocol.client.McpSyncClient;
 import io.modelcontextprotocol.client.transport.HttpClientSseClientTransport;
+import 
io.modelcontextprotocol.client.transport.HttpClientStreamableHttpTransport;
 import io.modelcontextprotocol.client.transport.ServerParameters;
 import io.modelcontextprotocol.client.transport.StdioClientTransport;
 import io.modelcontextprotocol.json.McpJsonDefaults;
@@ -42,13 +45,18 @@ import org.springframework.ai.tool.ToolCallbackProvider;
  * Manages MCP (Model Context Protocol) client lifecycle for the Spring AI 
Chat component.
  * <p>
  * Handles initialization, tool discovery via {@link 
SyncMcpToolCallbackProvider}, and graceful shutdown of MCP clients.
- * Supports stdio, sse, and sse transport types.
+ * Supports the streamableHttp, stdio and sse (deprecated) transport types.
  * </p>
  */
 public class SpringAiChatMcpManager {
 
     private static final Logger LOG = 
LoggerFactory.getLogger(SpringAiChatMcpManager.class);
 
+    /**
+     * The endpoint path of a Streamable HTTP server whose URL has no path, as 
in the MCP SDK.
+     */
+    private static final String DEFAULT_STREAMABLE_HTTP_ENDPOINT = "/mcp";
+
     private final List<McpSyncClient> mcpClients = new ArrayList<>();
     private SyncMcpToolCallbackProvider toolCallbackProvider;
 
@@ -57,12 +65,12 @@ public class SpringAiChatMcpManager {
      * <p>
      * Configuration keys follow the pattern: {@code <serverName>.<property>}. 
Supported properties:
      * <ul>
-     * <li>{@code transportType} - Required. One of: stdio, sse</li>
+     * <li>{@code transportType} - Required. One of: streamableHttp, stdio, 
sse (deprecated)</li>
      * <li>{@code command} - Required for stdio. The command to execute</li>
      * <li>{@code args} - Optional for stdio. Comma-separated arguments</li>
-     * <li>{@code url} - Required for sse. The server URL</li>
-     * <li>{@code oauthProfile} - Optional for sse. OAuth profile name for 
obtaining a Bearer token (requires
-     * camel-oauth)</li>
+     * <li>{@code url} - Required for streamableHttp and sse. The server 
URL</li>
+     * <li>{@code oauthProfile} - Optional for streamableHttp and sse. OAuth 
profile name for obtaining a Bearer token
+     * (requires camel-oauth)</li>
      * </ul>
      *
      * @param  mcpServerConfig flat configuration map with dotted keys
@@ -166,11 +174,22 @@ public class SpringAiChatMcpManager {
                 }
                 yield new StdioClientTransport(paramsBuilder.build(), 
McpJsonDefaults.getMapper());
             }
+            case "streamableHttp" -> {
+                String url = props.get("url");
+                if (url == null) {
+                    throw new IllegalArgumentException(
+                            "mcpServer." + serverName + ".url is required for 
streamableHttp transport");
+                }
+                yield createStreamableHttpTransport(serverName, url, 
authRequestBuilder);
+            }
             case "sse" -> {
                 String url = props.get("url");
                 if (url == null) {
                     throw new IllegalArgumentException("mcpServer." + 
serverName + ".url is required for sse transport");
                 }
+                LOG.info("MCP server '{}' uses the sse transport, which the 
MCP specification has replaced by Streamable HTTP."
+                         + " Use transportType=streamableHttp if the server 
supports it.",
+                        serverName);
                 HttpClientSseClientTransport.Builder sseBuilder = 
HttpClientSseClientTransport.builder(url);
                 if (authRequestBuilder != null) {
                     sseBuilder.requestBuilder(authRequestBuilder);
@@ -179,7 +198,45 @@ public class SpringAiChatMcpManager {
             }
             default -> throw new IllegalArgumentException(
                     "Unknown transport type '" + transportType + "' for 
mcpServer." + serverName
-                                                          + ". Supported: 
stdio, sse");
+                                                          + ". Supported: 
streamableHttp, stdio, sse");
         };
     }
+
+    /**
+     * Creates the Streamable HTTP transport for the MCP endpoint at the given 
URL.
+     * <p>
+     * The MCP SDK resolves its endpoint path, {@code /mcp} by default, 
against the base URL it is given, which replaces
+     * the path of that URL. The URL is therefore split into its base (scheme 
and authority) and the endpoint path, so a
+     * server served under another path, for example {@code 
http://host:8080/api/mcp}, is reached. A URL without a path,
+     * such as {@code http://host:8080}, uses {@code /mcp}.
+     */
+    private static McpClientTransport createStreamableHttpTransport(
+            String serverName, String url, HttpRequest.Builder 
authRequestBuilder) {
+        URI uri;
+        try {
+            uri = new URI(url);
+        } catch (URISyntaxException e) {
+            throw new IllegalArgumentException(
+                    "mcpServer." + serverName + ".url is not a valid URL: " + 
e.getReason(), e);
+        }
+        if (uri.getScheme() == null || uri.getRawAuthority() == null) {
+            throw new IllegalArgumentException(
+                    "mcpServer." + serverName + ".url must be an absolute URL, 
such as http://localhost:8080/mcp";);
+        }
+
+        String endpoint = uri.getRawPath();
+        if (endpoint == null || endpoint.isEmpty() || "/".equals(endpoint)) {
+            endpoint = DEFAULT_STREAMABLE_HTTP_ENDPOINT;
+        }
+        if (uri.getRawQuery() != null) {
+            endpoint = endpoint + "?" + uri.getRawQuery();
+        }
+        HttpClientStreamableHttpTransport.Builder builder
+                = HttpClientStreamableHttpTransport.builder(uri.getScheme() + 
"://" + uri.getRawAuthority())
+                        .endpoint(endpoint);
+        if (authRequestBuilder != null) {
+            builder.requestBuilder(authRequestBuilder);
+        }
+        return builder.build();
+    }
 }
diff --git 
a/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/test/java/org/apache/camel/component/springai/chat/SpringAiChatMcpStreamableHttpTest.java
 
b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/test/java/org/apache/camel/component/springai/chat/SpringAiChatMcpStreamableHttpTest.java
new file mode 100644
index 000000000000..d38536be34b2
--- /dev/null
+++ 
b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/test/java/org/apache/camel/component/springai/chat/SpringAiChatMcpStreamableHttpTest.java
@@ -0,0 +1,333 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.springai.chat;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import com.sun.net.httpserver.HttpExchange;
+import com.sun.net.httpserver.HttpHandler;
+import com.sun.net.httpserver.HttpServer;
+import io.modelcontextprotocol.common.McpTransportContext;
+import io.modelcontextprotocol.json.McpJsonDefaults;
+import io.modelcontextprotocol.json.McpJsonMapper;
+import io.modelcontextprotocol.server.McpServer;
+import io.modelcontextprotocol.server.McpStatelessServerFeatures;
+import io.modelcontextprotocol.server.McpStatelessServerHandler;
+import io.modelcontextprotocol.server.McpStatelessSyncServer;
+import io.modelcontextprotocol.spec.McpSchema;
+import io.modelcontextprotocol.spec.McpStatelessServerTransport;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.springai.chat.mcp.SpringAiChatMcpManager;
+import org.apache.camel.test.junit6.CamelTestSupport;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.ai.chat.messages.AssistantMessage;
+import org.springframework.ai.chat.messages.Message;
+import org.springframework.ai.chat.messages.ToolResponseMessage;
+import org.springframework.ai.chat.model.ChatModel;
+import org.springframework.ai.chat.model.ChatResponse;
+import org.springframework.ai.chat.model.Generation;
+import org.springframework.ai.chat.prompt.Prompt;
+import org.springframework.ai.model.tool.ToolCallingChatOptions;
+import org.springframework.ai.model.tool.ToolCallingManager;
+import org.springframework.ai.model.tool.ToolExecutionResult;
+import org.springframework.ai.tool.ToolCallback;
+import reactor.core.publisher.Mono;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+/**
+ * Connects the {@code streamableHttp} transport of the {@code mcpServer} 
option to a real MCP server: the stateless
+ * server of the MCP SDK, served over Streamable HTTP by the HTTP server of 
the JDK.
+ */
+class SpringAiChatMcpStreamableHttpTest extends CamelTestSupport {
+
+    private static final Set<String> SERVED_PATHS = Set.of("/mcp", "/api/mcp");
+    private static final List<RecordedRequest> REQUESTS = new 
CopyOnWriteArrayList<>();
+
+    private static ExecutorService executor;
+    private static HttpServer httpServer;
+    private static McpStatelessSyncServer mcpServer;
+    private static String serverUrl;
+
+    private final List<String> offeredTools = new CopyOnWriteArrayList<>();
+    private ChatModel chatModel;
+
+    private record RecordedRequest(String httpMethod, String path, String 
query, String authorization, String rpcMethod) {
+    }
+
+    @BeforeAll
+    static void startMcpServer() throws IOException {
+        JdkHttpStatelessServerTransport transport = new 
JdkHttpStatelessServerTransport();
+        McpSchema.Tool echo = McpSchema.Tool.builder("echo",
+                Map.of("type", "object",
+                        "properties", Map.of("message", Map.of("type", 
"string")),
+                        "required", List.of("message")))
+                .description("Echoes the message")
+                .build();
+        mcpServer = McpServer.sync(transport)
+                .serverInfo("streamable-http-test-server", "1.0.0")
+                
.capabilities(McpSchema.ServerCapabilities.builder().tools(false).build())
+                
.tools(McpStatelessServerFeatures.SyncToolSpecification.builder()
+                        .tool(echo)
+                        .callHandler((context, request) -> 
McpSchema.CallToolResult.builder(List.of(
+                                McpSchema.TextContent.builder("echo: " + 
request.arguments().get("message")).build()))
+                                .build())
+                        .build())
+                .build();
+
+        InetAddress loopback = InetAddress.getLoopbackAddress();
+        executor = Executors.newFixedThreadPool(4);
+        httpServer = HttpServer.create(new InetSocketAddress(loopback, 0), 0);
+        httpServer.createContext("/", transport);
+        httpServer.setExecutor(executor);
+        httpServer.start();
+        serverUrl = "http://"; + loopback.getHostAddress() + ":" + 
httpServer.getAddress().getPort();
+    }
+
+    @AfterAll
+    static void stopMcpServer() {
+        if (httpServer != null) {
+            httpServer.stop(0);
+        }
+        if (executor != null) {
+            executor.shutdownNow();
+        }
+        if (mcpServer != null) {
+            mcpServer.close();
+        }
+    }
+
+    @BeforeEach
+    void resetRequests() {
+        REQUESTS.clear();
+    }
+
+    @Override
+    protected void setupResources() throws Exception {
+        super.setupResources();
+        // Like the chat models of Spring AI, the stub runs the tool call it 
asks for with a ToolCallingManager, then
+        // answers with the result of the tool
+        ToolCallingManager toolCallingManager = 
ToolCallingManager.builder().build();
+        chatModel = mock(ChatModel.class);
+        
when(chatModel.getOptions()).thenReturn(ToolCallingChatOptions.builder().build());
+        when(chatModel.call(any(Prompt.class))).thenAnswer(invocation -> {
+            Prompt prompt = invocation.getArgument(0);
+            offeredTools.addAll(toolNames(prompt));
+            AssistantMessage toolCall = AssistantMessage.builder()
+                    .content("")
+                    .toolCalls(List.of(new AssistantMessage.ToolCall(
+                            "call-1", "function", "echo", 
"{\"message\":\"hello\"}")))
+                    .build();
+            ToolExecutionResult result
+                    = toolCallingManager.executeToolCalls(prompt, new 
ChatResponse(List.of(new Generation(toolCall))));
+            List<Message> history = result.conversationHistory();
+            ToolResponseMessage toolResponse = (ToolResponseMessage) 
history.get(history.size() - 1);
+            return new ChatResponse(
+                    List.of(new Generation(
+                            new 
AssistantMessage(toolResponse.getResponses().get(0).responseData()))));
+        });
+    }
+
+    @Test
+    void chatCallsAToolOfTheServerAtThePathOfTheUrl() throws Exception {
+        context.getRegistry().bind("chatModel", chatModel);
+        context.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() {
+                from("direct:chat")
+                        
.to("spring-ai-chat:chat?chatModel=#chatModel&mcpTimeout=10"
+                            + "&mcpServer.local.transportType=streamableHttp"
+                            + "&mcpServer.local.url=" + serverUrl + "/api/mcp"
+                            + "&mcpServer.local.oauthProfile=local");
+            }
+        });
+
+        String response = template.requestBody("direct:chat", "Echo hello", 
String.class);
+
+        assertThat(response).contains("echo: hello");
+        assertThat(offeredTools).contains("echo");
+        assertThat(rpcMethods()).contains("initialize", 
"notifications/initialized", "tools/list", "tools/call");
+        assertThat(postRequests()).allSatisfy(request -> {
+            assertThat(request.path()).isEqualTo("/api/mcp");
+            assertThat(request.authorization())
+                    .isEqualTo("Bearer " + 
StubOAuthClientAuthenticationFactory.tokenFor("local"));
+        });
+    }
+
+    @Test
+    void urlWithoutPathUsesMcp() throws Exception {
+        SpringAiChatMcpManager manager = new SpringAiChatMcpManager();
+        try {
+            manager.initialize(Map.<String, Object> of("local.transportType", 
"streamableHttp", "local.url", serverUrl), 10,
+                    context);
+
+            assertThat(callbackNames(manager)).containsExactly("echo");
+            assertThat(postRequests()).isNotEmpty().allSatisfy(request -> {
+                assertThat(request.path()).isEqualTo("/mcp");
+                assertThat(request.authorization()).isNull();
+            });
+        } finally {
+            manager.close();
+        }
+    }
+
+    @Test
+    void urlKeepsItsQuery() throws Exception {
+        SpringAiChatMcpManager manager = new SpringAiChatMcpManager();
+        try {
+            manager.initialize(Map.<String, Object> of("local.transportType", 
"streamableHttp",
+                    "local.url", serverUrl + "/api/mcp?tenant=acme"), 10, 
context);
+
+            assertThat(callbackNames(manager)).containsExactly("echo");
+            assertThat(postRequests()).isNotEmpty().allSatisfy(request -> {
+                assertThat(request.path()).isEqualTo("/api/mcp");
+                assertThat(request.query()).isEqualTo("tenant=acme");
+            });
+        } finally {
+            manager.close();
+        }
+    }
+
+    @Test
+    void streamableHttpRequiresAnAbsoluteUrl() {
+        SpringAiChatMcpManager manager = new SpringAiChatMcpManager();
+
+        assertThatThrownBy(
+                () -> manager.initialize(Map.<String, Object> 
of("local.transportType", "streamableHttp"), 10, context))
+                .isInstanceOf(IllegalArgumentException.class)
+                .hasMessage("mcpServer.local.url is required for 
streamableHttp transport");
+        assertThatThrownBy(() -> manager.initialize(
+                Map.<String, Object> of("local.transportType", 
"streamableHttp", "local.url", "mcp-server/mcp"), 10,
+                context))
+                .isInstanceOf(IllegalArgumentException.class)
+                .hasMessageContaining("mcpServer.local.url must be an absolute 
URL");
+    }
+
+    @Test
+    void unknownTransportListsTheSupportedOnes() {
+        SpringAiChatMcpManager manager = new SpringAiChatMcpManager();
+
+        assertThatThrownBy(() -> manager.initialize(Map.<String, Object> 
of("local.transportType", "websocket"), 10, context))
+                .isInstanceOf(IllegalArgumentException.class)
+                .hasMessageEndingWith("Supported: streamableHttp, stdio, sse");
+    }
+
+    private static List<String> rpcMethods() {
+        return 
REQUESTS.stream().map(RecordedRequest::rpcMethod).filter(Objects::nonNull).toList();
+    }
+
+    /**
+     * The POST requests, which carry the JSON-RPC messages and complete 
before the call that sent them returns. The GET
+     * request that opens the optional SSE stream is sent in the background.
+     */
+    private static List<RecordedRequest> postRequests() {
+        return REQUESTS.stream().filter(request -> 
"POST".equals(request.httpMethod())).toList();
+    }
+
+    private static List<String> callbackNames(SpringAiChatMcpManager manager) {
+        List<String> names = new ArrayList<>();
+        for (ToolCallback callback : 
manager.getToolCallbackProvider().getToolCallbacks()) {
+            names.add(callback.getToolDefinition().name());
+        }
+        return names;
+    }
+
+    private static List<String> toolNames(Prompt prompt) {
+        if (!(prompt.getOptions() instanceof ToolCallingChatOptions options) 
|| options.getToolCallbacks() == null) {
+            return List.of();
+        }
+        List<String> names = new ArrayList<>();
+        options.getToolCallbacks().forEach(callback -> 
names.add(callback.getToolDefinition().name()));
+        return names;
+    }
+
+    /**
+     * Serves the stateless Streamable HTTP transport of the MCP SDK with the 
HTTP server of the JDK, as the
+     * {@code HttpServletStatelessServerTransport} of the SDK does in a 
servlet container: a POST carries one JSON-RPC
+     * message, a request is answered with a JSON response and a notification 
with 202 Accepted, and the GET that opens
+     * the optional SSE stream is refused with 405 Method Not Allowed.
+     */
+    private static final class JdkHttpStatelessServerTransport implements 
McpStatelessServerTransport, HttpHandler {
+
+        private final McpJsonMapper jsonMapper = McpJsonDefaults.getMapper();
+        private volatile McpStatelessServerHandler mcpHandler;
+
+        @Override
+        public void setMcpHandler(McpStatelessServerHandler mcpHandler) {
+            this.mcpHandler = mcpHandler;
+        }
+
+        @Override
+        public Mono<Void> closeGracefully() {
+            return Mono.empty();
+        }
+
+        @Override
+        public void handle(HttpExchange exchange) throws IOException {
+            try {
+                String httpMethod = exchange.getRequestMethod();
+                String path = exchange.getRequestURI().getPath();
+                String query = exchange.getRequestURI().getRawQuery();
+                String authorization = 
exchange.getRequestHeaders().getFirst("Authorization");
+                if (!SERVED_PATHS.contains(path) || 
!"POST".equals(httpMethod)) {
+                    REQUESTS.add(new RecordedRequest(httpMethod, path, query, 
authorization, null));
+                    exchange.sendResponseHeaders(SERVED_PATHS.contains(path) ? 
405 : 404, -1);
+                    return;
+                }
+
+                String body = new 
String(exchange.getRequestBody().readAllBytes(), StandardCharsets.UTF_8);
+                McpSchema.JSONRPCMessage message = 
McpSchema.deserializeJsonRpcMessage(jsonMapper, body);
+                if (message instanceof McpSchema.JSONRPCRequest request) {
+                    REQUESTS.add(new RecordedRequest(httpMethod, path, query, 
authorization, request.method()));
+                    McpSchema.JSONRPCResponse response
+                            = 
mcpHandler.handleRequest(McpTransportContext.EMPTY, request).block();
+                    byte[] json = 
jsonMapper.writeValueAsString(response).getBytes(StandardCharsets.UTF_8);
+                    exchange.getResponseHeaders().set("Content-Type", 
"application/json");
+                    exchange.sendResponseHeaders(200, json.length);
+                    exchange.getResponseBody().write(json);
+                } else if (message instanceof McpSchema.JSONRPCNotification 
notification) {
+                    REQUESTS.add(new RecordedRequest(httpMethod, path, query, 
authorization, notification.method()));
+                    mcpHandler.handleNotification(McpTransportContext.EMPTY, 
notification).block();
+                    exchange.sendResponseHeaders(202, -1);
+                } else {
+                    REQUESTS.add(new RecordedRequest(httpMethod, path, query, 
authorization, null));
+                    exchange.sendResponseHeaders(400, -1);
+                }
+            } finally {
+                exchange.close();
+            }
+        }
+    }
+}
diff --git 
a/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/test/java/org/apache/camel/component/springai/chat/StubOAuthClientAuthenticationFactory.java
 
b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/test/java/org/apache/camel/component/springai/chat/StubOAuthClientAuthenticationFactory.java
new file mode 100644
index 000000000000..cd9b0247358e
--- /dev/null
+++ 
b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/test/java/org/apache/camel/component/springai/chat/StubOAuthClientAuthenticationFactory.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.springai.chat;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.spi.OAuthClientAuthenticationFactory;
+import org.apache.camel.spi.OAuthClientConfig;
+
+/**
+ * Stands in for camel-oauth in tests: returns a fixed token per profile, 
without calling a token endpoint. Registered
+ * in {@code 
META-INF/services/org/apache/camel/oauth-client-authentication-factory}.
+ */
+public class StubOAuthClientAuthenticationFactory implements 
OAuthClientAuthenticationFactory {
+
+    static String tokenFor(String profileName) {
+        return "token-for-" + profileName;
+    }
+
+    @Override
+    public String resolveToken(OAuthClientConfig config) {
+        throw new UnsupportedOperationException("Only named profiles are 
supported by this stub");
+    }
+
+    @Override
+    public String resolveToken(CamelContext context, String profileName) {
+        return tokenFor(profileName);
+    }
+
+    @Override
+    public String resolveToken(CamelContext context) {
+        throw new UnsupportedOperationException("Only named profiles are 
supported by this stub");
+    }
+}
diff --git 
a/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/test/resources/META-INF/services/org/apache/camel/oauth-client-authentication-factory
 
b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/test/resources/META-INF/services/org/apache/camel/oauth-client-authentication-factory
new file mode 100644
index 000000000000..bbaad28574f2
--- /dev/null
+++ 
b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/test/resources/META-INF/services/org/apache/camel/oauth-client-authentication-factory
@@ -0,0 +1,17 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+class=org.apache.camel.component.springai.chat.StubOAuthClientAuthenticationFactory
diff --git 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SpringAiChatEndpointBuilderFactory.java
 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SpringAiChatEndpointBuilderFactory.java
index 03ccef75109f..9ed1378cb8e6 100644
--- 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SpringAiChatEndpointBuilderFactory.java
+++ 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SpringAiChatEndpointBuilderFactory.java
@@ -758,10 +758,11 @@ public interface SpringAiChatEndpointBuilderFactory {
         }
         /**
          * MCP server configurations. Define servers using prefix notation:
-         * mcpServer..transportType=stdio|sse, mcpServer..command= (stdio),
-         * mcpServer..args= (stdio), mcpServer..url= (sse),
-         * mcpServer..oauthProfile= (OAuth profile for HTTP auth, requires
-         * camel-oauth). This is a multi-value option with prefix: mcpServer.
+         * mcpServer..transportType=streamableHttp|stdio|sse (sse is
+         * deprecated), mcpServer..command= (stdio), mcpServer..args= (stdio),
+         * mcpServer..url= (streamableHttp/sse), mcpServer..oauthProfile= 
(OAuth
+         * profile for HTTP auth, requires camel-oauth). This is a multi-value
+         * option with prefix: mcpServer.
          * 
          * The option is a: <code>java.util.Map&lt;java.lang.String,
          * java.lang.Object&gt;</code> type.
@@ -781,10 +782,11 @@ public interface SpringAiChatEndpointBuilderFactory {
         }
         /**
          * MCP server configurations. Define servers using prefix notation:
-         * mcpServer..transportType=stdio|sse, mcpServer..command= (stdio),
-         * mcpServer..args= (stdio), mcpServer..url= (sse),
-         * mcpServer..oauthProfile= (OAuth profile for HTTP auth, requires
-         * camel-oauth). This is a multi-value option with prefix: mcpServer.
+         * mcpServer..transportType=streamableHttp|stdio|sse (sse is
+         * deprecated), mcpServer..command= (stdio), mcpServer..args= (stdio),
+         * mcpServer..url= (streamableHttp/sse), mcpServer..oauthProfile= 
(OAuth
+         * profile for HTTP auth, requires camel-oauth). This is a multi-value
+         * option with prefix: mcpServer.
          * 
          * The option is a: <code>java.util.Map&lt;java.lang.String,
          * java.lang.Object&gt;</code> type.

Reply via email to