This is an automated email from the ASF dual-hosted git repository.

Croway pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git


The following commit(s) were added to refs/heads/main by this push:
     new 23b8219ad5d CAMEL-26360: camel-mcp-server-starter - resource and 
prompt routes receive the MCP caller identity
23b8219ad5d is described below

commit 23b8219ad5d70441eba58bd0b6403d50dd7d378e
Author: croway <[email protected]>
AuthorDate: Thu Nov 26 11:04:50 2026 +0100

    CAMEL-26360: camel-mcp-server-starter - resource and prompt routes receive 
the MCP caller identity
    
    Both Spring AI engines pass the caller context of the request to the
    resource, resource template and prompt handlers, as they already did for
    tools, so these routes receive CamelMcpSecurityPrincipal, the
    CamelAiToolSecurityPrincipal* and the CamelMcpOAuth* properties on an
    authenticated request. Needs apache/camel#30801.
---
 .../src/main/doc/usage.adoc                        | 11 ++++-
 .../mcp/server/SpringAiMcpServerEngine.java        | 15 ++++---
 .../mcp/server/SpringAiModernMcpServerEngine.java  | 14 +++---
 .../mcp/server/SpringBootMcpServerModernTest.java  | 41 ++++++++++++++---
 .../server/SpringBootMcpServerStatelessTest.java   | 49 +++++++++++++++++---
 .../mcp/server/SpringBootMcpServerTest.java        | 52 +++++++++++++++++-----
 .../modules/ROOT/pages/starters/mcp-server.adoc    | 11 ++++-
 7 files changed, 159 insertions(+), 34 deletions(-)

diff --git 
a/components-starter/camel-mcp-server-starter/src/main/doc/usage.adoc 
b/components-starter/camel-mcp-server-starter/src/main/doc/usage.adoc
index 4acef11dd02..afacd05fb4b 100644
--- a/components-starter/camel-mcp-server-starter/src/main/doc/usage.adoc
+++ b/components-starter/camel-mcp-server-starter/src/main/doc/usage.adoc
@@ -82,7 +82,12 @@ A route declares either `resourceUri` for a fixed resource 
or `uriTemplate`
 for a resource template. Template variables are client input: validate them
 before using them in filesystem paths, database queries, authorization
 decisions, or downstream requests. Do not treat a syntactically valid URI
-variable as proof that the caller may access the referenced data.
+variable as proof that the caller may access the referenced data. With Camel's
+HTTP transport (see <<_origin_validation>>), the route receives the
+authenticated caller in the same exchange properties as a tool route:
+`CamelMcpSecurityPrincipal`, `CamelAiToolSecurityPrincipalName` and
+`CamelAiToolSecurityPrincipalRoles`, plus the `CamelMcpOAuth*` properties for
+an OAuth bearer token.
 
 Resources and resource templates are selected using the same
 `camel.mcp-server.tags` setting as tools. Their registration follows the
@@ -113,7 +118,9 @@ from("ai-prompt:multi_turn?tags=crm&description=Return a 
user and assistant mess
         Map.of("role", "assistant", "content", "Assistant reply"))));
 ----
 
-Prompt routes follow the same tag selection and route lifecycle rules.
+Prompt routes follow the same tag selection and route lifecycle rules, and
+receive the authenticated caller in the same exchange properties as resource
+routes.
 Content assembled from external systems, including resource content and
 prompt messages, must be treated as untrusted data. It may contain prompt
 injection instructions; do not grant such content authority over system
diff --git 
a/components-starter/camel-mcp-server-starter/src/main/java/org/apache/camel/springboot/mcp/server/SpringAiMcpServerEngine.java
 
b/components-starter/camel-mcp-server-starter/src/main/java/org/apache/camel/springboot/mcp/server/SpringAiMcpServerEngine.java
index d97937ab00c..542160adfdf 100644
--- 
a/components-starter/camel-mcp-server-starter/src/main/java/org/apache/camel/springboot/mcp/server/SpringAiMcpServerEngine.java
+++ 
b/components-starter/camel-mcp-server-starter/src/main/java/org/apache/camel/springboot/mcp/server/SpringAiMcpServerEngine.java
@@ -46,6 +46,7 @@ import 
org.apache.camel.component.mcp.server.McpServerRefusedException;
 import org.apache.camel.component.mcp.server.McpServerResource;
 import org.apache.camel.component.mcp.server.McpServerResourceTemplate;
 import org.apache.camel.component.mcp.server.McpServerTool;
+import org.apache.camel.component.mcp.server.McpToolCallContext;
 import org.apache.camel.component.mcp.server.McpToolCallResult;
 import org.apache.camel.support.service.ServiceSupport;
 import org.slf4j.Logger;
@@ -170,7 +171,8 @@ public class SpringAiMcpServerEngine extends ServiceSupport 
implements McpServer
         server.addResource(
                         mcpResource,
                         (transportContext, request) -> {
-                            McpResourceReadResult result = 
resource.handler().read();
+                            McpResourceReadResult result = 
resource.handler().read(
+                                    
SpringAiMcpTransportContext.from(transportContext));
 
                             if (result.isError()) {
                                 throw 
McpError.builder(McpSchema.ErrorCodes.INTERNAL_ERROR)
@@ -278,7 +280,8 @@ public class SpringAiMcpServerEngine extends ServiceSupport 
implements McpServer
                         builder.build(),
                         (transportContext, request) -> {
                             McpResourceReadResult result =
-                                    
resourceTemplate.handler().read(request.uri());
+                                    
resourceTemplate.handler().read(request.uri(),
+                                            
SpringAiMcpTransportContext.from(transportContext));
 
                             if (result.isError()) {
                                 throw 
McpError.builder(McpSchema.ErrorCodes.INTERNAL_ERROR)
@@ -343,7 +346,8 @@ public class SpringAiMcpServerEngine extends ServiceSupport 
implements McpServer
                     "An MCP prompt named '" + prompt.name() + "' is already 
registered");
         }
 
-        server.addPrompt(buildPrompt(prompt), (transportContext, request) -> 
getPrompt(prompt, request));
+        server.addPrompt(buildPrompt(prompt), (transportContext, request) -> 
getPrompt(prompt, request,
+                SpringAiMcpTransportContext.from(transportContext)));
         LOG.debug("MCP prompt added: {}", prompt.name());
     }
 
@@ -413,7 +417,8 @@ public class SpringAiMcpServerEngine extends ServiceSupport 
implements McpServer
         return builder.build();
     }
 
-    private McpSchema.GetPromptResult getPrompt(McpServerPrompt prompt, 
McpSchema.GetPromptRequest request) {
+    private McpSchema.GetPromptResult getPrompt(
+            McpServerPrompt prompt, McpSchema.GetPromptRequest request, 
McpToolCallContext caller) {
                     Map<String, String> arguments = new LinkedHashMap<>();
 
                     if (request.arguments() != null) {
@@ -428,7 +433,7 @@ public class SpringAiMcpServerEngine extends ServiceSupport 
implements McpServer
                         });
                     }
 
-                    McpPromptResult result = prompt.handler().get(arguments);
+                    McpPromptResult result = prompt.handler().get(arguments, 
caller);
 
                     if (result == null) {
                         throw 
McpError.builder(McpSchema.ErrorCodes.INTERNAL_ERROR)
diff --git 
a/components-starter/camel-mcp-server-starter/src/main/java/org/apache/camel/springboot/mcp/server/SpringAiModernMcpServerEngine.java
 
b/components-starter/camel-mcp-server-starter/src/main/java/org/apache/camel/springboot/mcp/server/SpringAiModernMcpServerEngine.java
index 44badadbeef..600bd9e0cfe 100644
--- 
a/components-starter/camel-mcp-server-starter/src/main/java/org/apache/camel/springboot/mcp/server/SpringAiModernMcpServerEngine.java
+++ 
b/components-starter/camel-mcp-server-starter/src/main/java/org/apache/camel/springboot/mcp/server/SpringAiModernMcpServerEngine.java
@@ -48,6 +48,7 @@ import 
org.apache.camel.component.mcp.server.McpServerRefusedException;
 import org.apache.camel.component.mcp.server.McpServerResource;
 import org.apache.camel.component.mcp.server.McpServerResourceTemplate;
 import org.apache.camel.component.mcp.server.McpServerTool;
+import org.apache.camel.component.mcp.server.McpToolCallContext;
 import org.apache.camel.component.mcp.server.McpToolCallResult;
 import org.apache.camel.support.service.ServiceSupport;
 import org.slf4j.Logger;
@@ -226,7 +227,8 @@ public class SpringAiModernMcpServerEngine extends 
ServiceSupport implements Mcp
         }
         SyncResourceRegistration registration = 
SyncResourceRegistration.of(builder.build(),
                 (ctx, request) -> McpSyncResponse.result(
-                        readResult(resource.uri(), resource.mimeType(), 
resource.handler().read())));
+                        readResult(resource.uri(), resource.mimeType(),
+                                
resource.handler().read(SpringAiMcpTransportContext.from(ctx.transportContext())))));
         try {
             resources.add(registration);
         } catch (IllegalArgumentException e) {
@@ -292,7 +294,8 @@ public class SpringAiModernMcpServerEngine extends 
ServiceSupport implements Mcp
         }
         SyncResourceTemplateRegistration registration = 
