davsclaus opened a new pull request, #30619: URL: https://github.com/apache/camel/pull/30619
## Summary [CAMEL-27404](https://issues.apache.org/jira/browse/CAMEL-27404), found while adding the ai-tool-source Kamelet (apache/camel-kamelets#3364). What I found while reproducing it with `camel run` on current main: | `camel.server.mcp-enabled=true` set with | `camel.server.enabled=true` also set | without it | |---|---|---| | `application.properties` | works | fails: "The MCP server requires the Vert.x platform HTTP server" | | `--prop` | works (both jars downloaded on demand) | fails, same error | | `-D` (JVM system property) | works | fails, same error | The runtime already reads the `camel.server.mcp-*` options from every source and downloads `camel-mcp-server` and `camel-platform-http-main` on demand. Two things were missing: 1. MCP over HTTP needs the HTTP server, and `camel.server.mcp-enabled` alone did not turn it on. 2. The CLI read `camel.server.mcp-enabled` and `camel.server.mcp-transport` only from the properties file, so `--mcp-tags` was ignored and MCP over stdio from `--prop`/`-D` logged to stdout. In one run, 23 log lines were mixed into the JSON-RPC stream. Changes: - `KameletMain.applyMcpHttpServer`: before the auto configuration, it resolves `camel.server.mcp-enabled` / `mcp-transport` (dashed or camelCase) from every property source. For MCP over HTTP, when `camel.server.enabled` is not configured, it turns the HTTP server on. Not for stdio, not when `camel.server.enabled` is set (for example `false`), and not while exporting or in silent runs. - `RunPipeline`: `isAiToolMcpServerEnabled` and `isMcpStdioEnabled(RunRequest, ...)` read `--prop`, JVM system properties, environment variables, then the profile properties (the order that wins in camel-main). `JBangRunner` uses this to choose stderr logging for stdio. `--mcp-tags` now also applies to MCP over stdio set in the properties file. - `mcp-server.adoc` (+ catalog copy): on Camel JBang, `camel.server.mcp-enabled` turns the HTTP server on by itself, and the options work from every property source. `camel export` is unchanged: the `camel-platform-http-main` dependency already makes it write `camel.server.enabled=true`. ## Tests - `KameletMainMcpHttpServerTest` (new): the HTTP server is turned on from initial properties, camelCase keys and JVM system properties. It stays off for stdio, when MCP is disabled, and when `camel.server.enabled` is set. - `RunPipelineTest`: MCP enabled from `--prop` (dashed and camelCase) and `-D`; `--prop` wins over the profile; stdio from `--prop` and `-D`; `--mcp-tags` with stdio from the profile. 19 tests pass. - End to end with a CLI built from this branch (`camel-kamelet-main` and `camel-jbang-run` jars swapped into the CLI's classpath): `camel.server.mcp-enabled=true` alone from `--prop`, from `application.properties` and from `-D` serves `/mcp`, and `initialize` answers. Stdio from `--prop` writes only JSON-RPC to stdout. _Claude Code on behalf of davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
