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,25 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>sandbox proxy</title>
|
||||
<style>html,body,iframe{margin:0;border:0;width:100%;height:100%}</style>
|
||||
<body>
|
||||
<script>
|
||||
// The proxy of the spec: a second origin between the host and the view. It loads the HTML and relays messages.
|
||||
const inner = document.createElement("iframe");
|
||||
inner.id = "view";
|
||||
inner.setAttribute("sandbox", "allow-scripts allow-same-origin");
|
||||
const HOST = "http://localhost:7001";
|
||||
window.addEventListener("message", (event) => {
|
||||
if (event.source === window.parent && event.origin === HOST) {
|
||||
if (event.data.method === "ui/notifications/sandbox-resource-ready") {
|
||||
inner.srcdoc = event.data.params.html; // srcdoc inherits this page's CSP header
|
||||
document.body.append(inner);
|
||||
} else {
|
||||
inner.contentWindow?.postMessage(event.data, "*");
|
||||
}
|
||||
} else if (event.source === inner.contentWindow) {
|
||||
window.parent.postMessage(event.data, HOST);
|
||||
}
|
||||
});
|
||||
window.parent.postMessage({ jsonrpc: "2.0", method: "ui/notifications/sandbox-proxy-ready", params: {} }, HOST);
|
||||
</script>
|
||||
Reference in New Issue
Block a user