
Mokido
io.github.kolganovr由 GitHub 帳號 kolganovr 發布v4.4.0更新於 Oct 29, 2026
Write to a live Figma canvas, get a screenshot back, and roll back mistakes. Zero deps, free plan.
概覽
Mokido 是一個本機 MCP 伺服器,讓 AI 助理讀寫正在開啟的 Figma 畫布、取回截圖自我檢查,並復原自己的改動。
- 可以做什麼
- 在 Figma 沙箱中執行任意 JavaScript,建立與修改節點,可選擇自動取景截圖與自動檢查警告
- 以節省 token 的形式讀取即時文件、一次檢視多個節點、對節點或選取範圍截圖、搜尋元件
- 插入元件實例與原始 SVG,讀取變數並切換變數模式,檢查畫布版面以尋找空位
- 透過檢查點復原先前的寫入,等待長時間執行的背景工作,列出已連線的 Figma 文件
- 設定 Figma 個人存取權杖後,可讀取雲端檔案與節點、算圖、列出樣式與元件、讀取與張貼留言
- 適用情境
- 適合由助理親自做設計、而不只是把現有設計轉成程式碼的情境:在開啟的 Figma 檔案中建立或修改畫框,再透過截圖確認成果並復原錯誤。也適合使用 Figma 免費方案、希望不必付費席位或呼叫配額就能寫入的使用者。
- 執行需求
- 以 stdio 在本機執行,只需 Node.js(npx mokido,或複製儲存庫後執行 node install.mjs),沒有 npm 相依套件。需要 Figma 桌面版,匯入安裝程式提供的外掛清單並啟動外掛,透過本機 8765 埠的 WebSocket 連線。即時畫布工具不需要權杖;7 個雲端 REST 工具需要在安裝時提供 Figma 個人存取權杖。僅在可選的每日更新檢查時使用網路。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Mokido,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
⚡ Mokido
MCP server for Figma design. Let an AI agent design in Figma — and actually see what it drew.
Formerly figma-mcp-bridge (@kolganovr/figma-mcp-bridge on npm). Old links redirect here.
A zero-dependency MCP server that gives coding agents read and write access to a live Figma canvas, then closes the loop by handing the rendered PNG back to the model for visual self-critique.
[License: MIT] [MCP] [Node.js] [Dependencies] [Tools] [Works on]
[Claude Code builds a sign-up screen in Figma from a design system through Mokido]
One prompt, two screens: the agent reads your design system, builds them live in the file you have open, checks its own screenshot and fixes the layout. 56 seconds of real time, sped up.
The problem
Coding agents are effectively blind inside Figma. Most Figma MCP servers are read-only —
they flatten a design into text so a model can turn it into code, and the traffic stops there.
The ones that can write are either gated behind a paid Figma seat with a monthly tool-call
quota, or expose a fixed vocabulary of commands (create_rectangle, set_fill) that runs out
the moment the task gets specific.
And none of them answer the question that actually matters after a write: did it look right?
An agent that draws a card, gets back {"ok": true}, and moves on has no way to notice that its
text overflowed, its contrast failed, or its frame landed on top of someone else's work.
This bridge closes that loop, and adds the safety rails an autonomous agent needs to be trusted with a real design file.
How it's different
The short version: Framelink is the best choice if you only want to turn an existing design into code. The official server is the safest choice if you're already on a paid Figma plan and want Code Connect. This bridge is for the case where the agent is doing the designing — where it needs to write freely, check its own work, and be undoable when it gets it wrong.
How it works
The agent speaks plain MCP over stdio. The server owns a hand-rolled RFC 6455 WebSocket on
:8765, which the Figma plugin connects to — so commands reach the canvas with no polling
latency, and results (including multi-megabyte base64 PNGs) stream straight back.
Quickstart
Or, to read the installer before it touches your machine — it's the same script either way, just fetched differently:
Both copy the server and plugin into place and register the MCP server in every AI client config
they find — Claude Desktop, Claude Code, Cursor, Windsurf, Antigravity. The npm package exists
purely for a shorter first command; it doesn't add a single runtime dependency — dependencies
is empty in its package.json too, and no Python is needed either. node is the only runtime
this project ever needs, for the installer and the server alike.
Then, in Figma Desktop:
- Plugins → Development → Import plugin from manifest… → pick
~/.mokido/mcp/figma-plugin/manifest.json(the installer prints the full path; the repo's ownfigma-plugin/has no bridge token) - Press
Ctrl + Alt + P(macOS:Cmd + Option + P) to launch Mokido - Status turns green —
CONNECTED
Restart your AI client so it picks up the new tools. Verify anytime with:
Optional: Figma Cloud REST access
The live canvas tools need no token. If you also want to read unopened cloud files
(get_file, get_node, get_styles, …), supply a personal access token:
Without a token these 7 tools aren't registered at all — see Tool reference.
Updating
Updating is the same installer run again. It overwrites the copy in ~/.mokido/mcp, keeps your bridge
token and client configs, and removes copies left by older versions.
Keep @latest: a bare npx mokido can reuse the version npx cached last time. From a clone:
Then reopen the plugin in Figma (Ctrl + Alt + P) and restart your AI client. A server that was already
running keeps the old code in memory, and the plugin shows "Update needed" until it restarts.
You don't have to watch for releases: once a day the server checks npm and prints a one-line notice to your client's MCP log when a newer version is out (see the update check). What changed in each version is in CHANGELOG.md.
Agents updating it for you follow the same steps in AGENTS.md.
What it gives the agent
1. Write freely, then look at the result
capture: true returns a PNG of exactly what the call just created or modified — auto-framed
to the changed nodes, never the whole page, and never by hijacking the user's selection.
The warnings array is a cheap auto-lint over the touched subtree — text overflow, low contrast,
zero-size nodes. It catches the obvious mistakes without spending a screenshot round trip.
2. Undo anything the agent did
Every write opens a checkpoint automatically. One call reverses it — no Ctrl+Z rolling back over
the human's own unrelated work.
Created nodes are tracked automatically via a Proxy around figma.create*(). Property edits are
tracked when snapshotted. Deletions are honestly reported as unrecoverable rather than silently lost.
3. Read the live canvas for ~700 tokens instead of ~5,000
The same pruning + Pseudo-JSX pipeline that powers the cloud tools, pointed at whatever is open right now. Measured on a realistic 6-card layout: 20 KB of raw API JSON → 2.7 KB (86% smaller).
budget_tokens caps the response: if the requested depth overshoots, the server re-serializes the
already-fetched tree shallower — no second round trip — and appends a comment saying what it did
and which id to fetch for more.
4. Teach the sandbox new tricks that survive restarts
Every figma_execute_code call is a fresh function scope, so helpers normally die instantly.
bridge.define compiles and stores a module inside the .fig document:
5. Long jobs that don't die at the timeout
A generation still running after 45s hands back a job_id instead of failing while the plugin
keeps working. figma_job_status then blocks until the job finishes (up to wait_ms, 45s by
default) — one call, not a polling loop. Progress from progress(step, of, note) is included while
it runs; a job silent for 2 minutes is flagged stalled, and one whose plugin disconnected fails
at once with PLUGIN_DISCONNECTED instead of running out the clock. A call that times out behind a
still-running job says so (PLUGIN_BUSY, naming the job) instead of inviting a blind retry.
6. Built for the token bill
In an agent loop a tool call is paid for twice: once when it returns, and again on every later turn, because its output stays in the context that each turn re-reads. So the bridge optimizes for fewer turns and smaller residue:
Every default is overridable per call, and per install through env: FIGMA_MCP_SCALE,
FIGMA_MCP_MAX_PX, FIGMA_MCP_MAX_IMAGES, FIGMA_MCP_MAX_OUTPUT_BYTES, FIGMA_MCP_MAX_OUTPUT_CEILING (0 = no ceiling), FIGMA_MCP_JOB_WAIT_MS,
FIGMA_MCP_ESCALATE_MS, FIGMA_MCP_RECONNECT_GRACE_MS.
What's new
4.4.0: a new plugin window with the Moki companion (12 states, compact square/bar view, settings with versions,
dark theme, English/Russian); every client now shares one install folder, ~/.mokido/mcp, and a server exits with
its session, so a stale one no longer holds port 8765; figma_inspect reads property definitions of component
sets, lists all texts of a frame (props: ["texts"]) and names the page when find has no match.
Re-import the plugin once from ~/.mokido/mcp/figma-plugin/manifest.json. History: CHANGELOG.md.
4.2.7: compare / like diffs end with a REF line of exact reference values, so the agent fixes copies
without an extra props read; find returns the subtree of what it found; view: "flow" works without
node_ids; bridge.setText keeps mixed fonts. On the internal bench (Gemini Flash, seeded tasks) model turns
per series went 112 -> 83 and verify turns after a write 11 -> 1. Reload the Figma plugin after updating.
History: CHANGELOG.md.
Tool reference
Tools are served in tiers, so the schema list sent to the model on every turn stays proportional to what's actually usable:
Without a REST token an agent sees 13 tools instead of 23 — and never wastes a call on
something that would only return REST_TOKEN_MISSING.
All 23 tools
Core — live canvas
Extended — live canvas
REST — Figma Cloud (needs a token)
Legacy — opt-in via FIGMA_MCP_LEGACY_TOOLS=1
figma_create_ui_card · get_me · get_image_fills
Engineering notes
The parts that were harder than they look — and why the code is shaped the way it is.
`eval` is a trap in the Figma sandbox
The obvious way to persist helpers between calls is "stash the source, eval it next time." It
fails silently: eval is a bound function in Figma's sandbox, which by spec makes every call
an indirect eval — declarations inside it reach neither the caller's scope nor globalThis.
Nothing is defined, nothing throws.
bridge.define is built on new Function instead, whose bodies are ordinary function scopes.
The runtime's bridge.info() reports this contract to the agent on request, so it can ask instead
of guessing.
A hand-rolled RFC 6455 WebSocket, on purpose
Zero npm dependencies isn't a vanity metric here — it means git clone && node install.mjs works
on a locked-down machine with no registry access, and there's no supply chain to audit for something
that executes arbitrary JS inside your design files.
The cost is owning the framing: masking, fragmented continuation frames (a 4 MB screenshot arrives split, and treating each fragment as a whole message silently dropped it until the tool call timed out 40s later), ping/pong liveness, and a 64 MB ceiling so one frame can't exhaust memory.
Chunking `pluginData` by UTF-8 bytes, not string length
Figma caps pluginData entries at roughly 100 KB — measured in bytes. The original chunker
sliced by JS string length, so a module written in Cyrillic (~2 bytes/char) produced "60,000-char"
chunks that were really 120 KB, and setPluginData threw. The splitter now walks the real UTF-8
budget and never tears a surrogate pair.
Port ownership has to be reclaimable
Every agent spawns its own copy of the server; the first to bind :8765 owns the plugin socket and
the rest proxy to it. When the owner exits, a proxy has to be able to take over — otherwise every
surviving agent stays permanently broken until restarted. A 5-second watchdog retries the bind, and
a failed proxy call triggers an immediate takeover attempt.
Making placement O(neighbours) instead of O(n)
The original collision engine rescanned every top-level node for each of up to 200 candidate positions, then did it again in a second function in the same tick — and only ever stepped along one axis, so 20 generated screens became a mile-long ribbon nobody could zoom out to see.
Bounds are now computed once and shared; collisions go through a 500px grid hash; and layout:"grid"
shelf-packs into a compact rectangle.
Errors that tell the agent what to do instead
Raw Plugin API errors are famously unhelpful. Failures are matched against known modes and rewritten
with a HINT: line naming the API that actually works, plus a stable machine-readable code
(FONT_NOT_LOADED, INSTANCE_TRANSFORM_LOCKED, STALE_NODE_ID, AUTOLAYOUT_HUG_RESIZE,
AMBIGUOUS_TARGET, …) so agents and tooling can branch on the failure type without parsing prose.
Security: this endpoint runs arbitrary JS in your design file
:8765 is loopback, but loopback is reachable by any web page the user happens to have open.
Two independent gates: an Origin allowlist (a browser cannot forge Origin, so a page on
evil.com is rejected at the handshake) and a shared token that install.mjs generates and bakes
into both the MCP config and the installed plugin — which also covers the sandboxed-iframe case,
where a hostile page can present Origin: "null" too.
Running straight from a clone with no token, the Origin gate still applies and the server prints a warning, so it degrades rather than silently opening up.
The one network call this server makes on its own: an update check
On startup an installed server (the copy install.mjs wrote, marked by a version.json beside the
code) compares its own version with the latest mokido release on npm via one registry request,
and prints a one-line notice to stderr if a newer release is out. It compares releases, not commits,
so it works the same for npx and clone installs and stays quiet about unreleased work on main.
It never applies anything itself — updating is still a manual, deliberate step.
This is the one thing in this project that assumes network access, so it's built to disappear
cleanly when there isn't any: the check is fired without being awaited (never delays initialize
or the first tool call), a failed/slow/offline request is caught and silently skipped, and results
are cached for 24h so it doesn't hit the registry on every launch or run once per spawned
copy of the server. Set FIGMA_MCP_NO_UPDATE_CHECK=1 to turn it off entirely — worth doing on the
locked-down machines the previous note is about.
Testing
Seven dependency-free suites, all runnable with bare node:
mcp-protocol.test.js spawns the actual server as a child process and speaks NDJSON to it — the
same transport a real MCP client uses — rather than importing internals.
Repository layout
Sources
- Seat and quota requirements for the official server — Figma: Guide to the Figma MCP server, Figma Developer Docs: Rate limits & access
- Token reduction measured on a 6-card layout fixture that mimics real REST output: 20,587 B raw → 2,862 B Pseudo-JSX (86.1%) / 1,912 B tree (90.7%). The fixture is checked in and asserted — run
node tests/optimizer.test.jsto reproduce the exact figures.
Comparison reflects publicly documented behaviour as of August 2026. Alternatives are actively developed — verify current capabilities before making a decision on this table alone.
License
MIT · Built by Roman Kolganov
來源:README.md,提交 da0370b
工具
0版本歷史
2- v4.4.0最新Oct 29, 2026
- v4.3.0Oct 24, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分