Skip to content

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

Open
sammcj wants to merge 4 commits into
excalidraw:mainfrom
sammcj:connectors
Open

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

Conversation

@sammcj

@sammcj sammcj commented Feb 15, 2026

Copy link
Copy Markdown

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

vercel Bot commented Feb 15, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

@sammcj

sammcj commented Feb 19, 2026

Copy link
Copy Markdown
Author

@excalibot @excalidraw

@sammcj

sammcj commented Feb 24, 2026

Copy link
Copy Markdown
Author

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

aminezar commented Apr 9, 2026

Copy link
Copy Markdown

Was this implemented?

@sammcj

sammcj commented Apr 9, 2026

Copy link
Copy Markdown
Author

Nope, no response from the maintainers

@sammcj

sammcj commented Apr 13, 2026

Copy link
Copy Markdown
Author

@antonpk1 maybe?

@aminezar

Copy link
Copy Markdown

Maybe @dwelle? This is really important to a lot of users.

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