Croway opened a new pull request, #2129:
URL: https://github.com/apache/camel-spring-boot/pull/2129
## 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
- MODERN only: if the application registers an entry of the other kind under
a Camel key after the route has started, stopping the route still removes it,
with a WARN. Spring AI's repository has no per-kind remove.
- The resource and prompt handlers can now receive the caller identity
(apache/camel#30801). The engine can pass it in a follow-up once that PR is
merged.
- `camel.mcp-server.enabled=off` still enables the starter. That is how
`@ConditionalOnProperty` treats a value other than `false`, and changing it
would break `enabled=on`.
_Claude Code on behalf of Federico Mariani_
--
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]