Open History to see the last commit
1/**
2 * Shared constants for the MCP Apps demo (`/mcp-apps`).
3 *
4 * Two MCP servers back the demo:
5 * - a STATIC, display-only widget (an in-process server route, `WEATHER_*`)
6 * - a DYNAMIC, interactive widget — the official Three.js MCP Apps server
7 * (`THREEJS_*`), run as a separate process on :3001 (see the `dev` script).
8 *
9 * `serverId` on a `ui-resource` part is the client's tool-name prefix, which is
10 * how `createMcpAppCallHandler` routes an interactive call back to the right
11 * server — so the prefixes here must match on both the chat and call routes.
12 */
13
14/** Three.js MCP server's Streamable HTTP endpoint (started via `npm run dev`). */
15export const THREEJS_MCP_URL = 'http://localhost:3001/mcp'
16export const THREEJS_PREFIX = 'threejs'
17
18/** The in-process static-widget server is reached at the app's own origin. */
19export const WEATHER_SERVER_PATH = '/api/mcp-apps-weather-server'
20export const WEATHER_PREFIX = 'weather'
21
22/** The in-process interactive storefront server (calls a tool back via the bridge). */
23export const SHOP_SERVER_PATH = '/api/mcp-apps-shop-server'
24export const SHOP_PREFIX = 'shop'
25
26/**
27 * The sandbox-proxy page `AppRenderer` loads the widget into. It MUST be a
28 * different origin than the host page (security boundary), so it's served on
29 * its own port by `scripts/serve-sandbox.mjs`, not by Vite. Deploy-time
30 * constant — the same for every widget; it is NOT the widget's `ui://` URL.
31 */
32export const SANDBOX_PROXY_URL = 'http://localhost:8765/sandbox_proxy.html'
33
34/** Suggestion pills shown above the composer to trigger each kind of app. */
35export const MCP_APP_SUGGESTIONS = [
36 {
37 kind: 'static' as const,
38 label: '🌤️ Weather card (static)',
39 prompt: 'Show me the weather card for San Francisco.',
40 },
41 {
42 kind: 'shop' as const,
43 label: '🛍️ Storefront — buy a product (interactive)',
44 prompt: 'Show me the product catalog so I can buy something.',
45 },
46 {
47 kind: 'threejs' as const,
48 label: '🪐 Render a solar system (3D)',
49 prompt:
50 'Use the Three.js tool to render a solar system: a glowing sun at the center with several planets orbiting it at different distances and speeds.',
51 },
52]