jamesnetherton commented on code in PR #9509:
URL: https://github.com/apache/camel-quarkus/pull/9509#discussion_r4586276724
##########
integration-tests/mcp-server/pom.xml:
##########
@@ -30,17 +30,15 @@
<name>Camel Quarkus :: Integration Tests :: MCP Server</name>
<description>Integration tests for Camel Quarkus MCP Server
extension</description>
- <properties>
- <!-- TODO: Re-enable when quarkus-mcp-server is compatible with
Quarkus 4 - https://github.com/apache/camel-quarkus/issues/9362 -->
- <skipTests>true</skipTests>
- <quarkus.build.skip>true</quarkus.build.skip>
- </properties>
-
- <dependencies>
+<dependencies>
Review Comment:
Nit: this tag lost its indentation.
_Claude Code (Opus 5.5) on behalf of James Netherton_
##########
integration-tests/mcp-server/pom.xml:
##########
@@ -57,11 +55,16 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy</artifactId>
</dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-oidc</artifactId>
+ </dependency>
<!-- test dependencies -->
<dependency>
<groupId>io.quarkiverse.mcp</groupId>
<artifactId>quarkus-mcp-server-test</artifactId>
+ <version>${quarkiverse-mcp-server.version}</version>
Review Comment:
This version is already set in `poms/bom-test/pom.xml`, so the explicit
`<version>` can go.
_Claude Code (Opus 5.5) on behalf of James Netherton_
##########
extensions/mcp-server/runtime/src/main/java/org/apache/camel/quarkus/component/mcp/server/QuarkusMcpServerEngine.java:
##########
@@ -191,6 +265,357 @@ public boolean supportsResources() {
return true;
}
+ @Override
+ public void resourceTemplateAdded(McpServerResourceTemplate
resourceTemplate) {
+ AiResourceUriTemplate matcher;
+ try {
+ matcher = new
AiResourceUriTemplate(resourceTemplate.uriTemplate());
+ } catch (IllegalArgumentException e) {
+ throw new McpServerRefusedException(
+ "Unsupported MCP resource template '" +
resourceTemplate.uriTemplate() + "'", e);
+ }
+
+ // Retry cleanup if a previous route stop failed to remove this
template.
+ try {
+ removeRegisteredResourceTemplate(resourceTemplate.uriTemplate());
+ } catch (Exception e) {
+ throw new McpServerRefusedException(
+ "Previously registered MCP resource template '" +
resourceTemplate.uriTemplate()
+ + "' could not be removed before re-registration",
+ e);
+ }
+
+ // A template must not shadow an application-defined resource or
another application-defined template on the
+ // default MCP server. Definitions on other MCP servers are
independent and must remain untouched.
+ for (ResourceManager.ResourceInfo existing : resourceManager) {
+ if (existing.serverNames().contains(McpServer.DEFAULT)
+ && matcher.match(existing.uri()).isPresent()) {
+ throw new McpServerRefusedException(
+ "Resource template '" + resourceTemplate.uriTemplate()
+ + "' matches application resource '" +
existing.uri() + "'");
+ }
+ }
+ for (ResourceTemplateManager.ResourceTemplateInfo existing :
resourceTemplateManager) {
+ if (existing.serverNames().contains(McpServer.DEFAULT)
+ && templatesOverlap(matcher, existing.uriTemplate())) {
+ throw new McpServerRefusedException(
+ "Resource template '" + resourceTemplate.uriTemplate()
+ + "' overlaps application resource template '"
Review Comment:
This loop also catches templates registered by other Camel `ai-resource`
routes through this engine, not only application templates. Refusing them is
right, since quarkus-mcp-server fails a read that matches more than one
template. But the message calls the other template an "application resource
template", which is misleading when it comes from a Camel route. Maybe say
"overlaps resource template", or check `registeredResourceTemplates` to tell
the two cases apart.
_Claude Code (Opus 5.5) on behalf of James Netherton_
##########
integration-tests/mcp-server/pom.xml:
##########
@@ -84,6 +92,16 @@
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-test-keycloak-server</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.testcontainers</groupId>
+ <artifactId>testcontainers</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<profiles>
Review Comment:
The module now starts a Keycloak container, but it has no
`skip-testcontainers-tests` profile like `integration-tests/oauth` and
`integration-tests/keycloak` have. Builds run with
`-Dskip-testcontainers-tests` would still try to start Keycloak here. If the
OIDC tests move to their own module, as suggested in the other review, that
module needs the profile instead.
_Claude Code (Opus 5.5) on behalf of James Netherton_
##########
extensions/mcp-server/runtime/src/main/java/org/apache/camel/quarkus/component/mcp/server/QuarkusMcpServerEngineFactory.java:
##########
@@ -16,15 +16,19 @@
*/
package org.apache.camel.quarkus.component.mcp.server;
+import io.quarkiverse.mcp.server.PromptManager;
import io.quarkiverse.mcp.server.ResourceManager;
+import io.quarkiverse.mcp.server.ResourceTemplateManager;
import io.quarkiverse.mcp.server.ToolManager;
+import io.quarkus.security.identity.CurrentIdentityAssociation;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
/**
* Creates the {@link QuarkusMcpServerEngine}. The managers are injected
rather than looked up programmatically:
- * quarkus-mcp-server advertises the {@code listChanged} capability of tools
and resources only when their manager has
- * an injection point, and the Camel tools and resources change with the route
lifecycle.
+ * quarkus-mcp-server advertises the {@code listChanged} capability of tools,
resources, resource templates and prompts
+ * only
Review Comment:
Nit: stray line break in the Javadoc. "only" sits on its own line.
_Claude Code (Opus 5.5) on behalf of James Netherton_
--
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]