feat(mcp-server): the canvas shell is the default preview, the classic page behind DRAWIO_PREVIEW_UI=classic

This commit is contained in:
dayuan.jiang
2026-10-11 20:56:07 +09:00
parent af842ac287
commit 27c49a68d0
6 changed files with 31 additions and 17 deletions
+4 -5
View File
@@ -1,8 +1,8 @@
/**
* The canvas shell as start_session opens it with DRAWIO_PREVIEW_UI=shell:
* the built server (dist/index.js, or the copy MCP_SERVER_ENTRY names: CI
* installs the packed tarball in an empty directory) runs over stdio as an
* MCP client would start it, and headless Chromium opens the URL it returns.
* The canvas shell as start_session opens it by default: the built server
* (dist/index.js, or the copy MCP_SERVER_ENTRY names: CI installs the packed
* tarball in an empty directory) runs over stdio as an MCP client would
* start it, and headless Chromium opens the URL it returns.
*/
import { mkdtempSync, readFileSync, rmSync } from "node:fs"
import { tmpdir } from "node:os"
@@ -26,7 +26,6 @@ test.beforeAll(async () => {
env: {
...process.env,
DRAWIO_DATA_DIR: dataDir,
DRAWIO_PREVIEW_UI: "shell",
// Away from the web app's dev server and other test runs
PORT: String(6100 + Math.floor(Math.random() * 400)),
BROWSER: "none",
+10 -1
View File
@@ -27,6 +27,7 @@ import {
keepInHistory,
onSessionRecreate,
onStateChange,
previewUiFromEnv,
previewUrl,
requestExport,
requestSelection,
@@ -928,7 +929,15 @@ describe("canvas shell page", () => {
}
})
it("is what start_session opens with DRAWIO_PREVIEW_UI=shell", () => {
it("is what start_session opens, unless DRAWIO_PREVIEW_UI=classic", () => {
expect(previewUiFromEnv({})).toBe("shell")
expect(previewUiFromEnv({ DRAWIO_PREVIEW_UI: "shell" })).toBe("shell")
expect(previewUiFromEnv({ DRAWIO_PREVIEW_UI: "classic" })).toBe(
"classic",
)
expect(previewUiFromEnv({ DRAWIO_PREVIEW_UI: "Classic" })).toBe(
"classic",
)
expect(previewUrl(6002, "mcp-x", "shell")).toBe(
"http://localhost:6002/shell/?mcp=mcp-x",
)
@@ -95,9 +95,9 @@ beforeAll(async () => {
...process.env,
DRAWIO_DATA_DIR: dataDir,
// For the session tests at the end: no browser window, the
// canvas shell as the preview, a port away from other servers
// default preview (the canvas shell), a port away from other
// servers
BROWSER: "none",
DRAWIO_PREVIEW_UI: "shell",
PORT: String(6500 + Math.floor(Math.random() * 400)),
},
}) as ChildProcessWithoutNullStreams