Run God's Eye View inside the MCP Apps panel instead of framing it

Hosts such as Claude do not let a panel frame other sites, so the panel
now loads the app's page, styles and scripts into itself in inline embed
mode, and declares the app and map providers as resource and connect
domains. The dev server answers panel origins with CORS.
This commit is contained in:
Sameh Khamis committed 2026-10-02 15:21:37 -07:00
1 parent cb04fd5b19
commit 63341b947e
6 files changed
+185 -55

No files matched your search

+15 -4
View File
@@ -7,16 +7,27 @@ import {
} from './globePanel.js';
import { composeCatalog, coreTools } from './index.js';
test('the globe panel is an MCP Apps resource that may frame only the app', () => {
test('the globe panel is an MCP Apps resource that runs the app inside itself', () => {
const resource = createGlobePanelResource({
appUrl: 'http://localhost:5173/some/path',
});
assert.equal(resource.uri, GLOBE_PANEL_URI);
assert.equal(resource.mimeType, MCP_APP_MIME_TYPE);
assert.equal(MCP_APP_MIME_TYPE, 'text/html;profile=mcp-app');
assert.deepEqual(resource._meta.ui.csp, {
frameDomains: ['http://localhost:5173'],
});
const { csp } = resource._meta.ui;
// Hosts may not let a panel frame other sites, so it declares no frames
// and instead loads the app's code and data from the app's origin.
assert.equal(csp.frameDomains, undefined);
assert.equal(csp.resourceDomains[0], 'http://localhost:5173');
assert.deepEqual(csp.connectDomains.slice(0, 2), [
'http://localhost:5173',
'ws://localhost:5173',
]);
assert.ok(csp.resourceDomains.includes('https://tile.googleapis.com'));
assert.deepEqual(csp.baseUriDomains, ['http://localhost:5173']);
assert.match(resource.text, /window\.GEV_EMBED_INLINE = true/);
assert.match(resource.text, /fetch\(APP_ORIGIN \+ '\/\?embed=1'\)/);
assert.doesNotMatch(resource.text, /<iframe|createElement\('iframe'\)/);
assert.match(resource.text, /const APP_ORIGIN = "http:\/\/localhost:5173";/);
assert.match(resource.text, /'ui\/initialize'/);
assert.match(resource.text, /'ui\/notifications\/tool-result'/);