File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ import mcpProxy from "./mcpProxy.js";
3131import { randomUUID , randomBytes , timingSafeEqual } from "node:crypto" ;
3232import { fileURLToPath } from "url" ;
3333import { dirname , join } from "path" ;
34- import { readFileSync } from "fs" ;
34+ import { existsSync , readFileSync } from "fs" ;
3535
3636const DEFAULT_MCP_PROXY_LISTEN_PORT = "6277" ;
3737
@@ -802,7 +802,15 @@ app.get(
802802 ( req , res ) => {
803803 const __filename = fileURLToPath ( import . meta. url ) ;
804804 const __dirname = dirname ( __filename ) ;
805- const filePath = join ( __dirname , ".." , "static" , "sandbox_proxy.html" ) ;
805+
806+ // Production: static/ is copied into build/ alongside index.js
807+ let filePath = join ( __dirname , "static" , "sandbox_proxy.html" ) ;
808+
809+ // Dev (tsx): static/ is a sibling of src/, one level up from __dirname
810+ if ( ! existsSync ( filePath ) ) {
811+ filePath = join ( __dirname , ".." , "static" , "sandbox_proxy.html" ) ;
812+ }
813+
806814 let sandboxHtml ;
807815
808816 try {
You can’t perform that action at this time.
0 commit comments