Skip to content

CAMEL-26360: camel-mcp-server-starter - apply transport customizers, refuse features the server cannot serve, fix the docs - #2129

Merged
Croway merged 4 commits into
apache:mainfrom
Croway:CAMEL-26360-mcp-server-starter-parity-fixes
Nov 26, 2026
Merged

Croway merged 4 commits into
apache:mainfrom
Croway:CAMEL-26360-mcp-server-starter-parity-fixes

Conversation

@Croway

@Croway Croway commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to the MCP parity review for CAMEL-26360, done while reviewing the Quarkus engine (apache/camel-quarkus#9509). It covers the defects found in camel-mcp-server-starter (Spring AI 2.1 / MCP SDK 2.2). All the code involved is unreleased (4.24.0).

  1. Application transport customizers are no longer dropped, and an ASYNC server keeps Spring AI's transport.
    • Customizers: once camel.mcp-server.tags was set, Camel's Streamable and stateless transports ignored the application's McpServerCustomizer<...Builder> beans: its own security validator, context extractor, maxSessions, sessionIdleTimeout. Reproduced: without tags, customizer calls=1 maxSessions=7; with tags, calls=0 maxSessions=100000. They are now applied after Camel's settings, the same order as MODERN, so an application customizer can still override Camel's Origin check or caller extractor.
    • ASYNC: with spring.ai.mcp.server.type=ASYNC, the bridge backed off without any log while Camel still replaced the transport. Now the tags-driven transport default and every bridge branch require a SYNC server, and a WARN is logged when tags are set with ASYNC. An explicit camel.mcp-server.transport-enabled=true still installs Camel's transport, so its Origin check is kept.
  2. Features the Spring AI server cannot serve are refused instead of failing startup or evicting application entries.
    • With spring.ai.mcp.server.capabilities.tool=false, a single tagged ai-tool route failed application startup on SSE, STREAMABLE and STATELESS. Tools, resources, templates and prompts of a missing capability are now refused with McpServerRefusedException, which names the property; the route keeps running and the other features are served.
    • MODERN: stopping a Camel ai-resource route deleted an application resource template with the same key, because InMemorySyncResourceRepository.remove(key) removes both kinds. A resource with a template's key, or a template with a resource's URI, is now refused, and removal only removes the route's own registration.
    • MODERN accepted a tool whose input or output schema is not valid JSON Schema 2020-12, and every call to it then failed. Schemas are now checked when the tool is registered, with the same validator the other protocols use.
  3. Docs
    • The stdio recipe pinned spring-ai-starter-mcp-server 2.0.0, and startup failed with TypeNotPresentException: io.modelcontextprotocol.modern.server.feature.McpSyncToolRepository. It now uses 2.1.0, and I checked it end to end over stdio.
    • The OAuth example only set issuer-uri, so tokens issued for another API by the same issuer were accepted. It now sets spring.security.oauth2.resourceserver.jwt.audiences. It also explains that the securityMatcher scope covers only the MCP paths, so the application's own chain must be ordered after it.
    • Option descriptions are fixed: a literal {@code}, the protocols each option applies to, and timeout defaults now shown. The metadata and the docs page are regenerated.

Tests

  • New: CamelMcpServerTransportCustomizerTest, CamelMcpServerAsyncTypeTest, SpringAiModernMcpServerEngineTest, SpringBootMcpServerToolCapabilityDisabledTest (SSE, STREAMABLE, STATELESS, MODERN) and McpServerConfigurationPropertiesTest. More cases in SpringAiMcpServerEngineTest.
  • camel-mcp-server-starter: 106 tests, 0 failures.

Not in this PR

Claude Code on behalf of Federico Mariani

… the OAuth audience and the property descriptions in the docs
…rs and keep Spring AI's transport for an ASYNC server
… server cannot serve instead of failing or evicting application entries
@Croway
Croway requested review from davsclaus and oscerd November 25, 2026 18:04
@Croway

Croway commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

The red check-doc doesn't come from this PR. Its four errors are all target of xref not found: manual::authorization-observability.adoc. Those links are in the Camel main docs for micrometer, opa, openfga and spiffe. They were added together with that manual page by CAMEL-26845 on 23 Nov.

The quick docs build looks up manual pages in https://camel.apache.org/site-manifest.json. That file was last updated on 22 Nov, so it doesn't list the new page yet, and #2126 failed with the same four errors. A re-run should pass once camel.apache.org is republished.

Claude Code on behalf of Federico Mariani

@davsclaus

Copy link
Copy Markdown
Contributor

Yeah just fixed the website build

@davsclaus

Copy link
Copy Markdown
Contributor

@davsclaus davsclaus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TL;DR

Approve: application transport customizers are now applied to Camel's Streamable and stateless transports, an ASYNC server keeps Spring AI's transport and logs a warning, features of a missing capability are refused instead of failing startup, and MODERN removes only the route's own resource or template. The docs are fixed too.

Blockers: None

Other findings: 1 suggestion (inline).

What I checked

  • Customizers: Spring AI 2.1.0's McpServerStreamableHttpWebMvcAutoConfiguration and McpServerStatelessWebMvcAutoConfiguration take the same ObjectProvider<McpServerCustomizer<...Builder>> and apply it last, so Camel's beans now behave like Spring AI's. An application customizer can replace Camel's Origin validator. That is the application's own choice, and usage.adoc documents it.
  • MODERN removal: in InMemorySyncResourceRepository (spring-ai-mcp 2.1.0), find checks the exact resource map before any template, findTemplate is an exact key lookup, and remove clears both maps. So the identity checks against registration.handler() and registration.template() are sound, and hasResource handles a template's handler matching its own literal URI template. Dropping the resources != null guard is safe, because the tracking maps stay empty when there is no repository.
  • Schema check: JsonSchemaValidator.assertConforms (mcp-core 2.2.0) returns early on a null schema and throws IllegalArgumentException, which toolAdded already turns into McpServerRefusedException. A tool without an output schema is not affected.
  • ASYNC: every nested branch of OnSpringAiMcpServerCondition and CamelMcpServerTransportCondition now uses the same SYNC rule (matchIfMissing, case-insensitive). The warning's stdio check matches McpServerStdioDisabledCondition.
  • Tests: no Thread.sleep or fixed ports (server.port=0; the :8080 strings are only Origin header values). The check-doc failure comes from the Camel website xref, not from this PR.

This review does not replace specialized review tools or static analysis.

Claude Code on behalf of davsclaus

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

@davsclaus

Copy link
Copy Markdown
Contributor

new website published

@Croway
Croway merged commit 63329d3 into apache:main Nov 26, 2026
4 of 5 checks passed
@Croway
Croway deleted the CAMEL-26360-mcp-server-starter-parity-fixes branch November 26, 2026 09:58
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.

2 participants