SyncResourceTemplateRegistration.of(builder.build(),
                 (ctx, request) -> 
McpSyncResponse.result(readResult(request.uri(), resourceTemplate.mimeType(),
-                        resourceTemplate.handler().read(request.uri()))));
+                        resourceTemplate.handler().read(request.uri(),
+                                
SpringAiMcpTransportContext.from(ctx.transportContext())))));
         try {
             resources.add(registration);
         } catch (IllegalArgumentException e) {
@@ -456,7 +459,8 @@ public class SpringAiModernMcpServerEngine extends 
ServiceSupport implements Mcp
             builder.title(prompt.title());
         }
         try {
-            prompts.add(McpSyncPrompt.of(builder.build(), (ctx, request) -> 
getPrompt(prompt, request)));
+            prompts.add(McpSyncPrompt.of(builder.build(), (ctx, request) -> 
getPrompt(prompt, request,
+                    
SpringAiMcpTransportContext.from(ctx.transportContext()))));
         } catch (IllegalArgumentException e) {
             throw new McpServerRefusedException("An MCP prompt named '" + 
prompt.name() + "' is already registered", e);
         }
@@ -476,9 +480,9 @@ public class SpringAiModernMcpServerEngine extends 
ServiceSupport implements Mcp
     }
 
     private McpSyncResponse<McpSchema.GetPromptOutcome> getPrompt(
-            McpServerPrompt prompt, McpSchema.GetPromptRequest request) {
+            McpServerPrompt prompt, McpSchema.GetPromptRequest request, 
McpToolCallContext caller) {
         Map<String, String> arguments = request.arguments() != null ? 
request.arguments() : Map.of();
-        McpPromptResult result = prompt.handler().get(arguments);
+        McpPromptResult result = prompt.handler().get(arguments, caller);
         if (result == null) {
             throw new McpException(ErrorCodes.INTERNAL_ERROR, "Prompt 
execution failed");
         }
diff --git 
a/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerModernTest.java
 
b/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerModernTest.java
index 21898eb51a8..d10a147ac88 100644
--- 
a/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerModernTest.java
+++ 
b/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerModernTest.java
@@ -39,6 +39,7 @@ import 
io.modelcontextprotocol.modern.client.transport.McpHttpRequestCustomizer;
 import io.modelcontextprotocol.modern.server.McpSyncResponse;
 import io.modelcontextprotocol.modern.server.feature.McpSyncTool;
 import org.apache.camel.CamelContext;
+import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mcp.server.McpServerEngine;
 import org.apache.camel.component.mcp.server.McpToolCallContext;
@@ -141,9 +142,22 @@ public class SpringBootMcpServerModernTest {
                          + 
"&parameter.name=string&parameter.name.required=true")
                             .setBody(simple("Hello ${header.name}"));
 
+                    Processor callerName = exchange -> 
exchange.getMessage().setBody("name=" + exchange.getProperty(
+                            
McpToolCallContext.SECURITY_PRINCIPAL_NAME_PROPERTY));
+
                     from("ai-tool:who_am_i?tags=modern&description=Return the 
authenticated caller")
-                            .process(exchange -> 
exchange.getMessage().setBody("name=" + exchange.getProperty(
-                                    
McpToolCallContext.SECURITY_PRINCIPAL_NAME_PROPERTY)));
+                            .process(callerName);
+
+                    
from("ai-resource:caller?resourceUri=camel:///caller&tags=modern"
+                         + "&description=The authenticated 
caller&mimeType=text/plain")
+                            .process(callerName);
+
+                    
from("ai-resource:caller_by_id?uriTemplate=camel:///callers/{id}&tags=modern"
+                         + "&description=The authenticated 
caller&mimeType=text/plain")
+                            .process(callerName);
+
+                    
from("ai-prompt:caller_prompt?tags=modern&description=Return the authenticated 
caller")
+                            .process(callerName);
 
                     // refused: the application already serves a tool with 
this name
                     from("ai-tool:add_numbers?tags=modern&description=Same 
name as the application tool")
@@ -188,9 +202,10 @@ public class SpringBootMcpServerModernTest {
         McpSyncClient client = client();
 
         
assertThat(client.resources().list().resources()).extracting(McpSchema.Resource::uri)
-                .containsExactly("camel:///readme.txt");
+                .containsExactlyInAnyOrder("camel:///readme.txt", 
"camel:///caller");
         assertThat(client.resourceTemplates().list().resourceTemplates())
-                
.extracting(McpSchema.ResourceTemplate::uriTemplate).containsExactly("camel:///orders/{orderId}");
+                .extracting(McpSchema.ResourceTemplate::uriTemplate)
+                .containsExactlyInAnyOrder("camel:///orders/{orderId}", 
"camel:///callers/{id}");
         
assertThat(client.resource("camel:///readme.txt").read().contents()).singleElement()
                 .isInstanceOfSatisfying(McpSchema.TextResourceContents.class,
                         text -> assertThat(text.text()).isEqualTo("read me"));
@@ -203,7 +218,8 @@ public class SpringBootMcpServerModernTest {
     void getsAPrompt() {
         McpSyncClient client = client();
 
-        
assertThat(client.prompts().list().prompts()).extracting(McpSchema.Prompt::name).containsExactly("greet");
+        
assertThat(client.prompts().list().prompts()).extracting(McpSchema.Prompt::name)
+                .containsExactlyInAnyOrder("greet", "caller_prompt");
         McpSchema.GetPromptResult result = 
client.prompt("greet").arguments(Map.of("name", "Camel")).get();
         assertThat(result.messages()).singleElement().satisfies(message -> {
             assertThat(message.role()).isEqualTo(McpSchema.Role.USER);
@@ -212,6 +228,21 @@ public class SpringBootMcpServerModernTest {
         });
     }
 
+    @Test
+    void resourceAndPromptRoutesReceiveTheCaller() {
+        McpSyncClient client = client();
+
+        
assertThat(client.resource("camel:///caller").read().contents()).singleElement()
+                .isInstanceOfSatisfying(McpSchema.TextResourceContents.class,
+                        text -> 
assertThat(text.text()).isEqualTo("name=mcp-user"));
+        
assertThat(client.resource("camel:///callers/42").read().contents()).singleElement()
+                .isInstanceOfSatisfying(McpSchema.TextResourceContents.class,
+                        text -> 
assertThat(text.text()).isEqualTo("name=mcp-user"));
+        
assertThat(client.prompt("caller_prompt").arguments(Map.of()).get().messages()).singleElement()
+                .satisfies(message -> 
assertThat(message.content()).isInstanceOfSatisfying(
+                        McpSchema.TextContent.class, text -> 
assertThat(text.text()).isEqualTo("name=mcp-user")));
+    }
+
     @Test
     void listenerIsToldWhenARouteAddsAndRemovesATool() throws Exception {
         McpSyncClient client = client();
diff --git 
a/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerStatelessTest.java
 
b/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerStatelessTest.java
index def6afa3984..d815e80128d 100644
--- 
a/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerStatelessTest.java
+++ 
b/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerStatelessTest.java
@@ -29,6 +29,7 @@ import io.modelcontextprotocol.client.McpClient;
 import io.modelcontextprotocol.client.McpSyncClient;
 import 
io.modelcontextprotocol.client.transport.HttpClientStreamableHttpTransport;
 import io.modelcontextprotocol.spec.McpSchema;
+import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mcp.server.McpServerEngine;
 import org.apache.camel.component.mcp.server.McpToolCallContext;
@@ -109,9 +110,22 @@ public class SpringBootMcpServerStatelessTest {
                          + 
"&parameter.name=string&parameter.name.required=true")
                             .setBody(simple("Hello ${header.name}"));
 
+                    Processor callerName = exchange -> 
exchange.getMessage().setBody("name=" + exchange.getProperty(
+                            
McpToolCallContext.SECURITY_PRINCIPAL_NAME_PROPERTY));
+
                     from("ai-tool:who_am_i?tags=stateless&description=Return 
the authenticated caller")
-                            .process(exchange -> 
exchange.getMessage().setBody("name=" + exchange.getProperty(
-                                    
McpToolCallContext.SECURITY_PRINCIPAL_NAME_PROPERTY)));
+                            .process(callerName);
+
+                    
from("ai-resource:caller?resourceUri=camel:///caller&tags=stateless"
+                         + "&description=The authenticated 
caller&mimeType=text/plain")
+                            .process(callerName);
+
+                    
from("ai-resource:caller_by_id?uriTemplate=camel:///callers/{id}&tags=stateless"
+                         + "&description=The authenticated 
caller&mimeType=text/plain")
+                            .process(callerName);
+
+                    
from("ai-prompt:caller_prompt?tags=stateless&description=Return the 
authenticated caller")
+                            .process(callerName);
                 }
             };
         }
@@ -122,9 +136,8 @@ public class SpringBootMcpServerStatelessTest {
         assertThat(engine).isInstanceOf(SpringAiMcpServerEngine.class);
     }
 
-    @Test
-    void clientCallsToolsWithoutSession() {
-        McpSyncClient client = McpClient
+    private McpSyncClient newClient() {
+        return McpClient
                 
.sync(HttpClientStreamableHttpTransport.builder("http://localhost:"; + port)
                         .addHttpRequestCustomizer(
                                 (builder, method, endpoint, body, context) -> 
builder.header("Authorization",
@@ -133,6 +146,11 @@ public class SpringBootMcpServerStatelessTest {
                 .requestTimeout(Duration.ofSeconds(10))
                 .initializationTimeout(Duration.ofSeconds(10))
                 .build();
+    }
+
+    @Test
+    void clientCallsToolsWithoutSession() {
+        McpSyncClient client = newClient();
         try {
             client.initialize();
 
@@ -149,6 +167,27 @@ public class SpringBootMcpServerStatelessTest {
         }
     }
 
+    @Test
+    void resourceAndPromptRoutesReceiveTheCaller() {
+        McpSyncClient client = newClient();
+        try {
+            client.initialize();
+
+            assertThat(client.readResource(new 
McpSchema.ReadResourceRequest("camel:///caller")).contents())
+                    
.singleElement().isInstanceOfSatisfying(McpSchema.TextResourceContents.class,
+                            text -> 
assertThat(text.text()).isEqualTo("name=mcp-user"));
+            assertThat(client.readResource(new 
McpSchema.ReadResourceRequest("camel:///callers/42")).contents())
+                    
.singleElement().isInstanceOfSatisfying(McpSchema.TextResourceContents.class,
+                            text -> 
assertThat(text.text()).isEqualTo("name=mcp-user"));
+            assertThat(client.getPrompt(new 
McpSchema.GetPromptRequest("caller_prompt", Map.of())).messages())
+                    .singleElement().satisfies(message -> 
assertThat(message.content())
+                            
.isInstanceOfSatisfying(McpSchema.TextContent.class,
+                                    text -> 
assertThat(text.text()).isEqualTo("name=mcp-user")));
+        } finally {
+            client.closeGracefully();
+        }
+    }
+
     @Test
     void initializeReturnsNoSessionAndGetIsNotAllowed() throws Exception {
         HttpResponse<String> initialize = post(INITIALIZE, null);
diff --git 
a/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerTest.java
 
b/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerTest.java
index b2b3e31f428..f80f6cf466c 100644
--- 
a/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerTest.java
+++ 
b/components-starter/camel-mcp-server-starter/src/test/java/org/apache/camel/springboot/mcp/server/SpringBootMcpServerTest.java
@@ -211,18 +211,30 @@ public class SpringBootMcpServerTest {
                             .routeId("say-hello-route")
                             .setBody(simple("Hello ${header.name}"));
 
+                    Processor callerIdentity = exchange -> {
+                        Object principal = 
exchange.getProperty(McpToolCallContext.SECURITY_PRINCIPAL_PROPERTY);
+                        Object principalName = exchange.getProperty(
+                                
McpToolCallContext.SECURITY_PRINCIPAL_NAME_PROPERTY);
+                        Object principalRoles = exchange.getProperty(
+                                
McpToolCallContext.SECURITY_PRINCIPAL_ROLES_PROPERTY);
+                        exchange.getMessage().setBody("principalPresent=" + 
(principal != null)
+                                                      + ";name=" + 
principalName + ";roles=" + principalRoles);
+                    };
+
                     from("ai-tool:who_am_i?tags=conformance&description=Return 
authenticated caller identity")
                             .routeId("who-am-i-route")
-                            .process(exchange -> {
-                                Object principal = exchange.getProperty(
-                                        
McpToolCallContext.SECURITY_PRINCIPAL_PROPERTY);
-                                Object principalName = exchange.getProperty(
-                                        
McpToolCallContext.SECURITY_PRINCIPAL_NAME_PROPERTY);
-                                Object principalRoles = exchange.getProperty(
-                                        
McpToolCallContext.SECURITY_PRINCIPAL_ROLES_PROPERTY);
-                                
exchange.getMessage().setBody("principalPresent=" + (principal != null)
-                                        + ";name=" + principalName + ";roles=" 
+ principalRoles);
-                            });
+                            .process(callerIdentity);
+
+                    
from("ai-resource:caller?resourceUri=camel:///caller&tags=conformance"
+                         + "&description=The authenticated 
caller&mimeType=text/plain")
+                            .process(callerIdentity);
+
+                    
from("ai-resource:caller_by_id?uriTemplate=camel:///callers/{id}&tags=conformance"
+                         + "&description=The authenticated 
caller&mimeType=text/plain")
+                            .process(callerIdentity);
+
+                    
from("ai-prompt:caller_prompt?tags=conformance&description=Return the 
authenticated caller")
+                            .process(callerIdentity);
 
                     from("ai-tool:origin_guarded_tool?tags=conformance"
                          + "&description=Tool used to verify rejected Origin 
requests")
@@ -429,6 +441,26 @@ public class SpringBootMcpServerTest {
                 .contains("principalPresent=true", "name=mcp-user", 
"MCP_USER", "MCP_ADMIN");
     }
 
+    @Test
+    void testAuthenticatedCallerIdentityAndRolesReachResourceAndPromptRoutes() 
{
+        McpSchema.ReadResourceResult resource = client().readResource(
+                new McpSchema.ReadResourceRequest("camel:///caller"));
+        McpSchema.ReadResourceResult template = client().readResource(
+                new McpSchema.ReadResourceRequest("camel:///callers/42"));
+        McpSchema.GetPromptResult prompt = client().getPrompt(
+                new McpSchema.GetPromptRequest("caller_prompt", Map.of()));
+
+        assertThat(List.of(resource.contents().get(0), 
template.contents().get(0)))
+                .allSatisfy(contents -> 
assertThat(contents).isInstanceOfSatisfying(
+                        McpSchema.TextResourceContents.class,
+                        text -> assertThat(text.text()).contains(
+                                "principalPresent=true", "name=mcp-user", 
"MCP_USER", "MCP_ADMIN")));
+        assertThat(prompt.messages()).singleElement().satisfies(message -> 
assertThat(message.content())
+                .isInstanceOfSatisfying(McpSchema.TextContent.class,
+                        text -> assertThat(text.text()).contains(
+                                "principalPresent=true", "name=mcp-user", 
"MCP_USER", "MCP_ADMIN")));
+    }
+
     @Test
     void testAuthorizationPolicyAllowsOnlyMcpAdminRole() {
         mcpAdminToolInvocations.set(0);
diff --git a/docs/spring-boot/modules/ROOT/pages/starters/mcp-server.adoc 
b/docs/spring-boot/modules/ROOT/pages/starters/mcp-server.adoc
index b883d5f1342..2a3b5d6a06d 100644
--- a/docs/spring-boot/modules/ROOT/pages/starters/mcp-server.adoc
+++ b/docs/spring-boot/modules/ROOT/pages/starters/mcp-server.adoc
@@ -298,7 +298,12 @@ A route declares either `resourceUri` for a fixed resource 
or `uriTemplate`
 for a resource template. Template variables are client input: validate them
 before using them in filesystem paths, database queries, authorization
 decisions, or downstream requests. Do not treat a syntactically valid URI
-variable as proof that the caller may access the referenced data.
+variable as proof that the caller may access the referenced data. With Camel's
+HTTP transport (see <<_origin_validation>>), the route receives the
+authenticated caller in the same exchange properties as a tool route:
+`CamelMcpSecurityPrincipal`, `CamelAiToolSecurityPrincipalName` and
+`CamelAiToolSecurityPrincipalRoles`, plus the `CamelMcpOAuth*` properties for
+an OAuth bearer token.
 
 Resources and resource templates are selected using the same
 `camel.mcp-server.tags` setting as tools. Their registration follows the
@@ -329,7 +334,9 @@ from("ai-prompt:multi_turn?tags=crm&description=Return a 
user and assistant mess
         Map.of("role", "assistant", "content", "Assistant reply"))));
 ----
 
-Prompt routes follow the same tag selection and route lifecycle rules.
+Prompt routes follow the same tag selection and route lifecycle rules, and
+receive the authenticated caller in the same exchange properties as resource
+routes.
 Content assembled from external systems, including resource content and
 prompt messages, must be treated as untrusted data. It may contain prompt
 injection instructions; do not grant such content authority over system

Reply via email to