Skip to content

feat: support bound arrows via skeleton API start/end format#32

Open
sammcj wants to merge 4 commits intoexcalidraw:mainfrom
sammcj:connectors
Open

feat: support bound arrows via skeleton API start/end format#32
sammcj wants to merge 4 commits intoexcalidraw:mainfrom
sammcj:connectors

Conversation

@sammcj
Copy link
Copy Markdown

@sammcj sammcj commented Feb 15, 2026

This PR fixes issues where agents using the MCP server would create diagrams but not correctly connect / anchor arrows and lines to objects, leading to them floating where if you move an object the line or arrow would not remain connected. #33

Summary

  • Document and implement the skeleton API's start/end arrow binding format, which lets agents create connected arrows without computing coordinates manually
  • Add resolveArrowPositions post-processing step that computes arrow geometry from bound shape edges, fixing the gap where convertToExcalidrawElements creates binding metadata but leaves arrows unpositioned
  • Update cheat sheet to teach bound arrows as the preferred format over manual x/y/points
  • Fix null-coordinate guard to use != null instead of isNaN check, avoiding false positives when arrow coordinates are legitimately 0

Problem

AI agents consistently produced diagrams with floating arrows because:

  1. The cheat sheet documented startBinding/endBinding (inert output metadata) instead of the skeleton API's start/end input format
  2. convertToExcalidrawElements sets up bidirectional binding metadata but does not compute arrow x/y/points — arrows are left at undefined coordinates
  3. exportToSvg (used for all rendering) cannot render arrows without coordinates

Changes

src/server.ts — Cheat sheet updates:

  • Add bound arrow as preferred format with start/end by target element ID
  • Replace startBinding/endBinding docs with skeleton start/end format
  • Update drawing order guidance for bound arrow element ordering
  • Simplify two-box example to use bound arrow

src/mcp-app.tsx — Arrow position resolution:

  • Add resolveArrowPositions(): computes arrow x/y/points from bound shape edge midpoints using closest-cardinal-point geometry
  • Also resolves null-coordinate labels on bound arrows
  • Add contextElements parameter to convertRawElements so arrows can resolve binding targets from checkpoint base elements
  • Pass checkpoint base as context in both streaming and final render paths

CLAUDE.md — Correct project documentation to reflect skeleton API usage

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 15, 2026

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

A member of the Team first needs to authorize it.

@sammcj
Copy link
Copy Markdown
Author

sammcj commented Feb 19, 2026

@excalibot @excalidraw

@sammcj
Copy link
Copy Markdown
Author

sammcj commented Feb 24, 2026

Sorry to ping you directly but @dwelle any chance this could be considered for merging as it significantly improves the quality of the output generated with this MCP server.

@aminezar
Copy link
Copy Markdown

aminezar commented Apr 9, 2026

Was this implemented?

@sammcj
Copy link
Copy Markdown
Author

sammcj commented Apr 9, 2026

Nope, no response from the maintainers

@sammcj
Copy link
Copy Markdown
Author

sammcj commented Apr 13, 2026

@antonpk1 maybe?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants