Figma Connect
Bridge between Figma MCP server (reads designs, generates code, extracts tokens) and Code Connect CLI (publishes persistent component mappings to Dev Mode). Use MCP tools for READ operations, CLI for PUBLISH operations.
Prerequisites & Dual Auth
This skill requires two independent authentication paths:
MCP Auth (OAuth) — for all mcp__claude_ai_Figma__* tools:
- Call
whoami() to check. If it fails, the user needs to authenticate the Figma MCP server via their MCP client settings (OAuth flow).
- Requires Full or Dev seat on a paid Figma plan.
CLI Auth (Token) — for npx figma connect publish/parse/create:
- Check:
[ -n "$FIGMA_ACCESS_TOKEN" ] && echo "Token set" || echo "Token missing" or npx figma connect --version
- If missing: create a personal access token at figma.com/developers with scopes "Code Connect: Write" and "File content: Read"
- Set via:
export FIGMA_ACCESS_TOKEN=<token> (prefer .env with .gitignore entry to avoid shell history exposure)
Always check both before workflows that use both (Setup, Publish, Roundtrip). Design-to-Code and Token Extraction only need MCP auth.
Framework Detection
Auto-detect the project framework to set MCP clientFrameworks param and CLI Code Connect label:
| Detection Signal |
Framework |
Code Connect Label |
clientFrameworks |
package.json has react |
React |
React |
react |
package.json has next |
React (Next.js) |
React |
react,nextjs |
package.json has vue |
Vue |
Vue |
vue |
package.json has svelte |
Svelte |
Svelte |
svelte |
package.json has @angular/core |
Angular |
Web Components |
angular |
Podfile or *.xcodeproj + SwiftUI |
SwiftUI |
SwiftUI |
swiftui |
build.gradle.kts + Compose |
Compose |
Compose |
compose |
pubspec.yaml has flutter |
Flutter |
Flutter |
flutter |
| None detected / plain HTML |
Web Components |
Web Components |
html,css |
Precedence: User-stated framework in the prompt always overrides file detection. When ambiguous (e.g., monorepo with multiple frameworks), ask the user.
URL Parsing
Extract fileKey and nodeId from Figma URLs before calling MCP tools:
Standard: figma.com/design/:fileKey/:fileName?node-id=:nodeId
-> fileKey = :fileKey, nodeId = convert "-" to ":" in :nodeId
Branch: figma.com/design/:fileKey/branch/:branchKey/:fileName
-> fileKey = :branchKey (NOT :fileKey), nodeId from query param
Make: figma.com/make/:makeFileKey/:makeFileName
-> fileKey = :makeFileKey
Always convert node-id dashes to colons: 42-156 becomes 42:156.
Mode 1: Setup
When: New project, first-time Code Connect configuration.
Steps
Check MCP auth: Call whoami(). If fails, guide OAuth setup and stop.
Check CLI auth: Run npx figma connect --version. If not found, install:
npm install -D @figma/code-connect
Then check FIGMA_ACCESS_TOKEN is set.
Detect framework: Inspect project files (see Framework Detection table above).
Generate config: Create figma.config.json at project root:
{
"codeConnect": {
"parser": "react",
"include": ["src/components/**"],
"exclude": ["**/*.test.*", "**/*.stories.*"],
"label": "React"
}
}
Adjust parser, include, and label based on detected framework.
Generate design system rules (optional but recommended):
Call MCP create_design_system_rules() with clientFrameworks and clientLanguages.
Save the output to a rules file in the project (e.g., .cursor/rules/figma-design-system.md or .claude/rules/).
Extract initial tokens (optional):
If a Figma URL was provided, call get_variable_defs(fileKey, nodeId) and write tokens to the project's token file format (see Mode 4).
Output
@figma/code-connect installed
figma.config.json created
- Design system rules file saved
- Both auth paths verified
Mode 2: Design-to-Code
When: User shares a Figma URL and wants code implementation. (For new projects needing full setup first, run Mode 1 before this.)
Steps
Check MCP auth: Call whoami(). If it fails, guide OAuth setup and stop.
Parse URL: Extract fileKey and nodeId (see URL Parsing section).
Screenshot (visual confirmation):
Call get_screenshot(fileKey, nodeId) to see what we're implementing.
Check existing Code Connect:
Call get_code_connect_map(fileKey, nodeId) to check whether mappings exist. Note: get_design_context independently includes <CodeConnectSnippet> wrappers when mappings are present — prioritize these over generated code.
Get design context:
get_design_context(
fileKey, nodeId,
clientFrameworks: "<detected-framework>",
clientLanguages: "<detected-languages>"
)
Returns: reference code (default React+Tailwind), screenshot, asset download URLs.
Adapt to project conventions:
- Replace hardcoded colors/spacing with project tokens (CSS vars, Tailwind classes)
- Use existing project components instead of generating duplicates
- Follow project file naming and directory conventions
- Import from project's component library, not generated imports
- If Code Connect snippets were returned, use them as the primary implementation reference
Download assets: Use the asset URLs from get_design_context response for images, icons, etc.
Suggest Code Connect (if not set up):
If get_code_connect_map returned empty, suggest: "Consider setting up Code Connect to improve future design-to-code workflows. Run the Setup mode to get started."
MCP Tools Used
get_screenshot(fileKey, nodeId) — visual reference
get_code_connect_map(fileKey, nodeId) — check existing mappings
get_design_context(fileKey, nodeId, clientFrameworks, clientLanguages) — generate code
get_variable_defs(fileKey, nodeId) — extract tokens (optional, if needed for styling)
search_design_system(query, fileKey) — find reusable design system components (optional)
Mode 3: Code Connect Publish
When: User wants to map existing code components back to Figma so they appear in Dev Mode.
Prerequisites
- Both MCP and CLI auth verified
@figma/code-connect installed
figma.config.json exists (or will be created)
Steps
Get AI suggestions:
Call get_code_connect_suggestions(fileKey, nodeId, clientFrameworks, clientLanguages).
Returns: list of unmapped components with names, properties, thumbnails.
Requires Organization/Enterprise plan with published team library components.
Analyze code components: Read the source files for components that match suggestions. Understand their props, variants, and structure.
Choose mapping approach:
Simple mappings (no variants/props): Use MCP directly:
send_code_connect_mappings(fileKey, nodeId, mappings: [
{ nodeId: "5:30", componentName: "Button", source: "src/components/Button.tsx", label: "React" }
])
Complex mappings (variants, boolean props, enums): Generate a .figma.tsx file:
import figma from "@figma/code-connect"
import { Button } from "./Button"
figma.connect(Button, "https://figma.com/design/abc123/DS?node-id=5-30", {
props: {
label: figma.string("Label"),
disabled: figma.boolean("Disabled"),
variant: figma.enum("Variant", {
Primary: "primary",
Secondary: "secondary",
Danger: "danger"
}),
icon: figma.instance("Icon")
},
example: (props) => (
<Button variant={props.variant} disabled={props.disabled} icon={props.icon}>
{props.label}
</Button>
)
})
Validate before publishing:
npx figma connect parse --label React
Fix any parse errors before proceeding.
Publish (or dry-run):
# Dry-run first (recommended)
npx figma connect publish --dry-run
# Actual publish
npx figma connect publish
Verify: Call get_code_connect_map(fileKey, nodeId) to confirm the mapping is registered. Future get_design_context calls will now include Code Connect snippets.
Property Mapping Functions
| Function |
Maps |
Example |
figma.string(prop) |
Text properties |
figma.string("Label") |
figma.boolean(prop, map?) |
Toggle properties |
figma.boolean("Disabled") |
figma.enum(prop, map) |
Variant properties |
figma.enum("Size", { Small: "sm", Large: "lg" }) |
figma.instance(prop) |
Instance swap (nested component) |
figma.instance("Icon") |
figma.children(layer) |
Child instances by layer name |
figma.children("Tab") |
figma.textContent(layer) |
Text from child layers |
figma.textContent("Title") |
figma.className(parts) |
Concatenated class names |
figma.className(["btn", figma.enum("Size", {...})]) |
See references/code-connect-cli-reference.md for full API documentation.
Mode 4: Token Extraction
When: User wants to sync Figma design variables to code token files.
Steps
Extract variables:
get_variable_defs(fileKey, nodeId, clientFrameworks, clientLanguages)
Returns: variable name-to-value mappings (e.g., {"color/primary": "#3B82F6", "spacing/md": "16px"}).
Detect project token format:
tailwind.config.{js,ts} exists → Tailwind theme format
tokens/ or src/tokens/ directory with .css → CSS custom properties
style-dictionary.config.json → Style Dictionary format
- None found → ask user or default to CSS custom properties
Map and organize: Group by category (colors, spacing, typography, shadows, etc.) based on Figma variable collection/group naming.
Write token files:
CSS Custom Properties:
:root {
/* Colors */
--color-primary: #3B82F6;
--color-secondary: #64748B;
/* Spacing */
--spacing-sm: 8px;
--spacing-md: 16px;
--spacing-lg: 24px;
}
Tailwind Config:
// Add to tailwind.config.ts theme.extend
colors: {
primary: '#3B82F6',
secondary: '#64748B',
},
spacing: {
sm: '8px',
md: '16px',
lg: '24px',
}
See references/token-format-mappings.md for all supported formats.
Mode 5: Roundtrip
When: Full end-to-end setup — new project or design system migration.
Flow
- Setup (Mode 1): Auth, framework, CLI, config, design system rules
- Token Extraction (Mode 4): Pull Figma variables into project token files
- Design-to-Code (Mode 2): Implement key components from the design system
- Code Connect Publish (Mode 3): Map implemented components back to Figma
- Verify: Call
get_design_context again with the same fileKey/nodeId. When Code Connect mappings are registered, the response includes Code Connect snippet wrappers (typically tagged similar to <CodeConnectSnippet>) containing the component import and usage — look for these as the confirmation signal. If absent, re-run npx figma connect publish and retry.
When to Use
- Greenfield project connecting to an existing Figma design system
- Migrating a design system from another tool to Figma Code Connect
- Auditing and fixing Code Connect coverage across a component library
MCP vs CLI Decision Tree
| Task |
Tool |
Why |
| Read design / generate code |
MCP get_design_context |
MCP returns structured context for LLM |
| Get visual reference |
MCP get_screenshot |
Built-in screenshot capability |
| Check existing mappings |
MCP get_code_connect_map |
Read-only operation |
| Get mapping suggestions |
MCP get_code_connect_suggestions |
AI-powered matching |
| Create simple mappings |
MCP send_code_connect_mappings |
No prop mapping needed |
| Create complex mappings |
Generate .figma.tsx manually + CLI figma connect parse |
Rich prop mapping API |
| Validate before publish |
CLI figma connect parse |
Local validation |
| Publish to Dev Mode |
CLI figma connect publish |
Only way to make snippets visible |
| Dry-run validation |
CLI figma connect publish --dry-run |
Pre-flight check |
| Extract design tokens |
MCP get_variable_defs |
Direct variable access |
| Search design system |
MCP search_design_system |
Cross-library search |
| Generate design rules |
MCP create_design_system_rules |
Convention template |
| CI/CD automation |
CLI in GitHub Actions |
Headless operation |
Error Handling
| Error |
Cause |
Resolution |
whoami fails / no user data |
MCP not authenticated |
Re-authenticate Figma MCP server via client settings (OAuth) |
FIGMA_ACCESS_TOKEN not set |
CLI not authenticated |
Create token at figma.com/developers, set env var |
npx figma connect not found |
CLI not installed |
npm install -D @figma/code-connect |
figma connect parse errors |
Invalid .figma.tsx syntax |
Check Code Connect template syntax, ensure correct imports |
figma connect publish 403 |
Token lacks "Code Connect: Write" scope |
Regenerate token with correct scopes |
get_code_connect_suggestions empty |
No published library components |
Publish components to team library first |
| Rate limit (429) |
Too many MCP calls |
Rate limits vary by plan — check Figma developer documentation for current limits. Batch operations to reduce API calls. |
| Node not found |
Invalid nodeId or file moved |
Verify URL, check if file was renamed or node deleted |
| Branch URL wrong fileKey |
Using fileKey instead of branchKey |
For branch URLs, use branchKey as fileKey (see URL Parsing) |
| Code Connect conflict |
UI and CLI mappings on same node |
Only one connection type per component. Remove one before adding the other. |
1---2name: figma-connect3description: Figma-to-code bridge combining Figma MCP server tools with the Code Connect CLI for end-to-end design implementation workflows. Use this skill when implementing UI components from Figma design URLs, publishing Code Connect mappings to Figma Dev Mode, extracting design tokens from Figma variables, setting up Figma Code Connect in a project, or running the full design-to-code roundtrip pipeline. Activate when the user shares a Figma design URL and wants code implementation, says 'implement from Figma', 'code connect', 'publish to dev mode', 'figma connect publish', 'extract design tokens from Figma', 'figma to code', 'connect components to Figma', 'set up code connect', 'sync figma tokens', 'figma variables to CSS', 'figma variables to Tailwind', 'map component to Figma', 'npx figma connect', or references any figma.com/design URL in a code implementation context. Do NOT activate for pure Figma file creation, FigJam diagrams, Figma plugin development, or Storybook setup — those are separate concerns.4---56# Figma Connect78Bridge between Figma MCP server (reads designs, generates code, extracts tokens) and Code Connect CLI (publishes persistent component mappings to Dev Mode). Use MCP tools for READ operations, CLI for PUBLISH operations.910## Prerequisites & Dual Auth1112This skill requires two independent authentication paths:1314**MCP Auth (OAuth)** — for all `mcp__claude_ai_Figma__*` tools:151. Call `whoami()` to check. If it fails, the user needs to authenticate the Figma MCP server via their MCP client settings (OAuth flow).162. Requires Full or Dev seat on a paid Figma plan.1718**CLI Auth (Token)** — for `npx figma connect publish/parse/create`:191. Check: `[ -n "$FIGMA_ACCESS_TOKEN" ] && echo "Token set" || echo "Token missing"` or `npx figma connect --version`202. If missing: create a personal access token at figma.com/developers with scopes "Code Connect: Write" and "File content: Read"213. Set via: `export FIGMA_ACCESS_TOKEN=<token>` (prefer `.env` with `.gitignore` entry to avoid shell history exposure)2223**Always check both** before workflows that use both (Setup, Publish, Roundtrip). Design-to-Code and Token Extraction only need MCP auth.2425## Framework Detection2627Auto-detect the project framework to set MCP `clientFrameworks` param and CLI Code Connect label:2829| Detection Signal | Framework | Code Connect Label | `clientFrameworks` |30|-----------------|-----------|-------------------|-------------------|31| `package.json` has `react` | React | `React` | `react` |32| `package.json` has `next` | React (Next.js) | `React` | `react,nextjs` |33| `package.json` has `vue` | Vue | `Vue` | `vue` |34| `package.json` has `svelte` | Svelte | `Svelte` | `svelte` |35| `package.json` has `@angular/core` | Angular | `Web Components` | `angular` |36| `Podfile` or `*.xcodeproj` + SwiftUI | SwiftUI | `SwiftUI` | `swiftui` |37| `build.gradle.kts` + Compose | Compose | `Compose` | `compose` |38| `pubspec.yaml` has `flutter` | Flutter | `Flutter` | `flutter` |39| None detected / plain HTML | Web Components | `Web Components` | `html,css` |4041**Precedence**: User-stated framework in the prompt always overrides file detection. When ambiguous (e.g., monorepo with multiple frameworks), ask the user.4243## URL Parsing4445Extract `fileKey` and `nodeId` from Figma URLs before calling MCP tools:4647```48Standard: figma.com/design/:fileKey/:fileName?node-id=:nodeId49 -> fileKey = :fileKey, nodeId = convert "-" to ":" in :nodeId5051Branch: figma.com/design/:fileKey/branch/:branchKey/:fileName52 -> fileKey = :branchKey (NOT :fileKey), nodeId from query param5354Make: figma.com/make/:makeFileKey/:makeFileName55 -> fileKey = :makeFileKey56```5758Always convert `node-id` dashes to colons: `42-156` becomes `42:156`.5960---6162## Mode 1: Setup6364**When**: New project, first-time Code Connect configuration.6566### Steps67681. **Check MCP auth**: Call `whoami()`. If fails, guide OAuth setup and stop.69702. **Check CLI auth**: Run `npx figma connect --version`. If not found, install:71 ```bash72 npm install -D @figma/code-connect73 ```74 Then check `FIGMA_ACCESS_TOKEN` is set.75763. **Detect framework**: Inspect project files (see Framework Detection table above).77784. **Generate config**: Create `figma.config.json` at project root:79 ```json80 {81 "codeConnect": {82 "parser": "react",83 "include": ["src/components/**"],84 "exclude": ["**/*.test.*", "**/*.stories.*"],85 "label": "React"86 }87 }88 ```89 Adjust `parser`, `include`, and `label` based on detected framework.90915. **Generate design system rules** (optional but recommended):92 Call MCP `create_design_system_rules()` with `clientFrameworks` and `clientLanguages`.93 Save the output to a rules file in the project (e.g., `.cursor/rules/figma-design-system.md` or `.claude/rules/`).94956. **Extract initial tokens** (optional):96 If a Figma URL was provided, call `get_variable_defs(fileKey, nodeId)` and write tokens to the project's token file format (see Mode 4).9798### Output99- `@figma/code-connect` installed100- `figma.config.json` created101- Design system rules file saved102- Both auth paths verified103104---105106## Mode 2: Design-to-Code107108**When**: User shares a Figma URL and wants code implementation. (For new projects needing full setup first, run Mode 1 before this.)109110### Steps1111121. **Check MCP auth**: Call `whoami()`. If it fails, guide OAuth setup and stop.1131142. **Parse URL**: Extract `fileKey` and `nodeId` (see URL Parsing section).1151163. **Screenshot** (visual confirmation):117 Call `get_screenshot(fileKey, nodeId)` to see what we're implementing.1181194. **Check existing Code Connect**:120 Call `get_code_connect_map(fileKey, nodeId)` to check whether mappings exist. Note: `get_design_context` independently includes `<CodeConnectSnippet>` wrappers when mappings are present — prioritize these over generated code.1211225. **Get design context**:123 ```124 get_design_context(125 fileKey, nodeId,126 clientFrameworks: "<detected-framework>",127 clientLanguages: "<detected-languages>"128 )129 ```130 Returns: reference code (default React+Tailwind), screenshot, asset download URLs.1311326. **Adapt to project conventions**:133 - Replace hardcoded colors/spacing with project tokens (CSS vars, Tailwind classes)134 - Use existing project components instead of generating duplicates135 - Follow project file naming and directory conventions136 - Import from project's component library, not generated imports137 - If Code Connect snippets were returned, use them as the primary implementation reference1381397. **Download assets**: Use the asset URLs from `get_design_context` response for images, icons, etc.1401418. **Suggest Code Connect** (if not set up):142 If `get_code_connect_map` returned empty, suggest: "Consider setting up Code Connect to improve future design-to-code workflows. Run the Setup mode to get started."143144### MCP Tools Used145- `get_screenshot(fileKey, nodeId)` — visual reference146- `get_code_connect_map(fileKey, nodeId)` — check existing mappings147- `get_design_context(fileKey, nodeId, clientFrameworks, clientLanguages)` — generate code148- `get_variable_defs(fileKey, nodeId)` — extract tokens (optional, if needed for styling)149- `search_design_system(query, fileKey)` — find reusable design system components (optional)150151---152153## Mode 3: Code Connect Publish154155**When**: User wants to map existing code components back to Figma so they appear in Dev Mode.156157### Prerequisites158- Both MCP and CLI auth verified159- `@figma/code-connect` installed160- `figma.config.json` exists (or will be created)161162### Steps1631641. **Get AI suggestions**:165 Call `get_code_connect_suggestions(fileKey, nodeId, clientFrameworks, clientLanguages)`.166 Returns: list of unmapped components with names, properties, thumbnails.167 Requires Organization/Enterprise plan with published team library components.1681692. **Analyze code components**: Read the source files for components that match suggestions. Understand their props, variants, and structure.1701713. **Choose mapping approach**:172173 **Simple mappings** (no variants/props): Use MCP directly:174 ```175 send_code_connect_mappings(fileKey, nodeId, mappings: [176 { nodeId: "5:30", componentName: "Button", source: "src/components/Button.tsx", label: "React" }177 ])178 ```179180 **Complex mappings** (variants, boolean props, enums): Generate a `.figma.tsx` file:181 ```tsx182 import figma from "@figma/code-connect"183 import { Button } from "./Button"184185 figma.connect(Button, "https://figma.com/design/abc123/DS?node-id=5-30", {186 props: {187 label: figma.string("Label"),188 disabled: figma.boolean("Disabled"),189 variant: figma.enum("Variant", {190 Primary: "primary",191 Secondary: "secondary",192 Danger: "danger"193 }),194 icon: figma.instance("Icon")195 },196 example: (props) => (197 <Button variant={props.variant} disabled={props.disabled} icon={props.icon}>198 {props.label}199 </Button>200 )201 })202 ```2032044. **Validate** before publishing:205 ```bash206 npx figma connect parse --label React207 ```208 Fix any parse errors before proceeding.2092105. **Publish** (or dry-run):211 ```bash212 # Dry-run first (recommended)213 npx figma connect publish --dry-run214215 # Actual publish216 npx figma connect publish217 ```2182196. **Verify**: Call `get_code_connect_map(fileKey, nodeId)` to confirm the mapping is registered. Future `get_design_context` calls will now include Code Connect snippets.220221### Property Mapping Functions222| Function | Maps | Example |223|----------|------|---------|224| `figma.string(prop)` | Text properties | `figma.string("Label")` |225| `figma.boolean(prop, map?)` | Toggle properties | `figma.boolean("Disabled")` |226| `figma.enum(prop, map)` | Variant properties | `figma.enum("Size", { Small: "sm", Large: "lg" })` |227| `figma.instance(prop)` | Instance swap (nested component) | `figma.instance("Icon")` |228| `figma.children(layer)` | Child instances by layer name | `figma.children("Tab")` |229| `figma.textContent(layer)` | Text from child layers | `figma.textContent("Title")` |230| `figma.className(parts)` | Concatenated class names | `figma.className(["btn", figma.enum("Size", {...})])` |231232See `references/code-connect-cli-reference.md` for full API documentation.233234---235236## Mode 4: Token Extraction237238**When**: User wants to sync Figma design variables to code token files.239240### Steps2412421. **Extract variables**:243 ```244 get_variable_defs(fileKey, nodeId, clientFrameworks, clientLanguages)245 ```246 Returns: variable name-to-value mappings (e.g., `{"color/primary": "#3B82F6", "spacing/md": "16px"}`).2472482. **Detect project token format**:249 - `tailwind.config.{js,ts}` exists → Tailwind theme format250 - `tokens/` or `src/tokens/` directory with `.css` → CSS custom properties251 - `style-dictionary.config.json` → Style Dictionary format252 - None found → ask user or default to CSS custom properties2532543. **Map and organize**: Group by category (colors, spacing, typography, shadows, etc.) based on Figma variable collection/group naming.2552564. **Write token files**:257258 **CSS Custom Properties**:259 ```css260 :root {261 /* Colors */262 --color-primary: #3B82F6;263 --color-secondary: #64748B;264265 /* Spacing */266 --spacing-sm: 8px;267 --spacing-md: 16px;268 --spacing-lg: 24px;269 }270 ```271272 **Tailwind Config**:273 ```typescript274 // Add to tailwind.config.ts theme.extend275 colors: {276 primary: '#3B82F6',277 secondary: '#64748B',278 },279 spacing: {280 sm: '8px',281 md: '16px',282 lg: '24px',283 }284 ```285286See `references/token-format-mappings.md` for all supported formats.287288---289290## Mode 5: Roundtrip291292**When**: Full end-to-end setup — new project or design system migration.293294### Flow2951. **Setup** (Mode 1): Auth, framework, CLI, config, design system rules2962. **Token Extraction** (Mode 4): Pull Figma variables into project token files2973. **Design-to-Code** (Mode 2): Implement key components from the design system2984. **Code Connect Publish** (Mode 3): Map implemented components back to Figma2995. **Verify**: Call `get_design_context` again with the same fileKey/nodeId. When Code Connect mappings are registered, the response includes Code Connect snippet wrappers (typically tagged similar to `<CodeConnectSnippet>`) containing the component import and usage — look for these as the confirmation signal. If absent, re-run `npx figma connect publish` and retry.300301### When to Use302- Greenfield project connecting to an existing Figma design system303- Migrating a design system from another tool to Figma Code Connect304- Auditing and fixing Code Connect coverage across a component library305306---307308## MCP vs CLI Decision Tree309310| Task | Tool | Why |311|------|------|-----|312| Read design / generate code | MCP `get_design_context` | MCP returns structured context for LLM |313| Get visual reference | MCP `get_screenshot` | Built-in screenshot capability |314| Check existing mappings | MCP `get_code_connect_map` | Read-only operation |315| Get mapping suggestions | MCP `get_code_connect_suggestions` | AI-powered matching |316| Create simple mappings | MCP `send_code_connect_mappings` | No prop mapping needed |317| Create complex mappings | Generate `.figma.tsx` manually + CLI `figma connect parse` | Rich prop mapping API |318| Validate before publish | CLI `figma connect parse` | Local validation |319| Publish to Dev Mode | CLI `figma connect publish` | Only way to make snippets visible |320| Dry-run validation | CLI `figma connect publish --dry-run` | Pre-flight check |321| Extract design tokens | MCP `get_variable_defs` | Direct variable access |322| Search design system | MCP `search_design_system` | Cross-library search |323| Generate design rules | MCP `create_design_system_rules` | Convention template |324| CI/CD automation | CLI in GitHub Actions | Headless operation |325326---327328## Error Handling329330| Error | Cause | Resolution |331|-------|-------|------------|332| `whoami` fails / no user data | MCP not authenticated | Re-authenticate Figma MCP server via client settings (OAuth) |333| `FIGMA_ACCESS_TOKEN` not set | CLI not authenticated | Create token at figma.com/developers, set env var |334| `npx figma connect` not found | CLI not installed | `npm install -D @figma/code-connect` |335| `figma connect parse` errors | Invalid .figma.tsx syntax | Check Code Connect template syntax, ensure correct imports |336| `figma connect publish` 403 | Token lacks "Code Connect: Write" scope | Regenerate token with correct scopes |337| `get_code_connect_suggestions` empty | No published library components | Publish components to team library first |338| Rate limit (429) | Too many MCP calls | Rate limits vary by plan — check Figma developer documentation for current limits. Batch operations to reduce API calls. |339| Node not found | Invalid nodeId or file moved | Verify URL, check if file was renamed or node deleted |340| Branch URL wrong fileKey | Using fileKey instead of branchKey | For branch URLs, use branchKey as fileKey (see URL Parsing) |341| Code Connect conflict | UI and CLI mappings on same node | Only one connection type per component. Remove one before adding the other. |