Documentation

FigClank MCP Agent Guide

A quick reference for AI agents using the FigClank MCP server for design-to-code workflows.

Capabilities

This MCP can:

  • Read nodes, styles, components, and tokens from design documents
  • Query nodes by type, name, component, size, and text style
  • Export nodes as SVG (PNG support limited)
  • Inspect screens for layout, component usage, and text content

This MCP cannot:

  • Create, update, or delete nodes
  • Modify styles, components, or tokens
  • Edit document structure
  • Write any data

Quick Start Strategy

1. documents_getSnapshot → Get document overview + pin version
2. tokens_get → Load design system tokens early
3. nodes_query → Find target screen/frame
4. nodes_getSubtree → Get screen node tree
5. components_get → Resolve INSTANCE references
6. export_svg → Export icons/vectors as needed
7. Generate code using gathered information

Mapping Rules

Typography

FigClank PropertyCSS/React Native
fontName.familyfontFamily
fontSizefontSize (px)
fontName.stylefontWeight, fontStyle
lineHeight.value (PIXELS)lineHeight (px)
lineHeight.value (PERCENT)lineHeight (em/ratio)
letterSpacing.value (PIXELS)letterSpacing (px)
textAlignHorizontaltextAlign

Spacing/Radius

FigClank PropertyCSS Property
layout.padding.toppaddingTop (px)
layout.itemSpacinggap (px)
style.cornerRadiusborderRadius (px)

Layout (Auto Layout)

FigClank LayoutCSS Flexbox
mode: HORIZONTALflexDirection: row
mode: VERTICALflexDirection: column
primaryAxisAlign: MINjustifyContent: flex-start
primaryAxisAlign: CENTERjustifyContent: center
primaryAxisAlign: MAXjustifyContent: flex-end
primaryAxisAlign: SPACE_BETWEENjustifyContent: space-between
counterAxisAlign: MINalignItems: flex-start
counterAxisAlign: CENTERalignItems: center
counterAxisAlign: STRETCHalignItems: stretch
primaryAxisSizing: AUTONo explicit width/height
primaryAxisSizing: FILLflex: 1

Colors

FigClank colors are 0-1 floats. Convert to hex:

function colorToHex(color: MCPColor): string {
  const r = Math.round(color.r * 255);
  const g = Math.round(color.g * 255);
  const b = Math.round(color.b * 255);
  return `#${r.toString(16).padStart(2, '0')}${g.toString(16).padStart(2, '0')}${b.toString(16).padStart(2, '0')}`;
}

Known Limitations

Complex Vectors May Flatten

Very complex vector shapes with multiple boolean operations may lose some fidelity in SVG export. For complex illustrations, consider exporting as PNG (if supported), simplifying in the design, or using external asset references.

Text Overflow Behavior

Text overflow and truncation may differ between platforms. FigClank uses Figma-style text rendering. Web/iOS/Android have different text engines. Test text-heavy components carefully.

Constraints vs Auto Layout

Designs can use either constraints (absolute positioning) or auto layout (flexbox). Check node.layout.mode - if not "NONE", it's auto layout. Check node.constraints for positioned elements. Some frames mix both approaches.

Rate Limits

ToolDescription
General API calls100/min
export_svg20/min
nodes_getSubtree30/min
nodes_query60/min
If rate limited, wait and retry with exponential backoff.

Error Handling

Common error codes:

ToolDescription
NOT_FOUNDDocument/node doesn't exist – Check IDs
FORBIDDENNo access to resource – Verify permissions
VALIDATION_ERRORInvalid parameters – Check input format
RATE_LIMITEDToo many requests – Wait and retry