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:
Claude
2026-12-05 16:43:24 +05:30
parent 8fa3c5d682
commit 508fed3b98
46 changed files with 1730 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
// The Content-Security-Policy a strict host builds, following "Restrictive Default" in the 2026-01-26 spec.
const clean = (list) => (list ?? []).filter((d) => typeof d === "string" && !/[;\r\n'" ]/.test(d)).join(" ");
export function buildCsp(csp = {}) {
const resources = clean(csp.resourceDomains);
return [
"default-src 'none'",
`script-src 'self' 'unsafe-inline' ${resources}`,
`style-src 'self' 'unsafe-inline' ${resources}`,
`img-src 'self' data: ${resources}`,
`media-src 'self' data: ${resources}`,
`font-src ${resources || "'none'"}`,
`connect-src ${clean(csp.connectDomains) || "'none'"}`,
`frame-src ${clean(csp.frameDomains) || "'none'"}`,
"object-src 'none'",
`base-uri ${clean(csp.baseUriDomains) || "'self'"}`,
].map((d) => d.trim().replace(/\s+/g, " ")).join("; ");
}