feat(mcp-server): serve the canvas shell at /shell/ behind DRAWIO_PREVIEW_UI

GET /shell/ fills the page template's {{CONFIG_JSON}} with the session,
the API token, where draw.io comes from and the host's editor settings,
with the classic page's security headers; /shell/<file> serves the built
files like the draw.io copy. start_session opens the shell when
DRAWIO_PREVIEW_UI=shell; the classic page stays the default.
This commit is contained in:
dayuan.jiang
2026-10-11 20:56:07 +09:00
parent 77c6a2d807
commit b6f42bcddc
4 changed files with 372 additions and 56 deletions
+2 -1
View File
@@ -57,6 +57,7 @@ import {
keepInHistory,
onSessionRecreate,
onStateChange,
previewUrl,
requestExport,
requestSync,
restoreHistoryEntry,
@@ -382,7 +383,7 @@ registerWriteTool(
}
// Open browser
const browserUrl = `http://localhost:${port}?mcp=${sessionId}`
const browserUrl = previewUrl(port, sessionId)
await open(browserUrl)
// A saved diagram comes back from its file. lastSeenXml stays