Figma Context MCP
Give your coding agent access to your Figma data. Implement designs in any framework in one-shot.
คำอธิบายจากผู้ทำ (ภาษาอังกฤษตามต้นฉบับ)
Figma to pixel-verified code: HTML/React/Tailwind + tokens, then a render + pixel-diff verify loop.
สามเรื่องนี้ไม่รวมเป็นคะแนนเดียว เพราะความเห็น การวัด และความนิยม เป็นคนละเรื่องกัน
ตัวนี้ยังไม่ได้เรียบเรียงเป็นภาษาไทย ด้านล่างคือข้อเท็จจริงที่เราอ่านจาก registry
เลือกโปรแกรม AI ที่คุณใช้ แล้วคัดลอกค่าตั้งไปวาง
FIGMA_TOKEN, FIGMA_MCP_CACHE_DIRค่าที่ติดป้ายความลับคือกุญแจของบัญชีคุณ อย่าส่งให้ใคร และอย่าวางในแชต
ต้องเตรียมก่อน
คุณใช้แอปไหน
เลือกแอปด้านบน เราจำไว้ให้ ครั้งหน้าปุ่มจะขึ้นว่า “ติดตั้งลง …”
เปิด Claude Desktop → Settings → Developer → Edit Config แล้ววางค่านี้ในไฟล์ claude_desktop_config.json
{
"mcpServers": {
"figma-codekit": {
"command": "npx",
"args": [
"-y",
"figma-codekit-mcp"
],
"env": {
"FIGMA_TOKEN": "ใส่ค่าของคุณ",
"FIGMA_MCP_CACHE_DIR": "ใส่ค่าของคุณ"
}
}
}
}พิมพ์คำสั่งนี้ใน Terminal
claude mcp add figma-codekit --env FIGMA_TOKEN='ใส่ค่าของคุณ' --env FIGMA_MCP_CACHE_DIR='ใส่ค่าของคุณ' -- npx -y figma-codekit-mcpเติมค่าที่เว้นว่างไว้ก่อนรัน
วางในไฟล์ .cursor/mcp.json ของโปรเจกต์ หรือ ~/.cursor/mcp.json
{
"mcpServers": {
"figma-codekit": {
"command": "npx",
"args": [
"-y",
"figma-codekit-mcp"
],
"env": {
"FIGMA_TOKEN": "ใส่ค่าของคุณ",
"FIGMA_MCP_CACHE_DIR": "ใส่ค่าของคุณ"
}
}
}
}เบราว์เซอร์จะถามก่อนเปิดแอป จากนั้นแอปแสดงค่าตั้งให้ตรวจแล้วกดยืนยัน ช่อง key เว้นว่างไว้ให้คุณใส่เอง
วางในไฟล์ .vscode/mcp.json ของโปรเจกต์
{
"servers": {
"figma-codekit": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"figma-codekit-mcp"
],
"env": {
"FIGMA_TOKEN": "ใส่ค่าของคุณ",
"FIGMA_MCP_CACHE_DIR": "ใส่ค่าของคุณ"
}
}
}
}เบราว์เซอร์จะถามก่อนเปิดแอป จากนั้นแอปแสดงค่าตั้งให้ตรวจแล้วกดยืนยัน ช่อง key เว้นว่างไว้ให้คุณใส่เอง
ตัวนี้รันในเครื่องคุณ แต่ ChatGPT ต่อได้เฉพาะ server บนอินเทอร์เน็ต ลองเลือกแอปอื่น
ตัวเลือกเก็บในคุกกี้บนเครื่องนี้ ไม่ต้องมีบัญชี
FIGMA_MCP_CACHE_DIR envค่าตั้งนี้สร้างจากข้อมูลใน registry ของผู้ทำ ถ้าไม่ตรงกับ README ให้เชื่อ README
รันในเครื่องคุณ รายการเครื่องมือจะขึ้นในแอป AI หลังติดตั้ง
เราตรวจจากข้อมูลที่ใครก็เปิดดูได้ ยังไม่ได้อ่านโค้ด ข้อที่ไม่เกี่ยวกับตัวนี้ไม่นับในตัวหาร · ตรวจเมื่อ 7 พ.ย. 2569
ชื่อใน registry ยืนยันด้วยบัญชี GitHub Mehmoodqureshi ซึ่งเป็นเจ้าของ repo
ยังไม่ได้อ่านข้อมูล repo จาก GitHub
ยังไม่ได้อ่านข้อมูล repo จาก GitHub
ตัวนี้รันบนเครื่องคุณ ไม่มี endpoint บนอินเทอร์เน็ต
ตัวนี้รันบนเครื่อง ใช้ค่าที่ตั้งในเครื่องแทน
รันในเครื่องคุณ เราอ่านรายการเครื่องมือได้เฉพาะตัวที่มี endpoint บนอินเทอร์เน็ต
เทียบกับทุก server ที่ยังใช้งานในหมวดนี้ทั้งทะเบียน ดาวนับเฉพาะเมื่อผู้ลงทะเบียนเป็นเจ้าของ repo
จากการตรวจเบื้องต้นของเรา ผ่าน 1 จาก 1 ข้อที่ตรวจได้ เรายังไม่ได้อ่านโค้ด ก่อนใส่กุญแจหรือ token ให้ดูว่า server ขอสิทธิ์อะไร และเลือกกุญแจที่ทำได้เท่าที่จำเป็น
ต้องใส่ค่าเหล่านี้: FIGMA_TOKEN
รันบนเครื่องของคุณ โปรแกรม AI จะเปิด server ขึ้นมาเองเมื่อใช้ ข้อมูลไม่ต้องผ่านเซิร์ฟเวอร์ของผู้ทำ (ยกเว้นตัวที่ไปเรียกบริการออนไลน์ต่อ)
repo บน GitHub มีการแก้โค้ดล่าสุด – และส่งรุ่นล่าสุด (0.3.0) เข้า registry เมื่อวานซืน
โปรแกรมที่รองรับ MCP เช่น Claude Desktop, Claude Code, Cursor และ VS Code ตัวนี้ต้องมี Node.js ในเครื่องด้วย
ในหมวดเดียวกันมี Figma Context MCP, Claude Real Video, Figma MCP Server
server หมวดเดียวกันจากผู้ทำคนอื่น เรียงตามดาว
อ่านการ์ด:★ ดาว GitHubiสามเสา: รีวิว · ผลตรวจ · การใช้งานiอัปเดต = วันที่ส่งรุ่นล่าสุดเข้า registryi
Give your coding agent access to your Figma data. Implement designs in any framework in one-shot.
Let any LLM watch a video locally — and search everything it has ever watched.
server ทางการของ Figma ส่งข้อมูลงานออกแบบให้ AI อ่าน เพื่อเปลี่ยนแบบเป็นโค้ดหรืออธิบายแบบได้ตรงขึ้น ต่อผ่านคลาวด์ของ Figma
ส่วนนี้คัดจาก repo ของผู้ทำตามต้นฉบับ PopNx MCP ไม่ได้ตรวจหรือรับรองเนื้อหา ตัด HTML รูปภาพ และสคริปต์ออกแล้ว ลิงก์จะพาออกนอกเว็บ
Figma → code that is actually checked against the design. The pixel-diff verifier for Figma-to-code: it renders the output and diffs it against the frame until it converges — and it can verify *your own running app* the same way, so it works alongside Figma's official MCP server or Framelink rather than replacing them.
Most Figma-to-code tools stop at the moment of generation: they hand you JSX and walk away. Nobody ever renders the output and compares it to the frame, so the result stalls at "90% there" and you spend the afternoon nudging padding by eye.
This MCP server closes that loop. It converts a frame to self-contained HTML deterministically (no LLM, no hallucinated layout), then renders your code in Chromium, pixel-diffs it against the Figma reference, measures every element's box, and tells the agent exactly what is missing or misplaced. The agent edits, calls verify again, and repeats until the diff is at the anti-aliasing floor.
Figma reference First pass — 5.18% off Pixel diff Converged — 0.00%
Those are real artifacts from npm run example, which runs the loop end to end with no API key. The generate callback in that demo is a *scripted* stand-in for an LLM, so it shows the loop mechanics honestly — the measuring is real, the "model" is not.
A Figma node tree tells you what the designer *declared*. It does not tell you what a browser will *do* with your CSS. Those diverge constantly — a flex gap that collapses, a font that falls back, an absolute child that escapes its parent. The only way to know is to render it and look.
figma_verify gives the agent three independent signals per pass:
data-ir-id, measured in the live DOM, and matched against its Figma box. This is what turns "the bottom-left looks off" into "the CTA button is missing" or "the price label is 40px too low".elementsFromPoint over a sample grid gives the rendered order wherever two elements actually overlap. This catches the class of bug the other two signals are blind to by construction: elements present, in exactly the right box, stacked the wrong way round — or cut off by an ancestor's overflow where the design lets them overhang. Neither moves a box, and on a tall frame neither moves the diff ratio much, but a decorative overlay drawn over a photo instead of under it is the first thing a person sees. Reported as WRONG STACKING / OVER-CLIPPED, and reported even when the pixel diff has converged.| Tool | What it does | Network |
|---|---|---|
figma_convert | Fetch a frame → HTML + ir.json + images as files in assets/ (or data URIs with inlineAssets: true) + reference.png + design tokens (tokens.json in W3C DTCG format, tokens.css, a Tailwind v4 tailwind.theme.css). Optional react: true (component + the components/ it imports), next: true (a runnable App Router project) and tailwind: true (React/Next.js output as Tailwind classes), plus a responsive variant. | Figma API (cached) |
figma_verify | Render HTML in Chromium, pixel-diff vs the reference, IoU-check every element, check paint order and clipping, return targeted fix instructions. Pass url (and optionally selector) to verify a running page instead — your own app at http://localhost:3000, in any framework — against the frame. | none (or your dev server) |
figma_inspect | Print the IR as an indented outline (role, box, layout, text, tokens), filterable — read the structure without dumping raw Figma JSON into context. | none |
responsive: true reads Figma's sizing intent — FILL becomes flex/100%, HUG becomes fit-content, FIXED keeps its px. That only exists where the designer used Auto Layout.
A frame with no Auto Layout on the root is a canvas: every child is position:absolute at a coordinate on a 1440px artboard. There is nothing to relax, so making the root width:100% does not reflow it — the children stay pinned at their canvas coordinates and the right-hand side disappears under overflow:hidden. That reads exactly like a page breaking when you zoom.
For those frames the converter keeps the exact canvas and scales it to the viewport instead, so the design stays intact at every width and zoom level (down to 0.5x, after which the page scrolls). figma_convert tells you which strategy it used. If you want real reflow rather than proportional scaling, add Auto Layout in Figma — that is the signal the converter needs.
Every tool returns file paths and numbers, never large blobs. A converted frame is often 100+ KB of HTML; pushing that through a tool result would burn the agent's context for nothing. The agent reads and edits the files directly.
Figma responses are cached per frame, so after the first figma_convert the whole loop runs offline and free — including when you are rate-limited.
You need a Figma personal access token: Figma → Settings → Security → Personal access tokens, scope File content: read.
export FIGMA_TOKEN=figd_REPLACE_WITH_YOUR_TOKEN
Add it to Claude Code:
claude mcp add figma --env FIGMA_TOKEN=$FIGMA_TOKEN -- npx -y figma-codekit-mcp@latest
Or for any MCP host that reads a JSON config:
{
"mcpServers": { "figma": { "command": "npx", "args": ["-y", "figma-codekit-mcp@latest"], "env": { "FIGMA_TOKEN": "figd_REPLACE_WITH_YOUR_TOKEN" } } } }
Then, in the agent: copy a frame link out of Figma (right-click the frame → Copy link to selection) and say *"convert this frame and verify it until it converges."*
FIGMA_TOKEN=$FIGMA_TOKEN npx -y figma-codekit-mcp@latest --check
It checks Node, whether a token was found (and where, never its value), whether Figma accepts it, and whether the Chromium figma_verify renders in is installed, then prints READY or what to fix. Exit code 0 means all three tools will work. If Chromium is missing (a skipped download, or CI), install it with npx -y figma-codekit-mcp@latest --install-browser.
npx resolves to npx.cmd, which some MCP hosts cannot spawn directly. If the server fails to start, point at the shim explicitly:
{
"command": "cmd", "args": ["/c", "npx", "-y", "figma-codekit-mcp@latest"] }
figma_convert → generated.html, reference.png, ir.json (deterministic, no LLM)
↓ figma_verify → "NOT CONVERGED — 4.93% of pixels differ. Elements: 22/26 match — 1 missing, 3 misplaced. MISSING: button 'Get started' MISPLACED: h1 'Pricing plan' — 6px too high" ↓ agent edits generated.html ↓ figma_verify → "CONVERGED — 0.31% of pixels differ (threshold 2.00%)."
The refine loop runs through the calling agent, not through an LLM inside the server. That means no ANTHROPIC_API_KEY, no second model billing, and the agent keeps full context on what it already tried. A headless refine loop (src/refine/) still exists for library use.
The same pipeline has a one-page local web front end, split in two: a chat on the left, the generated app on the right. You send a frame link, it asks what to build — HTML, React or Next.js; exact or responsive — and then converts, renders and diffs in front of you. The right pane carries the running app, its source files, the verify numbers and the pixel diff.
npm run site # http://localhost:5173
It uses the same .figma-token and the same .figma-cache/, so a frame you have already converted re-runs offline in about a second. Useful for checking a frame converts cleanly before pointing an agent at it — and for showing someone what "verified against the design" means rather than describing it. Details in site/README.md.
| Variable | Purpose |
|---|---|
FIGMA_TOKEN | Required. Also read from a .figma-token file in your project directory. FIGMA_API_KEY is accepted as an alias. |
FIGMA_MCP_CACHE_DIR | Where converted frames are cached. Defaults to .figma-cache/ in the directory the server is started from. |
ANTHROPIC_API_KEY / GEMINI_API_KEY | Optional, headless refine loop only. The MCP server never calls an LLM. |
FIGMA_MCP_SKIP_BROWSER_DOWNLOAD=1 | Skip the Chromium download on install. figma_convert and figma_inspect still work; figma_verify will not. |
See .env.example. Add .figma-cache/ to your project's .gitignore — a cached frame keeps the original bitmaps and can be tens of megabytes.
FIGMA_FILE_TIMEOUT_MS (default 90000) caps how long figma_convert waits for Figma's whole-file download, which it falls back to when the per-node endpoint is rate-limited. When Figma will not answer, the tool says so within that time and, if the frame is already cached anywhere, builds from the cached copy and marks the result STALE CACHE instead of hanging.
figma_convert url=<frame link> → .figma-cache/<frame>/ (reference.png)
figma_verify dir= url=http://localhost:3000/pricing selector="#plans"
Build the page however you like — Figma's official MCP server, Framelink, by hand — then point figma_verify at it. It screenshots the page (or just the selected element) at the frame's size and pixel-diffs it against Figma. Element-box and layering checks need the converter's data-ir-id markers, so for a URL only the pixel diff runs.
Being straight about the edges, because they are Figma's, not bugs:
tokens.json / tokens.css / tailwind.theme.css, but names them after the value (--color-c8960c) because it cannot know intent. Rename them in your theme.figma_convert tells you when the limit lifts.threshold defaults to 2% for that reason — chasing 0 is chasing rendering noise.The verify loop is framework-agnostic and does not need the MCP layer:
import { verifyLoop } from 'figma-codekit-mcp';
import fs from 'node:fs';
const result = await verifyLoop(
ตัดมาแค่ช่วงต้น อ่านต่อใน repo