[ 
https://issues.apache.org/jira/browse/CAMEL-27248?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-27248.
---------------------------------
    Resolution: Fixed

Merged on main in https://github.com/apache/camel/pull/30669 (c53a044cfedd), 
fix version 4.24.0. The 4.22.x backport is 
https://github.com/apache/camel/pull/30670 (open); add its fix version when it 
is merged.

_Claude Code on behalf of davsclaus_

> camel-openai, camel-spring-ai-chat - the path of the mcpServer url is 
> ignored, so an MCP server on another path is not reached
> ------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27248
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27248
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-openai, camel-spring-ai
>            Reporter: Federico Mariani
>            Assignee: Federico Mariani
>            Priority: Major
>             Fix For: 4.24.0
>
>
> With {{transportType=streamableHttp}} (camel-openai) or {{transportType=sse}} 
> (camel-openai and camel-spring-ai-chat), the {{mcpServer.<name>.url}} is 
> passed to {{HttpClientStreamableHttpTransport.builder(url)}} or 
> {{HttpClientSseClientTransport.builder(url)}} as the base URI. The MCP Java 
> SDK resolves its endpoint, {{/mcp}} or {{/sse}} by default, against that base 
> with {{URI.resolve}} ({{Utils.resolveUri}}), and an absolute path replaces 
> the path of the base:
> * {{url=http://host:8080/api/mcp}} sends the requests to 
> {{http://host:8080/mcp}}
> * {{url=http://host:8080/custom/sse}} opens {{http://host:8080/sse}}
> So an MCP server whose endpoint is not {{/mcp}} or {{/sse}} cannot be 
> reached, although the url in the configuration is right: for example 
> camel-mcp-server with {{camel.server.mcp-path}} set, or a server behind a 
> gateway path prefix. camel-langchain4j-agent is not affected: it passes the 
> url as the endpoint.
> h3. Fix
> Split the url into its base (scheme and authority) and its endpoint (path and 
> query), and pass the endpoint with {{endpoint(...)}} or {{sseEndpoint(...)}}. 
> A url without a path keeps the SDK default. CAMEL-27246 does this for the new 
> {{streamableHttp}} transport of camel-spring-ai-chat.
> A url whose path is not the endpoint, such as {{http://host:8080/v1}} for a 
> server on {{/mcp}}, works today by accident and would then fail, so the fix 
> needs an upgrade guide entry.
> _Claude Code on behalf of Croway_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to