Add mcp-apps module: Spring AI 2.1.0 MCP server with MCP Apps HTML views, app-only tool callbacks, CSP declarations, SDK client tests and a Chromium harness on the official AppBridge
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b4RzcCS5JCAgcxLz7T
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package com.ankurm.mcpapps;
|
||||
|
||||
import io.modelcontextprotocol.spec.McpSchema.ReadResourceResult;
|
||||
import io.modelcontextprotocol.spec.McpSchema.TextResourceContents;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.springframework.ai.mcp.annotation.McpResource;
|
||||
|
||||
/** Test-only resources that answer two questions about Spring AI 2.1.0. */
|
||||
class ProbeResources {
|
||||
|
||||
/** A URI with a variable: where does it get listed? */
|
||||
@McpResource(uri = "ui://probe/{theme}.html", name = "probe_template", mimeType = UiMeta.MIME_TYPE)
|
||||
public String templated(String theme) {
|
||||
return "<!DOCTYPE html><title>" + theme + "</title>";
|
||||
}
|
||||
|
||||
/** The method builds the result itself: whose _meta wins? */
|
||||
@McpResource(uri = "ui://probe/explicit.html", name = "probe_explicit", mimeType = UiMeta.MIME_TYPE,
|
||||
metaProvider = UiMeta.BoardResource.class)
|
||||
public ReadResourceResult explicit() {
|
||||
return ReadResourceResult.builder(List.of(TextResourceContents
|
||||
.builder("ui://probe/explicit.html", "<!DOCTYPE html><title>explicit</title>")
|
||||
.mimeType(UiMeta.MIME_TYPE)
|
||||
.build())).build();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user