[
https://issues.apache.org/jira/browse/CAMEL-26298?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen reassigned CAMEL-26298:
-----------------------------------
Assignee: Claus Ibsen
> camel run --mcp-stdio fails at startup: No McpJsonMapperSupplier available
> --------------------------------------------------------------------------
>
> Key: CAMEL-26298
> URL: https://issues.apache.org/jira/browse/CAMEL-26298
> Project: Camel
> Issue Type: Bug
> Components: camel-jbang, camel-mcp-server
> Affects Versions: 4.23.0
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Major
> Fix For: 4.24.0
>
>
> {{camel run --mcp-stdio}} does not start, in Camel 4.23.0 and on main
> (4.24.0-SNAPSHOT).
> *How to reproduce*
> {{tools.yaml}}:
> {code:yaml}
> - route:
> from:
> uri: ai-tool:hello
> parameters:
> tags: demo
> description: Say hello
> steps:
> - setBody:
> expression:
> constant:
> expression: Hello
> {code}
> {code}
> camel run tools.yaml --mcp-stdio --mcp-tags=demo
> camel run tools.yaml --camel-version=4.23.0 --mcp-stdio --mcp-tags=demo
> {code}
> Both stop at startup with:
> {code}
> java.util.ServiceConfigurationError: No McpJsonMapperSupplier available for
> creating McpJsonMapper
> at
> io.modelcontextprotocol.util.McpServiceLoader.getDefault(McpServiceLoader.java:59)
> at
> io.modelcontextprotocol.json.McpJsonDefaults.getMapper(McpJsonDefaults.java:58)
> at
> org.apache.camel.component.mcp.server.stdio.StdioMcpServerEngine.initialize(StdioMcpServerEngine.java:85)
> at
> org.apache.camel.component.mcp.server.McpServerBridge.doInit(McpServerBridge.java:135)
> ...
> at
> org.apache.camel.main.BaseMainSupport.setupMcpServer(BaseMainSupport.java:2326)
> {code}
> camel-mcp-server has {{mcp-json-jackson2}} as a normal dependency, so the jar
> is on the classpath. Most likely the MCP SDK's service lookup does not see it
> in the class loader that Camel JBang uses for downloaded dependencies (not
> verified). The stdio tests in camel-mcp-server run on a normal classpath, so
> they do not catch this.
> The 4.23 release notes and the mcp-server documentation show {{camel run
> tools.yaml --mcp-stdio}}, including a Claude Desktop configuration, so users
> will try it.
> *Second problem: route output goes into the MCP stream*
> In stdio mode the MCP protocol is written to {{System.out}}, and nothing
> redirects {{System.out}} ({{StdioMcpServerEngine.setTransportStreams}} is
> never called). Logging goes to stderr, which is fine. But a route that writes
> to {{stream:out}}, a {{System.out.println}} in a bean, or a library banner
> writes into the MCP stream and breaks the client. This could not be tested
> yet, because of the startup error.
> Suggested fix: in stdio mode, give the MCP transport the original
> {{System.out}} ({{setTransportStreams}}), and point {{System.out}} at stderr.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)