File tree Expand file tree Collapse file tree 6 files changed +33
-104
lines changed
Expand file tree Collapse file tree 6 files changed +33
-104
lines changed Original file line number Diff line number Diff line change 1+ < meta http-equiv ="refresh " content ="0; url=/example-host-react.html ">
Original file line number Diff line number Diff line change 44 "version" : " 1.0.0" ,
55 "type" : " module" ,
66 "scripts" : {
7- "start" : " NODE_ENV=development npm run build && concurrently 'npm run start:server' " ,
8- "start:server" : " bun serve.ts " ,
9- "build" : " concurrently 'INPUT=example-host-vanilla.html vite build' 'INPUT=example-host-react.html vite build' 'INPUT=sandbox.html vite build' "
7+ "start" : " vite dev " ,
8+ "start:server" : " vite preview " ,
9+ "build" : " vite build"
1010 },
1111 "dependencies" : {
1212 "@modelcontextprotocol/ext-apps" : " ../.." ,
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -8,7 +8,11 @@ import { Tool } from "@modelcontextprotocol/sdk/types.js";
88import { AppRenderer , AppRendererProps } from "../src/AppRenderer" ;
99import { AppBridge } from "../../../dist/src/app-bridge" ;
1010
11- const SANDBOX_PROXY_URL = new URL ( "http://localhost:8081/sandbox.html" ) ;
11+ // We use '[::1]' for the sandbox to ensure it's a different origin from 'localhost'.
12+ const SANDBOX_PROXY_URL = new URL (
13+ "/sandbox.html" ,
14+ location . href . replace ( "localhost:" , "[::1]:" ) ,
15+ ) ;
1216
1317/**
1418 * Example React application demonstrating the AppRenderer component.
Original file line number Diff line number Diff line change @@ -18,7 +18,11 @@ import {
1818 McpUiSizeChangeNotificationSchema ,
1919} from "@modelcontextprotocol/ext-apps" ;
2020
21- const SANDBOX_PROXY_URL = new URL ( "http://localhost:8081/sandbox.html" ) ;
21+ // We use '[::1]' for the sandbox to ensure it's a different origin from 'localhost'.
22+ const SANDBOX_PROXY_URL = new URL (
23+ "/sandbox.html" ,
24+ location . href . replace ( "localhost:" , "[::1]:" ) ,
25+ ) ;
2226
2327window . addEventListener ( "load" , async ( ) => {
2428 const client = new Client ( {
Original file line number Diff line number Diff line change 11import { defineConfig } from "vite" ;
22import react from "@vitejs/plugin-react" ;
3- import { viteSingleFile } from "vite-plugin-singlefile" ;
43
5- const INPUT = process . env . INPUT ;
6- if ( ! INPUT ) {
7- throw new Error ( "INPUT environment variable is not set" ) ;
8- }
9-
10- const isDevelopment = process . env . NODE_ENV === "development" ;
11-
12- export default defineConfig ( {
13- plugins : [ react ( ) , viteSingleFile ( ) ] ,
14- build : {
15- sourcemap : isDevelopment ? "inline" : undefined ,
16- cssMinify : ! isDevelopment ,
17- minify : ! isDevelopment ,
18- rollupOptions : {
19- input : INPUT ,
4+ export default defineConfig ( ( { mode } ) => {
5+ const isDevelopment = mode === "development" ;
6+ return {
7+ plugins : [ react ( ) ] ,
8+ build : {
9+ sourcemap : isDevelopment ? "inline" : undefined ,
10+ cssMinify : ! isDevelopment ,
11+ minify : ! isDevelopment ,
12+ rollupOptions : {
13+ input : [
14+ "index.html" ,
15+ "example-host-vanilla.html" ,
16+ "example-host-react.html" ,
17+ "sandbox.html" ,
18+ ] ,
19+ } ,
20+ outDir : `dist` ,
21+ emptyOutDir : false ,
2022 } ,
21- outDir : `dist` ,
22- emptyOutDir : false ,
23- } ,
23+ } ;
2424} ) ;
You can’t perform that action at this time.
0 commit comments