Files
next-ai-draw-io/packages/mcp-server/shell/main.tsx
T
dayuan.jiang 77c6a2d807 feat(mcp-server): canvas shell bundled from the web app's canvas with esbuild
The shell (packages/mcp-server/shell) renders DrawioFrame inside the
shared providers without the chat: its config comes from
window.__MCP_CONFIG__, the four dictionaries ship in the bundle, the
theme is kept under an mcp: localStorage key, and system fonts stand in
for the web fonts. scripts/build-shell.mjs bundles it into dist/shell
with the root's esbuild and Tailwind; check-package caps shell.js at
1.5 MB and shell.css at 300 KB.
2026-10-11 20:56:07 +09:00

29 lines
1.2 KiB
TypeScript

// Entry of the MCP's canvas shell, bundled by scripts/build-shell.mjs into
// dist/shell/shell.js and served at /shell/ by http-server.ts
import { createRoot } from "react-dom/client"
import { LocaleProvider } from "@/components/canvas/locale-context"
import { DiagramProvider } from "@/contexts/diagram-context"
import { DictionaryProvider } from "@/hooks/use-dictionary"
import { CanvasShell } from "./canvas-shell"
import { getShellDictionary, pickLocale } from "./dictionary"
import { pageShellConfig } from "./runtime-config"
import { initTheme } from "./theme"
const config = pageShellConfig()
const locale = pickLocale(config.lang, navigator.languages)
// The stylesheet picks the CJK fonts by the document's language
document.documentElement.lang = locale
initTheme(config.drawioDark)
const root = document.getElementById("root")
if (!root) throw new Error("The shell page has no #root element")
createRoot(root).render(
<DictionaryProvider dictionary={getShellDictionary(locale)}>
<LocaleProvider locale={locale}>
<DiagramProvider>
<CanvasShell config={config} />
</DiagramProvider>
</LocaleProvider>
</DictionaryProvider>,
)