import assert from 'node:assert/strict'; import test from 'node:test'; import { GLOBE_PANEL_URI, MCP_APP_MIME_TYPE, createGlobePanelResource, } from './globePanel.js'; import { panelRuntime } from '../app/globePanelRuntime.js'; import { composeCatalog, coreTools } from './index.js'; test('the globe panel is an MCP Apps resource that loads the app through its server', () => { const resource = createGlobePanelResource({ runtime: panelRuntime }); 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'); const { csp } = resource._meta.ui; // The panel reaches only map and font providers; the app's own files // and data come through the MCP server, so no app address is declared. assert.deepEqual(csp.connectDomains, csp.resourceDomains); assert.ok(csp.resourceDomains.includes('https://tile.googleapis.com')); assert.ok( csp.resourceDomains.every((origin) => origin.startsWith('https://')), ); assert.equal(csp.frameDomains, undefined); assert.equal(csp.baseUriDomains, undefined); assert.match(resource.text, /"toolName":"panel_request"/); assert.match(resource.text, /"panelBase":"\/panel\/"/); assert.match(resource.text, /'ui\/initialize'/); assert.match(resource.text, /'ui\/notifications\/tool-result'/); assert.match(resource.text, /"protocolVersion":"2026-01-26"/); // The MCP Apps SDK's initialize parameters; hosts reject anything else. assert.match(resource.text, /appInfo: \{/); assert.doesNotMatch(resource.text, /clientInfo/); // Fullscreen where the host offers it. assert.match(resource.text, /'ui\/request-display-mode'/); assert.match(resource.text, /