Skip to content

feat: modernize Excalidraw MCP for 0.4.0 - #96

Open
ChrisMcKee1 wants to merge 1 commit into
excalidraw:mainfrom
ChrisMcKee1:chrismckee-microsoft-mcp-standards-audit
Open

ChrisMcKee1 wants to merge 1 commit into
excalidraw:mainfrom
ChrisMcKee1:chrismckee-microsoft-mcp-standards-audit

Conversation

@ChrisMcKee1

Copy link
Copy Markdown

Summary

Modernize the server for MCP 2026-07-28, preserve explicit 2025-11-25 compatibility, and fix scene persistence and widget lifecycle issues identified during an audit of the MCP specification and nested Excalidraw developer documentation.

The previous server disabled session IDs, but that alone did not implement the current protocol or make checkpoint state reliable across requests and server instances. This PR addresses those gaps while retaining the streamed SVG preview and fullscreen Excalidraw editor architecture.

Changes

MCP transports and interoperability

  • Use the split TypeScript SDK v2 modern serving entry points for HTTP and stdio.
  • Replace the old Vercel wrapper with the same per-request factory and HTTP policy used locally. Each HTTP request receives a fresh server, avoiding the shared-transport configuration described in GHSA-345p-7cg4-v4c7.
  • Let the SDK handle discovery, request-scoped version/capability metadata, result envelopes, cache hints, and protocol errors.
  • Add explicit Host/Origin validation, CORS/preflight handling, bounded request parsing, and cancellation-aware sharing uploads.
  • Keep the MCP Apps iframe handshake independent of core protocol negotiation. The published Apps browser package retains its SDK v1 peer separately from server-side SDK v2 usage.

Scene validation and persistence

  • Introduce a shared, versioned scene envelope containing elements, image files, persistent app state, and viewport data.
  • Support exactly one serialized elements operation array or complete scene input to create_view.
  • Apply restore/delete/camera operations consistently in the server and widget; remove deleted containers and bound text, repair dangling references, and reject reused IDs.
  • Validate decoded JSON, geometry, image references, UTF-8 size, and structural limits before acknowledging a checkpoint.
  • Add revision-based compare-and-swap saves, atomic file replacement with cross-process locking, and Redis-backed atomic updates.
  • Preserve legacy checkpoint reads and local recovery copies. Disclose missing historical image bytes rather than silently overwriting the original data.
  • Preserve intentionally empty scenes, image bytes, background/grid settings, and viewport state across editing, reload, and export.

Widget correctness and recovery

  • Register and buffer host notifications before connection completes, including input-only startup and effect replay.
  • Prevent new input, results, cancellation, or delayed reloads from replacing protected local edits.
  • Scope checkpoint readiness and delayed model feedback to the correct invocation and acknowledged revision.
  • Handle null and other non-Error save failures without leaving the UI stuck in “saving”; retain recovery data and never blindly retry revision conflicts.
  • Coalesce asynchronous previews and discard stale work, including camera/delete-only updates.
  • Preserve explicit fonts and arrow bindings through native conversion; reject missing freehand geometry and normalize valid versionless strokes.
  • Restore capability-aware text/style feedback and bounded PNG context, plus visible keyboard focus, modal behavior, reduced-motion handling, and opt-in pencil audio.
  • Provide complete local .excalidraw downloads. Block external image sharing rather than returning links that omit image assets; shape/text sharing remains user-confirmed.

Packaging and documentation

  • Bump package and extension manifest versions to 0.4.0.
  • Centralize runtime asset versions and server/widget identity.
  • Update installation, deployment, storage, compatibility, and contributor documentation.
  • Add a maintained Excalidraw authoring skill and a stateful development mock.
  • Add a combined release gate and run it before npm publishing.

Upgrade notes

  • Node.js 22.15+ is now required; pnpm remains pinned to 10.11.0.
  • Vercel requires a complete Redis credential pair unless EXCALIDRAW_STORAGE=memory explicitly selects an ephemeral demo.
  • Local checkpoints move to persistent user application data, with a read-only fallback for the previous temporary location.
  • Existing widgets must reload before writing the complete revisioned scene format.
  • /mcp and /api/mcp remain available. The old /sse and /message routes are removed; HTTP GET/DELETE return 405 because session operations are not provided.
  • HTTP requests are limited to 4 MiB including JSON-RPC overhead; decoded scenes/checkpoints are limited to 5 MiB.
  • The widget still depends on declared CDN assets. This is not an offline bundle, and no authentication or tenant-ownership layer is introduced.

Validation

Executed successfully:

npm run check

This covers 114 source tests, TypeScript/declaration checks, the production build, and 2 bundled-CLI tests for modern and legacy stdio.

Regression coverage includes concurrent request-ID isolation, protocol/header errors, checkpoint conflicts and migration, cross-process file writes, image preservation, unsaved-edit/reload races, cancellation, startup replay, downloads, arrow bindings, and freehand conversion. Independent code review findings were reproduced and addressed with focused follow-up tests.

Coverage limits: widget lifecycle fixtures execute actual component handlers with browser dependencies mocked; converter fixtures use the installed Excalidraw implementation. Live Redis/Vercel deployment, production CDN cold loading, and end-to-end behavior across MCP Apps hosts remain separate deployment acceptance checks.

References

Serve current MCP requests with isolated transports and explicit legacy compatibility. Preserve complete revisioned scenes, image downloads, and recoverable edits across widget and storage lifecycles.

Add regression coverage, align runtime assets and documentation, and include the updated Excalidraw authoring skill.
@vercel

vercel Bot commented Sep 15, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Excalidraw Team on Vercel.

A member of the Team first needs to authorize it.

@delcode92

Copy link
Copy Markdown

greate

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants