1.2 KiB
1.2 KiB
Stitch API reference
This document describes the data structures returned by the Stitch MCP server to ensure accurate component mapping.
Metadata schema
When calling get_screen, the server returns a JSON object with these key properties:
- htmlCode: Contains a
downloadUrl. This is a signed URL that requires a system-level fetch (curl) to handle redirects and security handshakes. - screenshot: Includes a
downloadUrlfor the visual design. Use this to verify layout intent that might not be obvious in the raw HTML. - deviceType: Usually set to
DESKTOP. All generated components should prioritize the corresponding viewport (2560px width) as the base layout.
Technical mapping rules
- Element tracking: Preserve
data-stitch-idattributes as comments in the TSX to allow for future design synchronization. - Asset handling: Treat background images in the HTML as dynamic data. Extract the URLs into
mockData.tsrather than hardcoding them into the component styles. - Style extraction: The HTML
<head>contains a localizedtailwind.config. This config must be merged with the local project theme to ensure colors likeprimaryandbackground-darkrender correctly.