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, HTML, or CSS
  • Inspect screens for layout, component usage, and text content
  • Mutate designs: create shapes/text, update nodes, align, distribute, group, wrap in auto layout, create components

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_css → Export assets or generate styles
7. Generate code using gathered information

For mutations:
8. agent_getSelectionSnapshot → Get selection for planner
9. agent_updateNode, agent_createShape, etc. → Apply changes
10. User clicks Sync from MCP in app to pull updates

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.

Agent Mutation Tools

Agents can mutate designs with these tools:

ToolDescription
agent_getSelectionSnapshotCompact JSON of selection for planner context
agent_updateNodeUpdate fills, effects, width, height, cornerRadius, opacity
agent_createShapeCreate rectangle, ellipse, frame, or triangle
agent_createTextCreate a text node
agent_wrapInAutoLayoutWrap selection in auto layout frame
agent_alignNodesAlign selection (left, center, right, top, middle, bottom)
agent_distributeNodesDistribute with even spacing
agent_groupNodesGroup selection into GROUP
agent_ungroupNodesUngroup a GROUP
agent_createComponentFromSelectionConvert selection to reusable component

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