Skip to content

feat(figma-mcp): add Figma MCP integration - #382

Open
devcustrom wants to merge 4 commits into
zai-org:mainfrom
devcustrom:feat/figma-mcp
Open

devcustrom wants to merge 4 commits into
zai-org:mainfrom
devcustrom:feat/figma-mcp

Conversation

@devcustrom

@devcustrom devcustrom commented Dec 4, 2026 •

Copy link
Copy Markdown

Plugin type (required) / 插件类型(必填)

  • UI Plugin / 是 UI 插件 — provides MCP Apps interactive pages
  • Standard plugin / 普通插件(非 UI) — does not provide MCP Apps interactive pages
  • Not applicable / 不适用 — repository-only changes

Affected plugin name(s) / 涉及的插件名称:figma-mcp

What / 改动内容

Adds external_plugins/figma-mcp, a community plugin that connects ZCode to the Figma MCP server described in Figma's Claude and Figma MCP setup guide.

  • figma-desktop (enabled) — HTTP MCP endpoint served by the Figma desktop app on http://127.0.0.1:3845/mcp, no authorization. Verified against Figma Dev Mode MCP Server 1.0.0: initialize handshake, tools/list (10 tools), get_metadata against an open document.
  • figma-remote (disabled) — Figma's hosted endpoint https://mcp.figma.com/mcp (Government: https://mcp.figma-gov.com/mcp). Figma recommends it and its OAuth metadata is standard, but Figma admits only MCP clients listed in its catalog, and ZCode is not listed: POST https://api.figma.com/v1/oauth/mcp/register returns 403 Forbidden. Without a client registration there is no authorization URL, so a client can never show an authorization prompt. There is no per-user allowlist; a client vendor can join Figma's new-client waitlist or apply through their Figma account team. The plugin ships the entry disabled and documents the exact failure instead of leaving a server that fails on every startup. If Figma adds the client, enabling the entry is enough — no code change.
  • Skill figma-mcp — enabling the desktop server, tool selection, the design-to-code workflow, Code Connect approval flow, motion data, troubleshooting, and rules for treating design text and layer names as untrusted content rather than instructions.
  • Command /figma-setup — probes the endpoint, reports which Figma tools are registered, and gives the exact Figma steps when the server is off.

The plugin bundles no third-party code, writes no files and registers no hooks.

Self-check / 自查清单

  • Plugin name is unique kebab-case; new external plugin directory is external_plugins/figma-mcp/
  • Usage category is developer-tools
  • Plugin type and affected names are declared above
  • version 0.1.2 matches in both plugin.json and marketplace.json
  • README.md (EN) and README_CN.md (中文) both added and equivalent
  • description_i18n has both en and zh-CN, identical in manifest and marketplace entry
  • No secrets, machine-specific paths, or private dependencies
  • Model/API/network dependencies documented
  • python3 scripts/build_dist.py — see the note below

Testing / 测试

  • python3 scripts/validate.py → OK: 59 plugin(s) validated
  • git diff --check → clean
  • Desktop endpoint: initialize returned serverInfo: "Figma Dev Mode MCP Server" 1.0.0, protocol 2025-06-18; tools/list returned the 10 tools documented in the README; get_metadata returned the pages of the open document.
  • Remote endpoint: POST /mcp returns 401 with WWW-Authenticate: Bearer resource_metadata="https://mcp.figma.com/.well-known/oauth-protected-resource",scope="mcp:connect"; the protected-resource document names https://api.figma.com; that server publishes authorization_endpoint, token_endpoint, registration_endpoint, PKCE S256. Registration itself returns 403 Forbidden, reproduced with curl both bare and with browser-like User-Agent/Origin headers.

