New advertisers: 50% off your first month with code FIRSTMONTHSee slots

Figma design platform integration. Access design files, extract component information, read design tokens, and translate designs into code. Bridge the gap between design and development workflows.

GitHub stars
36.5K

Add marketplace

/plugin marketplace add anthropics/knowledge-work-plugins

Run it inside Claude Code once, then install the plugin below.

Install

/plugin install figma@knowledge-work-plugins

Run it inside Claude Code after adding the marketplace.

Files

Discovered from source

Code Connect

Overview

Create Code Connect template files (.figma.ts) that map Figma components to code snippets. Given a Figma URL, follow the steps below to create a template.

You write .figma.ts template files ONLY — never .figma.tsx. This skill produces parserless templates: a .figma.ts file whose default export uses a figma.code`...` tagged template. Do NOT write a .figma.tsx file and do NOT use figma.connect() — that is the separate parser-based Code Connect format (published a different way) and is the wrong artifact for this skill; output written as .figma.tsx is rejected outright. If a .figma.tsx already exists for a component, leave it untouched and add your .figma.ts template alongside it. A capable model may be tempted to reach for the more familiar .figma.tsx / figma.connect() pattern from memory — resist it; here the correct output is always .figma.ts + figma.code.

Prerequisites

  • Figma MCP server must be connected — verify that Figma MCP tools (e.g., get_code_connect_suggestions) are available before proceeding. If not, guide the user to enable the Figma MCP server and restart their MCP client.
  • Components must be published — Code Connect only works with components published to a Figma team library. If a component is not published, inform the user and stop.
  • Organization or Enterprise plan required — Code Connect is not available on Free or Professional plans.
  • URL must include node-id — the Figma URL must contain the node-id query parameter.
  • TypeScript types — for editor autocomplete and type checking in .figma.ts files @figma/code-connect/figma-types must be added to types in tsconfig.json:
    {
      "compilerOptions": {
        "types": ["@figma/code-connect/figma-types"]
      }
    }
    

Step 1: Parse the Figma URL

Extract fileKey and nodeId from the URL:

URL FormatfileKeynodeId
figma.com/design/:fileKey/:name?node-id=X-Y:fileKeyX-Y → X:Y
figma.com/file/:fileKey/:name?node-id=X-Y:fileKeyX-Y → X:Y
figma.com/design/:fileKey/branch/:branchKey/:nameuse :branchKeyfrom node-id param

Always convert nodeId hyphens to colons: 1234-5678 → 1234:5678.

Worked example:

Given: https://www.figma.com/design/QiEF6w564ggoW8ftcLvdcu/MyDesignSystem?node-id=4185-3778

  • fileKey = QiEF6w564ggoW8ftcLvdcu
  • nodeId = 4185-3778 → 4185:3778

Step 2: Discover Unmapped Components

The user may provide a URL pointing to a frame, instance, or variant — not necessarily a component set or standalone component. Call the MCP tool get_code_connect_suggestions with:

  • fileKey — from Step 1
  • nodeId — from Step 1 (colons format)
  • excludeMappingPrompt — true (returns a lightweight list of unmapped components)

This tool identifies published components in the selection that don't yet have Code Connect mappings.

Handle the response:

  • "No published components found in this selection" — the node contains no published components. Inform the user they need to publish the component to a team library in Figma first, then stop.
  • "All component instances in this selection are already connected to code via Code Connect" — everything is already mapped. Inform the user and stop.
  • Normal response with component list — extract the mainComponentNodeId for each returned component. Use these resolved node IDs (not the original from the URL) for all subsequent steps. If multiple components are returned (e.g. the user selected a frame containing several different component instances), repeat Steps 3–6 for each one.

Step 3: Fetch Component Properties

Call the MCP tool get_context_for_code_connect with:

  • fileKey — from Step 1
  • nodeId — the resolved mainComponentNodeId from Step 2
  • clientFrameworks — determine from figma.config.json parser field (e.g. "react" → ["react"])
  • clientLanguages — infer from project file extensions (e.g. TypeScript project → ["typescript"], JavaScript → ["javascript"])

For multiple components, call the tool once per node ID.

The response contains the Figma component's property definitions — note each property's name and type:

  • TEXT — text content (labels, titles, placeholders)
  • BOOLEAN — toggles (show/hide icon, disabled state)
  • VARIANT — enum options (size, variant, state)
  • INSTANCE_SWAP — swappable nested instances tied to a specific component (icon, avatar)
  • SLOT — flexible content regions (freeform layout, mixed children); use getSlot() in templates (not the same as INSTANCE_SWAP)

Save this property list — you will use it in Step 5 to write the template.

Step 4: Identify the Code Component

If the user did not specify which code component to connect:

  1. Check figma.config.json for paths and importPaths to find where components live
  2. Search the codebase for a component matching the Figma component name. Check common directories (src/components/, components/, lib/ui/, app/components/) if figma.config.json doesn't specify paths
  3. Read candidate files and compare their props interface against the Figma properties from Step 3 — look for matching variant types, size options, boolean flags, and slot props
  4. If multiple candidates match, pick the one with the closest prop-interface match and explain your reasoning to the user
  5. If no match is found, show the 2 closest candidates and ask the user to confirm or provide the correct path

Confirm with the user before proceeding to Step 5. Present the match: which code component you found, where it lives, and why it matches (prop correspondence, naming, purpose).

Read figma.config.json for import path aliases — the importPaths section maps glob patterns to import specifiers, and the paths section maps those specifiers to directories.

Read the code component's source to understand its props interface — this informs how to map Figma properties to code props in Step 5.

Step 5: Create the Template File (.figma.ts)

File location

Place the file alongside existing Code Connect files. Check figma.config.json include patterns for the correct directory. Name it ComponentName.figma.ts — never ComponentName.figma.tsx. The .figma.tsx extension is the parser-based format; do not create one or modify an existing one.

Template structure

Every template file follows this structure:

// url=https://www.figma.com/file/{fileKey}/{fileName}?node-id={nodeId}
// source={path to code component from Step 4}
// component={code component name from Step 4}
import figma from 'figma'
const instance = figma.selectedInstance

// Extract properties from the Figma component (see property mapping below)
// ...

export default {
  example: figma.code`<Component ... />`,       // Required: code snippet
  imports: ['import { Component } from "..."'], // Optional: import statements
  id: 'component-name',                         // Required: unique identifier
  metadata: {                                    // Optional
    nestable: true,                              // true = inline in parent, false = show as pill
    props: {}                                    // data accessible to parent templates
  }
}

Property mapping

Use the property list from Step 3 to extract values. For each Figma property type, use the corresponding method:

Figma Property TypeTemplate MethodWhen to Use
TEXTinstance.getString('Name')Labels, titles, placeholder text
BOOLEANinstance.getBoolean('Name', { true: ..., false: ... })Toggle visibility, conditional props
VARIANTinstance.getEnum('Name', { 'FigmaVal': 'codeVal' })Size, variant, state enums
INSTANCE_SWAPinstance.getInstanceSwap('Name')Swapped instance for a fixed component slot (then hasCodeConnect() / executeTemplate()) - do not confuse with the SLOT property below
SLOTinstance.getSlot('Name')Freeform slot content only when the Figma property type is SLOT
(child layer)instance.findInstance('LayerName')Named child instances without a property
(text layer)instance.findText('LayerName') → .textContentText content from named layers

TEXT — get the string value directly:

const label = instance.getString('Label')

VARIANT — map Figma enum values to code values:

const variant = instance.getEnum('Variant', {
  'Primary': 'primary',
  'Secondary': 'secondary',
})

const size = instance.getEnum('Size', {
  'Small': 'sm',
  'Medium': 'md',
  'Large': 'lg',
})

BOOLEAN — simple boolean or mapped to values:

// Simple boolean
const disabled = instance.getBoolean('Disabled')

// Mapped to code values (e.g. when the code prop is an enum, not a boolean)
const size = instance.getBoolean('Show Label', { true: 'large', false: 'small' })

Map Figma properties to code props where there's a valid correspondence. Figma properties and code props don't always line up 1:1 — some Figma properties map directly (by name, or via the API methods above), others have no code equivalent. Where a mapping exists, use it; where none fits, omit the Figma property rather than invent a code prop. Never emit an attribute whose name doesn't appear in the code component's Props interface.

Exhaustive variant handling

When a VARIANT property has multiple possible values, the getEnum mapping must list every value returned by get_context_for_code_connect. Don't omit values — an unmapped value silently returns undefined, producing broken output.

// WRONG — omits 'Warning', which will render as undefined
const status = instance.getEnum('Status', {
  'Success': 'success',
  'Error': 'error',
})

// CORRECT — every value is mapped
const status = instance.getEnum('Status', {
  'Success': 'success',
  'Error': 'error',
  'Warning': 'warning',
  'Info': 'info',
})

When two or more VARIANT properties combine to produce different code output, generate exhaustive conditional branches. For example, 2 variants × 2 values = 4 branches:

const type = instance.getEnum('Type', { 'Filled': 'filled', 'Outlined': 'outlined' })
const status = instance.getEnum('Status', { 'Success': 'success', 'Error': 'error' })

let colorClass
if (type === 'filled' && status === 'success') {
  colorClass = 'bg-green-500 text-white'
} else if (type === 'filled' && status === 'error') {
  colorClass = 'bg-red-500 text-white'
} else if (type === 'outlined' && status === 'success') {
  colorClass = 'bg-transparent border-green-500'
} else if (type === 'outlined' && status === 'error') {
  colorClass = 'bg-transparent border-red-500'
}

If the combinations produce repetitive output (e.g., Size doesn't change the snippet structure — it's just passed through as a prop), a single getEnum mapping per variant is sufficient — no need for cross-product branches.

INSTANCE_SWAP — access swappable component instances:

const icon = instance.getInstanceSwap('Icon')
let iconCode
if (icon && icon.type === 'INSTANCE') {
  iconCode = icon.executeTemplate().example
}

SLOT — getSlot(propName) is only valid when the Figma component property reported in Step 3 has type SLOT. Do not use getSlot() for INSTANCE_SWAP properties (those use getInstanceSwap()). Slots are explicit “content regions” in the component definition, not generic nested instances.

  • Signature: getSlot(propName: string): ResultSection[] | undefined
// Figma property "Content" must be type SLOT in component properties
const content = instance.getSlot('Content')

export default {
  example: figma.code`<Card>${content}</Card>`,
  // ...
}

Interpolation in tagged templates

When interpolating values in tagged templates, use the correct wrapping:

  • String values (getString, getEnum, textContent): wrap in quotes → variant="${variant}"
  • Instance/section values (executeTemplate().example): wrap in braces → icon={${iconCode}}
  • Slot sections (getSlot() result — ResultSection[] | undefined): interpolate directly inside figma.code`...` (same shape as nested snippet sections), e.g. figma.code`<Select>${content}</Select>` — do not treat as a plain string
  • Boolean bare props: use conditional → ${disabled ? 'disabled' : ''}

Finding descendant layers

When you need to access children that aren't exposed as component properties:

MethodUse when
instance.getInstanceSwap('PropName')Figma property type is INSTANCE_SWAP (fixed swapped instance)
instance.getSlot('PropName')Figma property type is SLOT (freeform content region)
instance.findInstance('LayerName')You know the child layer name (no component property)
instance.findText('LayerName') → .textContentYou need text content from a named text layer
instance.findConnectedInstance('id')You know the child's Code Connect id
instance.findConnectedInstances(fn)You need multiple connected children matching a filter
instance.findLayers(fn)You need any layers (text + instances) matching a filter

Nested configurable instances

A component may contain child instances that are not exposed as component properties (no INSTANCE_SWAP) but are still independently configurable — they have their own variants, properties, or swap slots. These must be resolved dynamically, not hardcoded.

  1. Check whether the child already has a Code Connect template — use get_code_connect_suggestions or check existing .figma.ts files in the project.
  2. If no template exists, create one for the child so it renders correctly both standalone and when nested.
  3. Reference the child from the parent using findInstance() or findConnectedInstance(), then call executeTemplate().
// Parent template — the Badge child isn't a prop, but it's configurable
const badge = instance.findInstance('Status Badge')
let badgeCode
if (badge && badge.type === 'INSTANCE') {
  badgeCode = badge.executeTemplate().example
}

export default {
  example: figma.code`<Card>${badgeCode}</Card>`,
  // ...
}

This applies to icons, badges, labels, and any other nested instance that is configurable by itself — always connect them and render dynamically, never hardcode their content.

Nested component example

For multi-level nested components or metadata prop passing between templates, see advanced-patterns.md.

const icon = instance.getInstanceSwap('Icon')
let iconSnippet
if (icon && icon.type === 'INSTANCE') {
  iconSnippet = icon.executeTemplate().example
}

export default {
  example: figma.code`<Button ${iconSnippet ? figma.code`icon={${iconSnippet}}` : ''}>${label}</Button>`,
  // ...
}

Conditional props

const variant = instance.getEnum('Variant', { 'Primary': 'primary', 'Secondary': 'secondary' })
const disabled = instance.getBoolean('Disabled')

export default {
  example: figma.code`
    <Button
      variant="${variant}"
      ${disabled ? 'disabled' : ''}
    >
      ${label}
    </Button>
  `,
  // ...
}

Step 6: Validate

Read back the .figma.ts file and review it against the following:

  • Correct file type & format (check this FIRST) — the file is ComponentName.figma.ts (NOT .figma.tsx), and its default export is a parserless template using a figma.code`...` tagged template. It must NOT use figma.connect() (the parser-based format). If you wrote .figma.tsx or figma.connect(), discard it and rewrite as a .figma.ts figma.code template.
  • Property coverage — every Figma property from Step 3 should be accounted for in the template. Flag any that are missing and ask the user if they were intentionally omitted.
  • Valid, correctly typed code — all emitted code must be valid and correctly typed against the code component's Props interface. Never make up component properties — if a Figma property has no corresponding code prop, omit it rather than invent one.
  • No hardcoded children — verify that every INSTANCE_SWAP property and child component slot uses the dynamic APIs (getInstanceSwap(), findInstance(), findConnectedInstance(), etc.) with executeTemplate(). No slot should contain hardcoded component content.
  • Rules and Pitfalls — check for the common mistakes listed below (string concatenation of template results, unnecessary hasCodeConnect() guards, missing type === 'INSTANCE' checks, etc.)
  • Interpolation wrapping — strings (getString, getEnum, textContent) wrapped in quotes, instance/section values (executeTemplate().example) wrapped in braces, slot sections (getSlot) interpolated as snippet sections inside figma.code`...`, booleans using conditionals

If anything looks uncertain, consult api.md for API details and advanced-patterns.md for complex nesting.

Inline Quick Reference

instance.* Methods

MethodSignatureReturns
getString(propName: string)string
getBoolean(propName: string, mapping?: { true: any, false: any })boolean | any
getEnum(propName: string, mapping: { [figmaVal]: codeVal })any
getInstanceSwap(propName: string)InstanceHandle | null
getSlot(propName: string)ResultSection[] | undefined
getPropertyValue(propName: string)string | boolean
findInstance(layerName: string, opts?: SelectorOptions)InstanceHandle | ErrorHandle
findText(layerName: string, opts?: SelectorOptions)TextHandle | ErrorHandle
findConnectedInstance(codeConnectId: string, opts?: SelectorOptions)InstanceHandle | ErrorHandle
findConnectedInstances(selector: (node) => boolean, opts?: SelectorOptions)InstanceHandle[]
findLayers(selector: (node) => boolean, opts?: SelectorOptions)(InstanceHandle | TextHandle)[]

InstanceHandle Methods

MethodReturns
hasCodeConnect()boolean
executeTemplate(){ example: ResultSection[], metadata: Metadata }
codeConnectId()string | null

TextHandle Properties

PropertyType
.textContentstring
.namestring

SelectorOptions

{ path?: string[], traverseInstances?: boolean }
  • traverseInstances: true — required when the target lives inside another nested instance. Without it, findInstance/findText only search the current instance's own layers and stop at nested instance boundaries.
  • path: string[] — disambiguates when multiple descendants share the same layer name. Lists parent layer names that must appear on the path to the target.

Examples:

// Layer hierarchy:
//   A > C (instance) > "mychild"
// "mychild" sits inside nested instance C, so plain findInstance returns ErrorHandle.
instance.findInstance('mychild', { traverseInstances: true })

// Layer hierarchy:
//   A > C (instance) > "mychild"
//   A > D (instance) > "mychild"
// Two "mychild" layers exist — use path to pick the one under C.
instance.findInstance('mychild', { traverseInstances: true, path: ['C'] })

When to reach into a nested instance from a parent template: only when the parent code component (from Step 4) takes the nested layer as a prop value itself (e.g. <C show={<B />} /> — A forwards B into C). If the parent just composes C and C renders B internally, resolve C with executeTemplate() and let C's own template handle B — don't duplicate B's rendering at the parent level.

Export Structure

export default {
  example: figma.code`...`,                      // Required: ResultSection[]
  id: 'component-name',                         // Required: string
  imports: ['import { X } from "..."'],          // Optional: string[]
  metadata: { nestable: true, props: {} }        // Optional
}

Rules and Pitfalls

  1. Never string-concatenate template results. executeTemplate().example is a ResultSection[] object, not a string. Using + or .join() produces [object Object]. Always interpolate inside tagged templates: figma.code`${snippet1}${snippet2}`

  2. Do not use hasCodeConnect() guards. Call executeTemplate() directly on any instance after a type === 'INSTANCE' check. The runtime handles instances without Code Connect automatically.

    // WRONG — hasCodeConnect() gate drops non-CC instances
    if (icon && icon.type === 'INSTANCE' && icon.hasCodeConnect()) {
      iconCode = icon.executeTemplate().example
    }
    
    // CORRECT — let the runtime handle all instances
    if (icon && icon.type === 'INSTANCE') {
      iconCode = icon.executeTemplate().example
    }
    
  3. Check type === 'INSTANCE' before calling executeTemplate(). findInstance(), findConnectedInstance(), and findText() return an ErrorHandle (truthy, but not a real node) on failure — not null. Always add a type check to avoid crashes: if (child && child.type === 'INSTANCE') { ... }

  4. Prefer getInstanceSwap() over findInstance() when a component property exists for the slot. findInstance('Star Icon') breaks when the icon is swapped to a different name; getInstanceSwap('Icon') always works regardless of which instance is in the slot.

  5. Use getSlot() only when the Figma property type is SLOT. For INSTANCE_SWAP props, use getInstanceSwap() (returns an InstanceHandle). getSlot() returns structured slot sections, not instances — never call executeTemplate() on its return value.

  6. Property names are case-sensitive and must exactly match what get_context_for_code_connect returns.

  7. Handle multiple template arrays correctly. When iterating over children, set each result in a separate variable and interpolate them individually — do not use .map().join():

    // Wrong:
    items.map(n => n.executeTemplate().example).join('\n')
    
    // Correct — use separate variables:
    const child1 = items[0]?.executeTemplate().example
    const child2 = items[1]?.executeTemplate().example
    export default { example: figma.code`${child1}${child2}` }
    
  8. Never hardcode slot or children content. Always resolve child instances dynamically — use getInstanceSwap() for INSTANCE_SWAP properties, findInstance()/findConnectedInstance() for direct children — and render them via executeTemplate(). Never construct JSX from a layer name (e.g., <StarIcon />) or guess import paths. If an instance has no Code Connect, omit it — do not add a hardcoded fallback.

    // WRONG — hardcodes the icon from its layer name
    example: figma.code`<Button icon={<StarIcon />}>Submit</Button>`
    
    // CORRECT — resolves dynamically, works for any swapped icon
    const icon = instance.findInstance('Icon')
    let iconCode
    if (icon && icon.type === 'INSTANCE') {
      iconCode = icon.executeTemplate().example
    }
    example: figma.code`<Button${iconCode ? figma.code` icon={${iconCode}}` : ''}>...</Button>`
    
  9. Attempt to represent every Figma property via a code prop. The code component's Props interface (from Step 4) is the authoritative list of attribute names. For each Figma property, figure out the right way to represent it using the API methods from Step 5 — direct name match, value transformation, or whatever fits. If no code prop fits at all, omit it — don't invent a prop name.

Complete Worked Example

Given URL: https://figma.com/design/abc123/MyFile?node-id=42-100

Step 1: Parse the URL.

  • fileKey = abc123
  • nodeId = 42-100 → 42:100

Step 2: Call get_code_connect_suggestions with fileKey: "abc123", nodeId: "42:100", excludeMappingPrompt: true. Response returns one component with mainComponentNodeId: "42:100". If the response were empty, stop and inform the user. If multiple components were returned, repeat Steps 3–6 for each.

Step 3: Call get_context_for_code_connect with fileKey: "abc123", nodeId: "42:100" (from Step 2), clientFrameworks: ["react"], clientLanguages: ["typescript"].

Response includes properties:

  • Label (TEXT)
  • Variant (VARIANT): Primary, Secondary
  • Size (VARIANT): Small, Medium, Large
  • Disabled (BOOLEAN)
  • Has Icon (BOOLEAN)
  • Icon (INSTANCE_SWAP)

Step 4: Search codebase → find Button component. Read its source to confirm props: variant, size, disabled, icon, children. Import path: "primitives".

Step 5: Create src/figma/primitives/Button.figma.ts:

// url=https://figma.com/design/abc123/MyFile?node-id=42-100
// source=src/components/Button.tsx
// component=Button
import figma from 'figma'
const instance = figma.selectedInstance

const label = instance.getString('Label')
const variant = instance.getEnum('Variant', {
  'Primary': 'primary',
  'Secondary': 'secondary',
})
const size = instance.getEnum('Size', {
  'Small': 'sm',
  'Medium': 'md',
  'Large': 'lg',
})
const disabled = instance.getBoolean('Disabled')
const hasIcon = instance.getBoolean('Has Icon')
const icon = hasIcon ? instance.getInstanceSwap('Icon') : null
let iconCode
if (icon && icon.type === 'INSTANCE') {
  iconCode = icon.executeTemplate().example
}

export default {
  example: figma.code`
    <Button
      variant="${variant}"
      size="${size}"
      ${disabled ? 'disabled' : ''}
      ${iconCode ? figma.code`icon={${iconCode}}` : ''}
    >
      ${label}
    </Button>
  `,
  imports: ['import { Button } from "primitives"'],
  id: 'button',
  metadata: { nestable: true }
}

Step 6: Read back file to verify syntax.

Additional Reference

For advanced patterns (multi-level nested components, findConnectedInstances filtering, metadata prop passing between parent/child templates):

Readme

Figma MCP Server Guide

The Figma MCP server brings Figma directly into your workflow by providing important design information and context to AI agents generating code from Figma design files.

[!NOTE] Rate limits apply to Figma MCP server tools that read data from Figma. Some tools, such as those that write to Figma files, are exempt from the rate limits.

Users on the Starter plan or with View or Collab seats on paid plans will be limited to up to 6 tool calls per month.

Users with a Dev or Full seat on the Professional, Organization, or Enterprise plans have per minute rate limits, which follow the same limits as the Tier 1 Figma REST API. As with Figma’s REST API, Figma reserves the right to change rate limits.

For the complete set of Figma MCP server docs, see our developer documentation. By using the Figma MCP server and the related resources (including these skills), you agree to the Figma Developer Terms. These skills are currently available as a Beta feature.

Features

  • Write to the canvas (remote server only): Create and modify native Figma content directly from your MCP client. With the right skills, agents can build and update frames, components, variables, and auto layout in your Figma files using your design system as the source of truth.

    Note: We're quickly improving how Figma supports AI agents. The write to canvas feature will eventually be a usage-based paid feature, but is currently available for free during the beta period.

  • Generate placeholder images: When suitable source, captured, or library images are unavailable, agents can use Figma’s generate_image and then tell the user that Figma AI credits were used. If Figma AI is unavailable or its credit limit is reached, agents ask before using another provider and use upload_assets for images from that provider.

  • Generate code from selected frames

    Select a Figma frame and turn it into code. Great for product teams building new flows or iterating on app features.

  • Extract design context

    Pull in variables, components, and layout data directly into your IDE. This is especially useful for design systems and component-based workflows.

  • Code smarter with Code Connect

    Boost output quality by reusing your actual components. Code Connect keeps your generated code consistent with your codebase.

    Learn more about Code Connect →

  • Generate Figma designs from web pages (rolling out)

    Capture, import, or convert a web page into a Figma design directly from your AI coding agent.

Installation & Setup

Connect to the Figma MCP server

Different MCP clients require slightly different setups. Follow the instructions below for your specific client to connect to the Figma MCP server.

VS Code
  1. Use the shortcut ⌘ Shift P to search for MCP:Add Server.
  2. Select HTTP.
  3. Paste the server url https://mcp.figma.com/mcp in the search bar. Then hit Enter.
  4. When you're prompted for a server ID, enter figma.
  5. Select whether you want to add this server globally or only for the current workspace. Once confirmed, you'll see a configuration like this in your mcp.json file:
{
  "servers": {
    "figma": {
      "type": "http",
      "url": "https://mcp.figma.com/mcp"
    }
  }
}
  1. Open the chat toolbar using ⌥⌘B or ⌃⌘I and switch to Agent mode.
  2. With the chat open, type in #get_design_context to confirm that the Figma MCP server tools are available. If no tools are listed, restart VS Code.

[!NOTE] You must have GitHub Copilot enabled on your account to use MCP in VS Code.

For more information, see VS Code's official documentation.

Cursor

The recommended way to set up the Figma MCP server in Cursor is by installing the Figma Plugin, which includes MCP server settings as well as Agent Skills for common workflows.

Install the plugin by typing the following command in Cursor's agent chat:

/add-plugin figma

The plugin includes:

  • MCP server configuration for the Figma MCP server
  • Skills for implementing designs, connecting components via Code Connect, and creating design system rules
  • Rules for proper asset handling from the Figma MCP server
Manual setup
  1. Open Cursor → Settings → Cursor Settings.
  2. Go to the MCP tab.
  3. Click + Add new global MCP server.
  4. Enter the following configuration and save:
{
  "mcpServers": {
    "figma": {
      "url": "https://mcp.figma.com/mcp"
    }
  }
}

For more information, see Cursor's official documentation.

Claude Code

The recommended way to set up the Figma MCP server in Claude Code is by installing the Figma Plugin, which includes MCP server settings as well as Agent Skills for common workflows.

Run the following command to install the plugin from Anthropic's official plugin marketplace.

claude plugin install figma@claude-plugins-official

Learn more about Anthropic's Claude Code Plugins and Agent Skills.

Manual setup
  1. Open your terminal and run:
claude mcp add --transport http figma https://mcp.figma.com/mcp
  1. Use the following commands to check MCP settings and manage servers:
  • List all configured servers
    claude mcp list
    
  • Get details for a specific server
    claude mcp get my-server
    
  • Remove a server
    claude mcp remove my-server
    

For more information, see Anthropic's official documentation.

Gemini CLI

Install the Figma extension for Gemini CLI by running the following command:

gemini extensions install https://github.com/figma/mcp-server-guide

Once installed, authenticate with Figma by running gemini and then executing the following command within the CLI:

/mcp auth figma

To uninstall the extension:

gemini extensions uninstall figma
Other editors

Other code editors and tools that support Streamable HTTP can also connect to the Figma MCP server.

If you're using a different editor or tool, check its documentation to confirm it supports Streamable HTTP based communication. If it does, you can manually add the Figma MCP server using this configuration:

{
  "mcpServers": {
    "figma": {
      "url": "https://mcp.figma.com/mcp"
    }
  }
}

Prompting your MCP client

The Figma MCP server introduces a set of tools that help LLMs translate designs in Figma. Once connected, you can prompt your MCP client to access a specific design node.

To provide Figma design context to your AI client:

  1. Copy the link to a frame or layer in Figma.
  2. Prompt your client to help you implement the design at the selected URL.

[!NOTE] Your client won't be able to navigate to the selected URL, but it will extract the node-id that is required for the MCP server to identify which object to return information about.

Tools and skills

Figma maintains a list of tools provided by the Figma MCP server in the developer documentation.

You can also learn more about the skills included with the Figma plugin for supported agents in the Figma Help Center. Depending on the agent, you may also see the terms connector, extension, or power; these include the same set of skills.

This repo also contains standalone workflow skills that are not bundled with the Figma plugin:

MCP best practices

The quality of the generated code depends on several factors. Some controlled by you, and some by the tools you're using. Here are some suggestions for clean, consistent output.

Structure your Figma file for better code

Provide the best context for your design intent, so the MCP and your AI assistant can generate code that's clear, consistent, and aligned with your system.

  • Use components for anything reused (buttons, cards, inputs, etc.)
  • Link components to your codebase via Code Connect. This is the best way to get consistent component reuse in code. Without it, the model is guessing.
  • Use variables for spacing, color, radius, and typography.
  • Name layers semantically (e.g. CardContainer, not Group 5)
  • Use Auto layout to communicate responsive intent.

[!TIP] Resize the frame in Figma to check that it behaves as expected before generating code.

  • Use annotations and dev resources to convey design intent that's hard to capture from visuals alone, like how something should behave, align, or respond.

Write effective prompts to guide the AI

MCP gives your AI assistant structured Figma data, but your prompt drives the result. Good prompts can:

  • Align the result with your framework or styling system
  • Follow file structure and naming conventions
  • Add code to specific paths (e.g. src/components/ui)
  • Add or modify code in existing files instead of creating new ones
  • Follow specific layout systems (e.g. grid, flexbox, absolute)

Examples:

  • "Generate iOS SwiftUI code from this frame"
  • "Use Chakra UI for this layout"
  • "Use src/components/ui components"
  • "Add this to src/components/marketing/PricingCard.tsx"
  • "Use our Stack layout component"

Think of prompts like a brief to a teammate. Clear intent leads to better results.

Trigger specific tools when needed

The MCP supports different tools, and each one provides your AI assistant with a different kind of structured context. Sometimes, the assistant doesn't automatically pick the right one, especially as more tools become available. If results are off, try being explicit in your prompt.

  • get_design_context provides a structured React + Tailwind representation of your Figma selection. This is a starting point that your AI assistant can translate into any framework or code style, depending on your prompt.
  • get_variable_defs extracts the variables and styles used in your selection (color, spacing, typography, etc). This helps the model reference your tokens directly in the generated code.

For example, if you're getting raw code instead of tokens, try something like:

  • "Get the variable names and values used in this frame."

Add custom rules

Set project-level guidance to keep output consistent—just like onboarding notes for a new developer. These are things like:

  • Preferred layout primitives
  • File organization
  • Naming patterns
  • What not to hardcode

You can provide this in whatever format your MCP client uses for instruction files.

Examples:

Ensure consistently good output
## Figma MCP Integration Rules
These rules define how to translate Figma inputs into code for this project and must be followed for every Figma-driven change.

### Required flow (do not skip)
1. Run get_design_context first to fetch the structured representation for the exact node(s).
2. If the response is too large or truncated, run get_metadata to get the high‑level node map and then re‑fetch only the required node(s) with get_design_context.
3. Run get_screenshot for a visual reference of the node variant being implemented.
4. Only after you have both get_design_context and get_screenshot, download any assets needed and start implementation.
5. Translate the output (usually React + Tailwind) into this project's conventions, styles and framework.  Reuse the project's color tokens, components, and typography wherever possible.
6. Validate against Figma for 1:1 look and behavior before marking complete.

### Implementation rules
- Treat the Figma MCP output (React + Tailwind) as a representation of design and behavior, not as final code style.
- Replace Tailwind utility classes with the project's preferred utilities/design‑system tokens when applicable.
- Reuse existing components (e.g., buttons, inputs, typography, icon wrappers) instead of duplicating functionality.
- Use the project's color system, typography scale, and spacing tokens consistently.
- Respect existing routing, state management, and data‑fetch patterns already adopted in the repo.
- Strive for 1:1 visual parity with the Figma design. When conflicts arise, prefer design‑system tokens and adjust spacing or sizes minimally to match visuals.
- Validate the final UI against the Figma screenshot for both look and behavior.
Cursor
---
description: Figma MCP server rules
globs:
alwaysApply: true
---
- The Figma MCP server provides an assets endpoint which can serve image and SVG assets
- IMPORTANT: If the Figma MCP server returns a localhost source for an image or an SVG, use that image or SVG source directly
- IMPORTANT: DO NOT import/add new icon packages, all the assets should be in the Figma payload
- IMPORTANT: do NOT use or create placeholders if a localhost source is provided
Claude Code
# MCP Servers

## Figma MCP server rules

- The Figma MCP server provides an assets endpoint which can serve image and SVG assets
- IMPORTANT: If the Figma MCP server returns a localhost source for an image or an SVG, use that image or SVG source directly
- IMPORTANT: DO NOT import/add new icon packages, all the assets should be in the Figma payload
- IMPORTANT: do NOT use or create placeholders if a localhost source is provided
General quality rules
- IMPORTANT: Always use components from `/path_to_your_design_system` when possible
- Prioritize Figma fidelity to match designs exactly
- Avoid hardcoded values, use design tokens from Figma where available
- Follow WCAG requirements for accessibility
- Add component documentation
- Place UI components in `/path_to_your_design_system`; avoid inline styles unless truly necessary

Adding these once can dramatically reduce the need for repetitive prompting and ensures that teammates or agents consistently follow the same expectations.

Be sure to check your IDE or MCP client's documentation for how to structure rules, and experiment to find what works best for your team. Clear, consistent guidance often leads to better, more reusable code with less back-and-forth.

Break down large selections

Break screens into smaller parts (like components or logical chunks) for faster, more reliable results.

Large selections can slow the tools down, cause errors, or result in incomplete responses, especially when there's too much context for the model to process. Instead:

  1. Generate code for smaller sections or individual components (e.g. Card, Header, Sidebar)
  2. If it feels slow or stuck, reduce your selection size

This helps keep the context manageable and results more predictable, both for you and for the model.

If something in the output doesn't look quite right, it usually helps to revisit the basics: how the Figma file is structured, how the prompt is written, and what context is being sent. Following the best practices above can make a big difference, and often leads to more consistent, reusable code.

Bringing Make context to your agent

The Make + MCP integration makes it easier to take prototypes from design to production. By connecting Make projects directly to your agent via MCP, you can extract resources and reuse them in your codebase. This reduces friction when extending prototypes into real applications, and ensures that design intent is faithfully carried through to implementation.

With this integration, you can:

  • Fetch project context directly from Make (individual files or the whole project)
  • Prompt to use existing code components instead of starting from scratch
  • Extend prototypes with real data to validate and productionize designs faster

How it works

[!NOTE] This integration leverages the MCP resources capability, which allows your agent to fetch context directly from Make projects. It is available only on clients that support MCP resources.

Steps to fetch resources from Make
  1. Prompt your agent to fetch context by providing a valid Make link
  2. Receive a list of available files from your Make project
  3. Download the files you want to fetch when prompted

Example workflow

Goal: Implement a popup component in your production codebase that matches the design and behavior defined in Make.

  1. Share your Make project link with your agent.
  2. Prompt the agent: "I want to get the popup component behavior and styles from this Make file and implement it using my popup component."

Your agent will fetch the relevant context from Make and guide you in extending your existing popup component with the prototype's functionality and styles.

Icon Guidelines

See the Figma Brand Usage Guidelines for displaying any icons contained in this repo.

Details

Marketplace
anthropics/knowledge-work-plugins
Source
https://github.com/figma/mcp-server-guide.git
Category
Design
Listed since
Apr 7, 2026

More from anthropics/knowledge-work-plugins

All 123

Similar to figma

More Design & UI/UX