k-krawczyk opened a new pull request, #25892:
URL: https://github.com/apache/camel/pull/25892
The Camel MCP server exposes routes as MCP tools only. This adds resources:
read-only
content a client fetches by uri, which is the shape the reporter asked for
(a static
file on FTP or S3, the current configuration).
The design follows the direction Otavio set on the issue: a new component
consistent
with the current tools one, simple in v1, tags reused.
`design/aiResource.adoc` carries
the full rationale, including what is deliberately left out (resource
templates,
subscriptions, prompts).
### New component: camel-ai-resource
```java
from("ai-resource:app_config"
+ "?resourceUri=camel:///config/app.json"
+ "&tags=crm"
+ "&description=Current application configuration"
+ "&mimeType=application/json")
.to("file:config?fileName=app.json&noop=true");
```
Sibling of `camel-ai-tool`, depending only on `camel-support`: an
`AiResourceRegistry`
context plugin, an `AiResourceExecutor`, and the consumer endpoint. A read
carries no
arguments; the route body is the content. The declared `mimeType` decides
the wire
format, so the text/binary choice is explicit in the route rather than
guessed at
runtime: text subtypes, `application/json` and any `+json`/`+xml`/`+yaml`
subtype are
read as `String`, everything else as `byte[]`.
### SPI: opt-in, no breakage downstream
`McpServerEngine` gains `resourceAdded`, `resourceRemoved` and
`supportsResources()`,
all with defaults. `camel-quarkus-mcp-server` and the Spring Boot starter
keep compiling
and behave exactly as before; the bridge logs one WARN when `ai-resource`
routes match
the tags on an engine that cannot serve them.
The conformance kit follows the same split: resource assertions live in a new
`McpServerResourceConformanceTestSupport`, so the existing kit stays
tool-only and no
downstream engine starts failing it. That is what makes the cascade to CSB
and CEQ a
follow-up issue in those repos rather than a prerequisite here.
### Bridge
`McpServerBridge` subscribes to both registries. Tag selection, the executor
pool, the
"untagged pool is never exposed" rule and the sanitized error mapping are
shared. The
timeout is separate (`camel.server.mcp-resource-timeout`, default 20s)
because a
document fetch and a tool call are different workloads.
`resources/read` has no in-band error flag, so a failed read becomes a
JSON-RPC error
carrying the same generic message a failing tool would return; the cause is
logged
server-side only.
### Testing
* camel-ai-resource: registry, endpoint lifecycle
(start/stop/suspend/resume), executor
(text, binary, empty body, route exception).
* camel-mcp-server-api: bridge publication and reads against a recording
engine,
including tag selection, uri collision, timeout, sanitization, and an
engine without
resource support.
* camel-mcp-server: the new resource conformance kit run against the Vert.x
engine with
the official MCP SDK client (capability advertisement, list, text read,
blob read,
sanitized error, timeout, list_changed on route stop and start).
_Reported by Claude Code on behalf of Karol Krawczyk_
--
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]