Sandbox
@tercumantanumut/sunnysideFigma-Context-MCP

Figma MCP server and plugin for agent codegen

This repo connects Figma to MCP clients so an agent can inspect the current selection, pull design tokens, and generate code. It supports two paths: a Figma plugin bridge for highest-fidelity extraction and the Figma REST API for headless access.

40 stars7 forksTypeScriptUpdated 5mo ago
Who it's for

Builders who want to turn Figma frames into code and design-system data with an MCP client.

What it delivers

You can move from a Figma selection to usable code and token data without retyping design details.

What it does

Plugin bridge extraction

Uses a Figma companion plugin to send selected-layer data to the MCP server with native `getCSSAsync()` fidelity.

Code generation tools

Generates React, Tailwind, and styled-components output from the latest Figma extraction.

Design token lifecycle

Extracts tokens, builds dependency graphs, simulates token changes, and produces migration code.

Figma REST API access

Reads file and node data, project structure, component info, and image exports from the Figma API.

Dev Mode bridge

Connects to Figma's official Dev Mode MCP server for additional code output when enabled.

How to get it

  1. 1Requirements: Node 18+, a Figma Personal Access Token (create one here).
    git clone https://github.com/tercumantanumut/sunnysideFigma-Context-MCP
    cd sunnysideFigma-Context-MCP
    npm install
    npm run build
  2. 2Run the HTTP/SSE server
    npm start
    # → http://localhost:3333
    #   SSE:              /sse
    #   Streamable HTTP:  /mcp

README

MseeP.ai Security Assessment Badge

Sunnyside Figma MCP

A Model Context Protocol (MCP) server that turns Figma designs into production code. It ships with a companion Figma plugin so LLM clients can read the layer you're actually looking at, extract pixel-perfect CSS and design tokens, and generate React / Tailwind / styled-components output — all from a natural-language prompt.

Two data paths are supported:

  • Plugin bridge — highest fidelity. Uses Figma's native getCSSAsync() from inside the editor. Works on any plan, even Drafts.
  • Figma REST API — works headless from a fileKey / nodeId for designs that live in a team/project you can reach with a Personal Access Token.

Quick Start

Requirements: Node 18+, a Figma Personal Access Token (create one here).

git clone https://github.com/tercumantanumut/sunnysideFigma-Context-MCP
cd sunnysideFigma-Context-MCP
npm install
npm run build

Create a .env:

FIGMA_API_KEY=figd_your_token_here
PORT=3333
OUTPUT_FORMAT=json

Run the HTTP/SSE server:

npm start
# → http://localhost:3333
#   SSE:              /sse
#   Streamable HTTP:  /mcp

Install the Figma plugin (one time):

  1. Open Figma Desktop → Plugins → Development → Import plugin from manifest…
  2. Pick figma-dev-plugin/manifest.json from this repo.
  3. Run the plugin on any file. Select a frame → click Extract Dev Code.

You'll see "Data sent to MCP server successfully" when the bridge is live.


Connect an MCP Client

Pick one transport. Both expose the same 27 tools against the same running server.

stdio (client spawns the process)

Use this if you want the client to own the lifecycle and don't need the Figma plugin bridge to share state with the MCP process.

{
  "mcpServers": {
    "sunnyside-figma": {
      "type": "stdio",
      "command": "node",
      "args": [
        "/absolute/path/to/sunnysideFigma-Context-MCP/dist/cli.js",
        "--stdio"
      ],
      "env": {
        "FIGMA_API_KEY": "figd_your_token_here"
      }
    }
  }
}

SSE (recommended when using the Figma plugin)

The plugin posts extractions to http://localhost:3333/plugin/*. Point your MCP client at the same process so both share the extraction buffer.

{
  "mcpServers": {
    "sunnyside-figma": {
      "type": "sse",
      "url": "http://localhost:3333/sse"
    }
  }
}

Streamable HTTP

{
  "mcpServers": {
    "sunnyside-figma": {
      "type": "http",
      "url": "http://localhost:3333/mcp"
    }
  }
}

Tool Reference (27 tools)

Plugin-bridge tools — use these first

These read the buffer filled by the Figma plugin. Fastest, highest fidelity, no API limits.

ToolReturns
get_figma_dev_historyList of past extractions (name, id, layout)
get_Basic_CSSRoot element CSS via getCSSAsync()
get_All_Layers_CSSCSS for every layer in the selection
get_JSONStructured: id, fills, variables, design tokens, allLayersCSSthe highest-signal single call
get_react_componentTypeScript React + CSS module
get_tailwind_componentReact + Tailwind classes (arbitrary values)
get_styled_componentReact + styled-components
get_plugin_project_overviewSummary of the full scanned project (requires Scan Entire Project in the plugin)
analyze_app_structureArchitectural breakdown of a scanned project

Figma REST API tools

Require FIGMA_API_KEY + a file the token can see. Do not work on Drafts — move files to a team/project first.

ToolUse
get_figma_dataRaw file or node JSON
get_figma_page_structurePage-level tree for orientation
get_figma_project_overviewTeam/project-level summary
analyze_figma_componentsComponent detection across a file
download_figma_imagesBatch SVG/PNG export to disk

Design token lifecycle

Token registry + what-if simulation for design-system changes.

ToolUse
extract_design_tokensBuild a token catalog from current selection
build_dependency_graphMap which layers consume which tokens
debug_token_registryInspect the current registry state
track_design_system_healthCoverage / conflict report
simulate_token_changeDry-run a rename/value change
analyze_token_change_impactBlast-radius report for a proposed change
apply_token_changeCommit a simulated change
rollback_token_changeRevert an applied change
list_token_simulationsList staged simulations
generate_migration_codeProduce codemod-style output for the change

Figma Dev Mode (official) — Professional plan only

Bridges to Figma's official Dev Mode MCP Server on localhost:3845. Requires a Figma Professional plan with Dev Mode enabled in the desktop app.

ToolUse
check_figma_dev_connectionProbe the Dev Mode server
get_figma_dev_mode_codeReact + Tailwind from Figma's own generator

Utility

ToolUse
generate_codegen_pluginScaffold a new Figma Dev Mode codegen plugin

Typical Workflows

Generate a component from a selection

  1. In Figma, select the frame.
  2. In the plugin, click Extract Dev Code.
  3. Ask your agent: "Generate a React + Tailwind component from the latest extraction." → calls get_tailwind_component.

Audit a design system

  1. Click Scan Entire Project in the plugin.
  2. Ask: "Summarize this project's design tokens and flag conflicts." → calls get_plugin_project_overview + extract_design_tokens + track_design_system_health.

Propose a token change safely

  1. simulate_token_changeanalyze_token_change_impact → review.
  2. apply_token_change if safe, rollback_token_change to undo.
  3. generate_migration_code to produce the code migration.

Headless export

  • Give your agent a Figma URL (Copy link to selection). It parses fileKey + nodeId and calls get_figma_data / download_figma_images.

Architecture

