Skip to content

CAMEL-24331: camel-mcp-server-starter - Spring AI engine for the MCP server bridge - #1871

Draft
Croway wants to merge 2 commits into
apache:mainfrom
Croway:CAMEL-24331-mcp-server-starter
Draft

CAMEL-24331: camel-mcp-server-starter - Spring AI engine for the MCP server bridge#1871
Croway wants to merge 2 commits into
apache:mainfrom
Croway:CAMEL-24331-mcp-server-starter

Conversation

@Croway

@Croway Croway commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

CAMEL-24331: camel-mcp-server-starter — Spring AI engine for the MCP server bridge

JIRA: CAMEL-24331, the Spring Boot runtime of CAMEL-24308 (camel-mcp-server).

Depends on apache/camel#25306 (camel-mcp-server-api): CI cannot pass until that merges and 4.22.0-SNAPSHOT publishes. Developed and verified locally against the installed snapshots.

What this adds

A hand-crafted camel-mcp-server-starter exposing ai-tool routes as MCP tools on Spring Boot, served through the Spring AI 2.x MCP server (spring-ai-starter-mcp-server-webmvc, spring.ai.mcp.server.protocol=STREAMABLE):

  • Depends on camel-mcp-server-api (the runtime-agnostic bridge + McpServerEngine SPI) — deliberately not camel-mcp-server, which is the Vert.x engine for Camel Main/JBang. Spring AI 2.0.0 pins the same MCP Java SDK (2.0.0) that camel manages, so no version skew.
  • SpringAiMcpServerEngine: toolAdded/toolRemoved map onto the auto-configured McpSyncServer bean's addTool/removeTool; tools/list_changed is emitted by the SDK. consumesServingConfiguration() stays false — serving (path, protocol, identity, auth) is owned by spring.ai.mcp.server.*, per the precedence rule recorded on CAMEL-24311.
  • CamelMcpServerAutoConfiguration (camel.mcp-server.*): enabled (default true — adding the starter is the opt-in), tags (unset ⇒ nothing exposed, preserving the security default), tool-timeout (20s). Backs off cleanly without an McpSyncServer bean and honors @ConditionalOnMissingBean overrides. The bridge lifecycle is owned by Camel (camelContext.addService).
  • Spring AI 2.0.0 is pinned in the starter pom (spring-ai-mcp-version) — the inherited ${spring-ai-version} is 1.1.7 and the MCP server support needs 2.x (Spring Boot 4.1 baseline, matching this repo).
  • Docs: generated starter page with hand-written intro/usage sections — YAML DSL tool definition with parameter types/enum/required, MCP client configuration examples (camel-openai agent and mcp.json-style), dynamic tools, error-handling semantics, and a link to the Spring AI MCP server documentation for the spring.ai.mcp.server.* options.
  • Spring-defined tools coexist: @McpTool-annotated beans (Spring AI annotation scanner) and Camel ai-tool routes serve from the same MCP server — proven by test. Tests compile with -parameters so the scanner derives proper input schemas (Spring Boot apps inherit this from the boot parent).

Known limitation

No springboot-catalog others/ entry is generated: the tooling derives the wrapped artifact from the starter name (camel-mcp-server), which is intentionally not a dependency here. Can be added if the tooling learns an override, or accepted as-is like other API-only modules.

Testing

  • CamelMcpServerAutoConfigurationTest — auto-config conditions (default on, enabled=false, back-off without McpSyncServer).
  • SpringBootMcpServerTest — the CAMEL-24313 engine conformance scenarios over WebMVC streamable HTTP with the official MCP SDK client: tag-filtered tools/list (untagged pool excluded), call success, missing required argument, execution error sanitized to a generic message, timeout, tools list following route stop/start. (The camel-mcp-server-api conformance kit manages its own CamelContext and cannot boot inside Spring Boot — the scenarios are mirrored 1:1 instead; noted on CAMEL-24313.)

All 10 tests green.


This PR was written by Claude Code on behalf of Federico Mariani (@Croway).

🤖 Generated with Claude Code

Croway and others added 2 commits August 3, 2026 17:00
…server bridge

Expose ai-tool routes as MCP tools on Spring Boot through the Spring AI
2.x MCP server (CAMEL-24308):

- Depends on camel-mcp-server-api (bridge + SPI) and
  spring-ai-starter-mcp-server-webmvc - NOT the camel-mcp-server Vert.x
  engine; Spring AI 2.0.0 pins the same MCP Java SDK (2.0.0) as camel.
- SpringAiMcpServerEngine maps toolAdded/toolRemoved onto the
  auto-configured McpSyncServer (list_changed emitted by the SDK).
- CamelMcpServerAutoConfiguration with camel.mcp-server.* properties
  (enabled default true, tags opt-in, tool-timeout 20s); serving
  concerns are owned by spring.ai.mcp.server.* per the CAMEL-24311
  precedence rule; backs off without an McpSyncServer bean.
- Tests: auto-configuration conditions + the engine conformance
  scenarios over WebMVC streamable HTTP with the official MCP SDK
  client (tag filtering, call success, sanitized errors, timeout,
  tools list following route stop/start).

Requires the camel-mcp-server-api artifact from apache/camel PR #25306.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…coexistence

- Usage docs: YAML DSL tool example with parameter types/enum/required,
  MCP client configuration examples (camel-openai agent + mcp.json),
  dynamic tools, error handling semantics, and a link to the Spring AI
  MCP server documentation for the spring.ai.mcp.server.* options.
- Prove Spring-defined tools (@mcptool annotation) coexist with Camel
  ai-tool routes on the same MCP server; compile with -parameters so
  the annotation scanner derives proper input schemas in tests (Spring
  Boot applications inherit this from the boot parent).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant