Skip to main content
Glama

npm version License: MIT Downloads Node MCP


Without DesignxCode: Manual token audits, stale code values, design-code drift discovered in production, hours spent copying values from Figma.

With DesignxCode: One prompt to Claude and you get a sync score, drift report, generated code files, and a PR ready to merge.


Quick Start

npx (zero install)

npx designxcode-mcp-server

Claude Code

claude mcp add designxcode -e FIGMA_ACCESS_TOKEN=your-token -e GITHUB_TOKEN=your-token -- npx designxcode-mcp-server

Add to your MCP config file:

{
  "mcpServers": {
    "designxcode": {
      "command": "npx",
      "args": ["designxcode-mcp-server"],
      "env": {
        "FIGMA_ACCESS_TOKEN": "your-figma-token",
        "GITHUB_TOKEN": "your-github-token"
      }
    }
  }
}

Client

Config location

Claude Desktop

~/Library/Application Support/Claude/claude_desktop_config.json

Cursor

Settings > MCP Servers

Windsurf

~/.windsurf/mcp.json

git clone https://github.com/thevoiduniverse/designxcode-mcp.git
cd designxcode-mcp
npm install
npm run build
node dist/index.js

Related MCP server: Figma Console MCP Server

What You Can Ask Claude

"How in sync is our design system?"
"Extract all tokens from our Figma file"
"Which components are missing in code?"
"Generate CSS and Tailwind tokens from Figma"
"Create a PR to fix the drifted tokens"
"Show me unused tokens in our codebase"
"Implement this Figma frame as a React component"

Tools

Token Tools

  • extract_tokens - Extract design tokens (variables) from Figma in W3C, Style Dictionary, or raw format

  • sync_tokens_to_code - Generate platform-specific token files (CSS, SCSS, Tailwind, JSON, Swift, Kotlin)

  • detect_unused_tokens - Find tokens defined in Figma that aren't used in your codebase

  • extract_styles - Extract legacy Figma styles (colors, text, effects, grids)

Audit Tools

  • audit_system_health - Comprehensive 0-100 sync score combining token drift + component parity

  • audit_component_parity - Compare Figma components against code components via Storybook or file tree

Code Generation

  • generate_coded_components - Generate production React components from Figma frames

  • implement_design - Convert a Figma frame into design-system-aware code

  • generate_theme_config - Create theme configuration files from Figma variables

  • generate_component_scaffold - Scaffold component file structure from Figma components

Workflow Tools

  • generate_sync_pr - Create a GitHub PR with token updates (supports dry run)

  • generate_design_doc - Generate design documentation from Figma components

  • get_design_context - Get full design context for a Figma node (styles, tokens, structure)

  • set_design_rules - Define rules for how design tokens map to code patterns

  • export_assets - Export icons and images from Figma as optimized assets

Prerequisites

Requirement

Details

Node.js

>= 18

Figma token

Generate here

GitHub token

Optional. Required for PRs and component parity via file tree

Environment Variables

Variable

Required

Description

FIGMA_ACCESS_TOKEN

Yes

Figma personal access token with file read access

GITHUB_TOKEN

No

GitHub PAT with repo scope for PR generation and code scanning

IMPORTANT

The Figma Variables API (extract_tokens, sync_tokens_to_code) requires a Figma Enterprise or Organization plan. On Professional plans, a local fallback is used automatically.

How It Works

Figma Design System
        |
        v
  DesignxCode MCP  ──────> Claude analyzes your tokens,
        |                   components, and code
        v
  Your Codebase    <──────  Generates files, creates PRs,
                            reports drift
  1. You ask Claude a question about your design system

  2. Claude calls the right DesignxCode tool via MCP

  3. The tool reads from Figma API and/or your GitHub repo

  4. Results come back to Claude who explains them and takes action

Figma File Key

Extract from any Figma URL:

https://www.figma.com/design/ABC123xyz/My-Design-File
                              ^^^^^^^^^
                              This is your fileKey
https://www.figma.com/design/ABC123xyz/branch/DEF456/My-File
                                              ^^^^^^
                                              Use this as fileKey

Architecture

src/
├── index.ts              # Server entry, tool registration
├── tools/                # 15 MCP tool implementations
│   ├── extract-tokens    # Figma variables → W3C/SD format
│   ├── sync-tokens       # Tokens → CSS/SCSS/Tailwind/Swift/Kotlin
│   ├── audit-*           # Health score, component parity
│   ├── generate-*        # Components, PRs, docs, themes
│   └── implement-design  # Figma frame → production code
├── clients/              # Figma & GitHub API adapters
├── transforms/           # Style Dictionary platform transforms
├── utils/                # Diffing, inference, formatting
└── types/                # TypeScript definitions

Development

npm run dev          # Watch mode with tsx
npm run build        # TypeScript compilation
npm run inspect      # Test with MCP Inspector
npm run clean        # Clean dist/

Troubleshooting

The Variables REST API requires a Figma Enterprise or Organization plan. On free/Professional plans, the API returns 403. The server automatically falls back to local token files when available.

Your access token is invalid or expired. Generate a new one at Figma > Settings > Personal access tokens.

Your GITHUB_TOKEN may be expired or lack the required scopes. Ensure it has repo scope (and read:org for private org repos).

Figma's API has rate limits. If you hit 429 Too Many Requests, wait a minute before retrying. The server surfaces rate-limit errors clearly - no silent failures.

npm run clean && npm run build

Ensure Node >= 18 and run npm install to refresh dependencies.

Token Scopes

Generate at Figma > Settings > Personal access tokens. Needs read access to target files. For the Variables API, your workspace must be on an Enterprise or Organization plan.

Required for audit_component_parity (file-tree source), audit_system_health, and generate_sync_pr.

Scope

Purpose

repo

Create branches, commits, and pull requests

read:org

Access private repositories in an organization

Generate at GitHub > Settings > Developer settings > Fine-grained tokens.

Contributing

Contributions are welcome! Please open an issue first to discuss what you'd like to change.

License

MIT


Available Tools

13 tools
audit_component_parityAudit Component ParityA
Read-onlyIdempotent

Compare Figma components against code components to find coverage gaps.

Fetches components from Figma and compares against a Storybook manifest or component mapping from GitHub. Uses fuzzy name matching (normalizes casing, strips spaces/hyphens) to find matches.

Args:

  • figma_file_key (string): The Figma file key

  • figma_page_name (string, optional): Filter Figma components to a specific page

  • github_repo (string): GitHub repo in 'owner/repo' format

  • storybook_manifest_path (string, optional): Path to stories.json in the repo

  • component_mapping_path (string, optional): Path to a JSON mapping file

Returns: Coverage report with: matched components, missing in code, missing in Figma, coverage percentage, and Figma links.

Examples:

  • "How many of our Figma components are implemented?" → audit_component_parity

  • "Check parity for our design system" → audit_component_parity with storybook path

Inputs: github_repo (required), figma_file_key (required), figma_page_name, component_mapping_path, +1 more.

audit_system_healthAudit Design System HealthA
Read-onlyIdempotent

Run a comprehensive health check on your design system, combining token drift analysis and component parity into a single sync score.

This is an orchestrator tool that calls extract_tokens + audit_component_parity internally and merges the results into a unified health report.

Args:

  • figma_file_key (string): The Figma file key

  • github_repo (string): GitHub repo in 'owner/repo' format

  • token_file_path (string, optional): Path to token JSON file in the repo to diff against

  • storybook_manifest_path (string, optional): Path to stories.json for component parity

  • component_mapping_path (string, optional): Path to component mapping JSON

Returns: Health report with:

  • score (0-100): Overall sync health

  • tokenDrift: Token diff results (added, removed, changed)

  • componentParity: Component coverage results

  • warnings: Array of non-fatal errors encountered

  • timestamp: When the audit ran

Examples:

  • "How in sync is our design system?" → audit_system_health

  • "Give me a health report for our DS" → audit_system_health with all paths

Inputs: github_repo (required), figma_file_key (required), token_file_path, component_mapping_path, +1 more.

detect_unused_tokensDetect Unused TokensA
Read-onlyIdempotent

Scan a GitHub repository for design token usage and identify unused tokens.

Extracts tokens from a Figma file, derives CSS/SCSS/Tailwind variable names, and searches the GitHub repo for references. Reports which tokens have zero references in the codebase.

Args:

  • figma_file_key (string): The Figma file key from the URL

  • github_repo (string): GitHub repository in 'owner/repo' format

  • collection_names (string[], optional): Filter to specific variable collections

  • search_patterns (string[]): Pattern types to search: 'css', 'scss', 'tailwind', 'all' (default: ['all'])

  • file_extensions (string[], optional): Filter to specific file extensions

Returns: JSON report with total/used/unused token counts, usage map, and list of unused tokens.

Examples:

  • "Find unused tokens in our repo" → detect_unused_tokens with figma_file_key + github_repo

  • "Check if color tokens are used" → detect_unused_tokens with collection_names: ["Colors"]

  • "Search only CSS files" → detect_unused_tokens with file_extensions: ["css", "scss"]

Inputs: github_repo (required), figma_file_key (required), file_extensions, search_patterns, +1 more.

export_assetsExport Figma AssetsA
Read-onlyIdempotent

Export SVG/PNG/JPG/PDF assets from Figma components.

Renders component nodes as images via the Figma Image API. Can export specific nodes by ID, filter by component name or page, and optionally fetch SVG content inline.

Args:

  • figma_file_key (string): The Figma file key from the URL

  • node_ids (string[], optional): Specific node IDs to export

  • component_names (string[], optional): Filter components by name

  • format ('svg' | 'png' | 'jpg' | 'pdf'): Export format (default: 'svg')

  • scale (number, optional): Render scale 0.01–4 (default: 1, ignored for SVG)

  • page_name (string, optional): Filter to a specific page

  • inline_svg (boolean, optional): Fetch SVG content inline (default: false)

Returns: JSON with asset URLs (and optional inline SVG content) for each exported component.

Examples:

  • "Export all icons as SVG" → export_assets with format: "svg", page_name: "Icons"

  • "Export Button component as PNG at 2x" → export_assets with component_names: ["Button"], format: "png", scale: 2

  • "Get inline SVG for the Logo" → export_assets with component_names: ["Logo"], inline_svg: true

Inputs: figma_file_key (required), scale, format, node_ids, +3 more.

extract_stylesExtract Figma StylesA
Read-onlyIdempotent

Extract typography, fill, effect, and grid styles from a Figma file with resolved values.

Unlike variables/tokens, styles contain visual properties like font families, colors, shadows, and grid layouts. This tool fetches style metadata AND resolves the actual property values from document nodes.

Args:

  • figma_file_key (string): The Figma file key from the URL

  • style_types (string[], optional): Filter to specific types: "FILL", "TEXT", "EFFECT", "GRID"

  • output_format ('structured' | 'css' | 'raw'): Output format (default: 'structured')

Returns: JSON with styles grouped by type, including resolved property values and summary statistics.

Examples:

  • "Extract all styles from our Figma file" → extract_styles with just figma_file_key

  • "Get only typography styles" → extract_styles with style_types: ["TEXT"]

  • "Export styles as CSS custom properties" → extract_styles with output_format: "css"

Inputs: figma_file_key (required), style_types, output_format.

extract_tokensExtract Design TokensA
Read-onlyIdempotent

Extract design tokens (variables) from a Figma file and convert to standard formats.

Fetches all Figma Variables from the specified file and converts them to the requested format. Supports W3C Design Token Community Group format, Style Dictionary input format, or raw Figma API response.

Args:

  • figma_file_key (string): The Figma file key from the URL

  • collection_names (string[], optional): Filter to specific variable collections

  • output_format ('w3c' | 'style-dictionary' | 'raw'): Output format (default: 'w3c')

Returns: JSON with token data and summary statistics including counts by type and collection.

Examples:

  • "Extract all design tokens from our Figma file" → extract_tokens with just figma_file_key

  • "Get only color tokens" → extract_tokens with collection_names: ["Colors"]

  • "Export tokens for Style Dictionary pipeline" → extract_tokens with output_format: "style-dictionary"

Inputs: figma_file_key (required), output_format, collection_names.

generate_coded_componentsGenerate Coded ComponentsA
Read-onlyIdempotent

Generate production-ready, pixel-perfect coded components from Figma.

Extracts layout, colors, typography, spacing, effects from Figma node trees, resolves variable bindings to design tokens, diffs variants for state/dimensional overrides, detects nested components, and emits framework-specific code.

Args:

  • figma_file_key (string): The Figma file key

  • component_names (string[], optional): Specific components (default: all)

  • framework ('react-tailwind' | 'react-css' | 'react-native' | 'html-css'): Target framework

  • output_dir (string): Output directory (default: 'src/components')

  • state_prop_names (string[]): Variant props that become CSS pseudo-classes

  • include_storybook (boolean): Generate Storybook files (default: false)

Returns: JSON with generated component files, props, dependencies, and summary.

Inputs: framework (required), figma_file_key (required), output_dir, component_names, +2 more.

generate_sync_prGenerate Sync PRA

Create a GitHub pull request to sync design token changes from Figma to code.

Takes an array of file updates (typically from sync_tokens_to_code output) and creates a branch, commits the files, and opens a PR. Supports dry_run mode to preview without creating.

Args:

  • github_repo (string): GitHub repo in 'owner/repo' format

  • base_branch (string, optional): Base branch (default: repo's default branch)

  • token_updates (array): Files to update, each with 'path' and 'content'

  • pr_title (string, optional): PR title

  • pr_body (string, optional): Custom PR body

  • dry_run (boolean, optional): Preview without creating (default: false)

Returns: For dry_run: PR preview with branch name, title, body, and files. For real: Created PR URL, number, branch, and commit SHA.

Examples:

  • "Create a PR with the token updates" → generate_sync_pr with token_updates from sync_tokens_to_code

  • "Preview what the PR would look like" → generate_sync_pr with dry_run: true

Inputs: github_repo (required), token_updates (required), dry_run, pr_body, +2 more.

generate_theme_configGenerate Theme ConfigA
Read-onlyIdempotent

Extract multi-theme configurations from Figma Variable modes.

Generates theme-aware output files (CSS custom properties with theme selectors, Tailwind config, or TypeScript ThemeProvider) from Figma Variable modes (Light/Dark/etc).

Args:

  • figma_file_key (string): The Figma file key

  • output_format ('css' | 'tailwind' | 'theme-provider' | 'all'): Output format (default: 'css')

  • color_scheme_strategy ('data-attribute' | 'media-query' | 'class'): CSS selector strategy (default: 'data-attribute')

  • default_mode (string, optional): Override base theme mode name

Returns: JSON with generated file(s) and summary of modes/token counts.

Inputs: figma_file_key (required), default_mode, output_format, color_scheme_strategy.

get_design_contextGet Design ContextA
Read-onlyIdempotent

Load design system context (tokens, components, patterns, rules) from a Figma file.

Call this before generating UI code to ensure the output uses correct design tokens, reuses existing components, and follows established patterns.

Args:

  • figma_file_key (string): The Figma file key

  • task_description (string, optional): Task context for relevance filtering

  • sections (string[], optional): Specific sections to include (default: all)

  • refresh (boolean): Force re-fetch from Figma (default: false)

Returns: Markdown document with design system tokens, components, patterns, and rules.

Examples:

  • "Load full design system" -> get_design_context with just figma_file_key

  • "Get context for a login form" -> get_design_context with task_description: "login form"

  • "Refresh tokens only" -> get_design_context with sections: ["tokens"], refresh: true

Inputs: figma_file_key (required), refresh, sections, task_description.

implement_designImplement DesignA
Read-onlyIdempotent

Convert a Figma frame into production code using design system tokens and components.

Every visual value (color, spacing, typography, shadow) is matched against the project's design system tokens. Matched values use token references (e.g., var(--primary)); unmatched values use raw Figma values and are flagged in the mapping report.

Args:

  • figma_file_key (string): Figma file key containing the frame to implement

  • node_id (string): Node ID of the frame/section to implement

  • framework ('react-tailwind' | 'react-css' | 'react-native' | 'html-css'): Target framework

  • component_name (string, optional): Name for the generated component (inferred from frame name if omitted)

  • design_system_file_key (string, optional): Figma file key for the design system (tokens, variables, components). Use when the design system is in a different file than the frame being implemented.

Returns: Three content blocks: generated code, token/component mapping report, and a Figma screenshot.

Inputs: node_id (required), framework (required), figma_file_key (required), component_name, +1 more.

set_design_rulesSet Design RulesA
Idempotent

Define explicit design rules that the AI should follow when generating code.

Rules supplement auto-inferred patterns and take precedence over them. Stored locally and persist across sessions.

Args:

  • figma_file_key (string): The Figma file key to associate rules with

  • rules (array): Design rules with optional category

  • mode ('replace' | 'append'): Whether to replace all rules or append (default: 'append')

Returns: Confirmation with total rule count.

Examples:

  • "Always use 8px grid" -> set_design_rules with rules: [{ rule: "Always use 8px grid", category: "spacing" }]

  • "Reset all rules" -> set_design_rules with mode: "replace", rules: [{ rule: "New rule" }]

Inputs: rules (required), figma_file_key (required), mode.

sync_tokens_to_codeSync Tokens to CodeA
Read-onlyIdempotent

Generate platform-specific design token files from Figma variables.

Extracts tokens from Figma, transforms them through Style Dictionary into platform-specific code (CSS custom properties, SCSS variables, Tailwind config, Swift UIColor, Kotlin Compose, or JSON).

This tool does NOT commit files — it returns the generated file contents for review. Use generate_sync_pr to commit and create a PR.

Args:

  • figma_file_key (string): The Figma file key

  • platforms (string[]): Target platforms — one or more of: 'css', 'scss', 'tailwind', 'swift', 'kotlin', 'json'

  • collection_names (string[], optional): Filter to specific collections

  • output_dir (string, optional): Output directory path (default: 'tokens')

Returns: JSON with generated files (path + content) and a summary of what was generated per platform.

Examples:

  • "Generate CSS and SCSS tokens from Figma" → sync_tokens_to_code with platforms: ["css", "scss"]

  • "Create mobile tokens" → sync_tokens_to_code with platforms: ["swift", "kotlin"]

Inputs: platforms (required), figma_file_key (required), output_dir, collection_names.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 13 tools

    Disambiguation4/5

    The tools are mostly cleanly separated across extraction, auditing, context/rules, code generation, and PR syncing. The main potential confusion is between generate_coded_components and implement_design, since both generate code from Figma, but the descriptions distinguish component-set generation from single-frame implementation with token mapping.

    Naming Consistency5/5

    All tool names use consistent snake_case and are almost entirely verb-led noun phrases such as extract_tokens, audit_component_parity, and generate_sync_pr. There are no mixed camelCase or vague utility names.

    Tool Count5/5

    The server has 13 tools, which fits comfortably in the ideal 3-15 range for a design-system-to-code integration. Each tool maps to a recognizable phase of the workflow, with no obvious filler tools.

    Completeness5/5

    The surface covers token and style extraction, asset export, platform-specific token generation, theme configs, parity and health audits, unused-token detection, design context and rules, component generation, frame implementation, and PR creation. For a Figma design-system-to-code server, this is a comprehensive lifecycle with no obvious blocking gap.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Enables bidirectional control between Claude Code and Figma with real-time sync, allowing creation and manipulation of design elements, component management, and document inspection through natural language commands.
      50
      4
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables Claude to interact directly with Figma Desktop for creating UI components, managing design tokens, and auditing files through natural language. It establishes a live connection between the AI and the Figma API via a local server and companion plugin.
      MIT