┌───────────────────┐     POST /plugin/*     ┌──────────────────────┐
│  Figma Plugin     │ ─────────────────────▶ │                      │
│  (figma-dev-plugin)                        │  HTTP server :3333   │
└───────────────────┘                        │  ├─ /sse   (MCP SSE) │
                                             │  ├─ /mcp   (MCP HTTP)│
┌───────────────────┐   MCP (SSE / HTTP /    │  └─ extraction cache │
│  MCP client       │   stdio)               │                      │
│  (Claude, Selene, │ ◀──────────────────────│                      │
│   Cursor, etc.)   │                        └──────────────────────┘
└───────────────────┘                                   │
                                                        │ optional
                                                        ▼
                                            ┌──────────────────────┐
                                            │  Figma REST API      │
                                            │  Figma Dev Mode :3845│
                                            └──────────────────────┘
  • The HTTP server and MCP endpoints live in the same Node process, so the plugin's extraction buffer and the MCP tools share memory. That's why SSE is the recommended transport when the plugin is in play.
  • stdio mode spawns a fresh process per client — it won't see plugin extractions from a separate running server. Use SSE/HTTP if you need that shared state.

Troubleshooting

"No extracted data available" — re-open the plugin and click Extract Dev Code. If the client is stdio, switch to SSE so it shares state with the plugin server.

Figma REST tools time out / 404 — the file is likely in Drafts. Move it to a team/project, or use the plugin path.

check_figma_dev_connection fails — requires Figma Professional + Dev Mode MCP Server enabled in Figma Desktop (Preferences → Enable local MCP Server). Free plan users should stick to the plugin tools.

Server won't start on :3333 — another process is bound. Change PORT in .env and update your MCP client URL accordingly.

Session errors hitting /mcp directly with curl — the Streamable HTTP transport requires initializing a session (initializenotifications/initialized) before tools/list. MCP clients handle this automatically.


Development

npm run dev          # tsup watch build
npm run dev:cli      # stdio dev loop
npm run type-check   # tsc --noEmit
npm run lint
npm test             # jest
npm run inspect      # open @modelcontextprotocol/inspector

Project layout:

src/
├─ cli.ts                    # entrypoint (HTTP + stdio)
├─ mcp.ts                    # tool registration
├─ server.ts                 # Express + MCP transport wiring
├─ tools/
│  ├─ plugin-tools.ts        # plugin-bridge tools
│  ├─ figma-codegen-tools.ts # React / Tailwind / styled-components
│  ├─ figma-dev-tools.ts     # official Dev Mode bridge
│  ├─ design-system-tools.ts # token lifecycle
│  └─ figma-api-tools.ts     # REST API
└─ services/
   └─ plugin-integration.ts  # /plugin/* endpoints + extraction cache

figma-dev-plugin/            # companion Figma plugin (manifest + UI + code)

Contributing

PRs welcome. Run npm run lint && npm test && npm run build before opening. Keep the tool surface lean — if you add a new tool, audit for overlap with an existing one.

License

See LICENSE. Built on concepts from Framelink MCP but substantially different; proprietary with specific terms. Commercial inquiries: Umut TAN — tercumantanumut@gmail.com.

Files in the repo

Repository payload22 top-level entries
  • docs
  • figma-dev-plugin
  • src
  • temp-images
  • .eslintrc
  • .gitignore
  • .nvmrc
  • .prettierrc
  • CHANGELOG.md
  • CLAUDE.md
  • CONTRIBUTING.md
  • DESIGN_SYSTEM_EVOLUTION_TRACKER.md
  • FIGMA_MCP_QUICK_PROMPT.md
  • FIGMA_MCP_SYSTEM_PROMPT.md
  • jest.config.js
  • LICENSE
  • package.json
  • pnpm-lock.yaml
  • README.md
  • tool-testing-report.md
  • tsconfig.json
  • tsup.config.ts

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More connectors

High-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph — average repo in milliseconds. 158 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.

43k

Universal provider proxy for OpenAI Codex & Claude Code — use any LLM (Claude, Gemini, Grok, DeepSeek, Ollama…) with Codex CLI, App, SDK, and Claude Code

14k
okf-memory/
okf-agent-memory

Git-native persistent memory for AI coding agents. Implements Google OKF v0.2 with sub-300µs in-memory BM25 search, embedded MCP server, and progressive disclosure. Slashes token bloat by 80% with zero external databases or dependencies. Built in pure Go.

547
tirth8205/
code-review-graph

Local-first code intelligence graph for MCP and CLI. Builds a persistent map of your codebase so AI coding tools read only what matters, with benchmarked context reductions on reviews and large-repo workflows.

31k
2akouwu/
reverify

Stop your AI from making things up — it proposes, deterministic tools decide, every claim checked against ground truth with evidence. Grounded facts and context survive resets. Reverse engineering is the proving ground. MCP server + CLI.

1.1k
t8y2/dbxConnectors

20 MB lightweight cross-platform database client for 90+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 90+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP Server。

19k