Claus Ibsen created CAMEL-26354:
-----------------------------------

             Summary: camel-mcp-server - serve MCP resource templates from 
ai-resource routes
                 Key: CAMEL-26354
                 URL: https://issues.apache.org/jira/browse/CAMEL-26354
             Project: Camel
          Issue Type: Improvement
          Components: camel-mcp-server, camel-ai
            Reporter: Claus Ibsen
             Fix For: 4.24.0


An {{ai-resource}} route serves exactly one fixed URI. To serve a family of 
resources such as {{crm://customers/\{id\}}}, you need one route per id, or you 
have to turn the read into a tool call. MCP covers this with resource 
templates: {{resources/templates/list}} lists them, and {{resources/read}} on a 
matching URI reads one.

h3. Proposal

* A {{uriTemplate}} option on {{ai-resource}}, as an alternative to 
{{resourceUri}}. It follows RFC 6570 level 1, where each variable matches one 
path segment. Setting both options is a startup error.
* The bridge does the matching:
** a fixed resource wins over a template;
** two templates that can match the same URI are refused with an ERROR, as 
duplicate resource URIs are today;
** a URI that matches nothing gets a JSON-RPC error, and no route is called.
* The matched variables and the URI that was read reach the route as headers or 
variables.
* The variable values come from the client, so they are untrusted. They must 
never be resolved as property placeholders or evaluated as expressions. The 
docs should tell route authors to check them before building a path or a query.
* The Camel Main engine serves templates over both Vert.x HTTP and stdio, and 
sends {{notifications/resources/list_changed}} when template routes start or 
stop.
* On the {{McpServerEngine}} SPI, template support is opt-in, like 
{{supportsResources()}}.

The Camel Main and Camel JBang engine is the reference implementation and gets 
the complete feature; the Spring Boot and Quarkus engines follow in a separate 
parity ticket, which does not block this one.

h3. Tests

Listing, a read with variables, fixed versus template precedence, and a URI 
that matches nothing. The resource conformance kit gets template assertions.

_Filed by Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to