Overview
Theget_code MCP tool generates production-ready code from Figma designs. It extracts styles, assets, and structure from selected nodes and transforms them into JSX or Vue components.
This is an MCP (Model Context Protocol) tool used by AI assistants. For plugin development, see definePlugin.
Parameters
Optional target node ID. Omit to use the current single selection when pulling the baseline snapshot.
Preferred output language to bias the snapshot. Falls back to the design’s hint/detected language, then JSX.
Inline token values instead of references for quick renders. When
false (default), returns token metadata so you can map into your theming system. When true, values are resolved per-node (mode-aware).Response
Generated component code in the specified language.
The actual output language used.
Array of asset metadata for images and vectors used in the code.
Token definitions referenced in the code. Each key is a canonical CSS variable name (e.g.,
--color-primary). Only included when tokens are detected.Code generation configuration used.
Array of warnings about the generated code.
Example Request
Example Response
Usage Notes
Token Resolution StrategyWhen
resolveTokens: false (recommended):- Code contains CSS variable references like
var(--color-primary) tokensobject provides token metadata- Map tokens to your design system manually
resolveTokens: true:- Values are inlined (mode-aware)
- Useful for quick previews
- May not match your token naming conventions
Code Generation Pipeline
The tool follows this pipeline:- Tree Building - Constructs visible node tree with depth limits
- Variable Mapping - Maps Figma variables to CSS tokens
- Asset Planning - Identifies images and vectors to export
- Style Collection - Extracts CSS styles from each node
- Asset Export - Generates optimized SVGs and raster images
- Rendering - Transforms tree into component markup
- Token Processing - Detects and transforms variable references
- Budget Validation - Ensures output fits within MCP payload limits
See Also
get_structure
Get node hierarchy and geometry
Transform Hooks
Customize code generation