- Fix RESOURCE_MIME_TYPE to match spec: "text/html;profile=mcp-app" - Add CSP field to McpUiSandboxResourceReadyNotification type and schema - Update basic-host to extract and pass CSP metadata from resources - Update sandbox.ts to dynamically inject CSP meta tag into inner iframe - Remove static CSP from sandbox.html (now dynamic based on resource metadata) - Update QR server to use custom read_resource handler for _meta injection - Update requirements.txt to require mcp[cli]>=1.23.3 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
52 lines
1.3 KiB
HTML
52 lines
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<style>
|
|
html, body {
|
|
margin: 0;
|
|
padding: 0;
|
|
overflow: hidden;
|
|
background: transparent;
|
|
}
|
|
body {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
height: 340px;
|
|
width: 340px;
|
|
}
|
|
img {
|
|
width: 300px;
|
|
height: 300px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="qr"></div>
|
|
<script type="module">
|
|
import { App, PostMessageTransport } from "https://unpkg.com/@modelcontextprotocol/ext-apps@0.0.1";
|
|
|
|
const app = new App({ name: "QR Widget", version: "1.0.0" });
|
|
|
|
app.ontoolresult = ({ content }) => {
|
|
const img = content?.find(c => c.type === 'image');
|
|
if (img) {
|
|
const qrDiv = document.getElementById('qr');
|
|
qrDiv.innerHTML = '';
|
|
|
|
const allowedTypes = ['image/png', 'image/jpeg', 'image/gif'];
|
|
const mimeType = allowedTypes.includes(img.mimeType) ? img.mimeType : 'image/png';
|
|
|
|
const image = document.createElement('img');
|
|
image.src = `data:${mimeType};base64,${img.data}`;
|
|
image.alt = "QR Code";
|
|
qrDiv.appendChild(image);
|
|
}
|
|
};
|
|
|
|
await app.connect(new PostMessageTransport(window.parent));
|
|
</script>
|
|
</body>
|
|
</html>
|