build_dist.py cannot complete in a fresh source checkout: it aborts on excalidraw with incomplete build; run pnpm build first, because UI plugin dist/ output is not committed. That failure is unrelated to this PR. To verify this plugin's artifact, I invoked build_dist.build_zip directly for external_plugins/figma-mcp: 6 files, 13724 bytes, sha256 af01bfb65c2658dc2984d4bb3523fa40a2fd8f9110aa6cd1fbac6d3681188d40. With the UI build in place, the full build should pass.

Dependencies, network, side effects / 依赖、网络与副作用

  • Requires the Figma desktop app (latest), a design file open in Dev Mode, and a Dev or Full seat on a Professional, Education, Organization, Government, or Enterprise plan.
  • Network — loopback only: HTTP to http://127.0.0.1:3845/mcp on the user's machine, no credentials. The disabled remote entry points at Figma's HTTPS endpoint and is documented as blocked by Figma's registration policy.
  • Writes — add_code_connect_map and send_code_connect_mappings write Code Connect data into the Figma file; the skill requires showing suggestions and getting user approval first. Everything else is read-only.
  • Licensing — no third-party code or assets are bundled; the plugin is contributed under the repository's Apache-2.0 license.

Add external_plugins/figma-mcp: an HTTP MCP declaration for the Figma
desktop Dev Mode server at http://127.0.0.1:3845/mcp, plus the Figma-hosted
remote endpoint shipped disabled because it needs an OAuth sign-in that the
ZCode MCP configuration cannot complete.

The plugin ships a skill for the design-to-code workflow (design context,
metadata, variables, screenshots, motion, Code Connect, FigJam), the
prompt-injection rules for design content, and a /figma-setup diagnostic
command. Tools are documented from Figma Dev Mode MCP Server 1.0.0.

Requirements (documented in both READMEs): the Figma desktop app, Dev Mode,
and a Dev or Full seat on a paid plan. No bundled third-party code; the only
network request is loopback to the Figma app.
ZCode implements MCP OAuth for plugin servers: Settings -> MCP shows
"Authorization required" with an "Open authorization" action, and the
client performs discovery, dynamic client registration, PKCE S256 and
token refresh. The previous revision claimed the client could not
complete OAuth and shipped the remote server disabled, so users never
saw an authorization prompt.

- Enable figma-remote (https://mcp.figma.com/mcp) by default and finish
  the one-time authorization in Settings -> MCP.
- Disable figma-desktop by default: it is loopback and needs no
  authorization, but requires the desktop app and a paid Dev/Full seat,
  and running both duplicates every Figma tool.
- Rewrite the skill and both READMEs around the authorization flow,
  token storage in ZCode, revocation handling, and the desktop fallback.
- Bump to 0.1.1.
@panda920

panda920 commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

✅ Internal validation passed. A ZCode maintainer will review the change next; after acceptance, release checks run separately and this PR is closed automatically.

Figma's remote MCP endpoint advertises standard OAuth metadata, and ZCode
implements the MCP OAuth flow, but Figma's dynamic client registration
endpoint returns 403 Forbidden for clients it does not recognise, so no
authorization URL is ever produced and the app cannot offer a prompt.
Reproduced with curl, bare and with browser-like headers.

- Enable figma-desktop by default again: loopback, no authorization.
- Keep figma-remote disabled and document the exact 403 failure and the
  condition under which it can be enabled (Figma opening registration).
- READMEs explain the remote flow and why it cannot complete today.
- Bump to 0.1.2.
@panda920

panda920 commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

✅ Internal validation passed. A ZCode maintainer will review the change next; after acceptance, release checks run separately and this PR is closed automatically.

@panda920

panda920 commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

✅ Internal validation passed. A ZCode maintainer will review the change next; after acceptance, release checks run separately and this PR is closed automatically.

Figma admits MCP clients from its catalog, not individual users. Add the
catalog and new-client waitlist links to the skill and both READMEs so the
403 on registration is actionable instead of looking like a broken plugin.
@panda920

panda920 commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

✅ Internal validation passed. A ZCode maintainer will review the change next; after acceptance, release checks run separately and this PR is closed automatically.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants