pholly-figma-mcp

pholly-figma-mcp

Local-first MCP bridge for live Figma documents, enabling design inspection, editing, asset export, component authoring, and variable management through a plugin and WebSocket server without consuming Figma REST API requests.

Category
访问服务器

README

pholly-figma-mcp

Local-first MCP bridge for live Figma documents. It uses a Figma plugin and a local WebSocket server, so document inspection and edits do not consume Figma REST API requests.

See CHANGELOG.md for release history.

Status

Usable MVP (v0.1.1): MCP stdio transport, live plugin bridge, multi-file routing, document/style/variable inspection, common node editing, image creation, component/instance authoring, variable creation/binding, batch edits, and declarative tree rendering are included. The bridge is locked down with per-machine token authentication, origin/host validation, and plugin registration protection.

Build and run

npm install
npm run build
npm run setup          # creates ./pholly-figma-plugin with the bridge token baked in

Import pholly-figma-plugin/manifest.json into Figma through Plugins → Development → Import plugin from manifest, then run it in a design file. The setup step is required: it stamps the machine's bridge token into the plugin, and the bridge rejects untrusted plugins. If the token ever changes (token file deleted or PHOLLY_TOKEN env overridden), re-run setup and re-import the manifest in Figma.

{
  "pholly-figma": {
    "type": "local",
    "command": [
      "node",
      "/absolute/path/to/pholly-figma-mcp/apps/server/dist/index.js"
    ],
    "enabled": true
  }
}

For clients that use command/args (e.g. codex-style config), the equivalent is:

{
  "pholly-figma": {
    "command": "node",
    "args": ["/absolute/path/to/pholly-figma-mcp/apps/server/dist/index.js"]
  }
}

Your MCP client starts the server automatically. For bridge-only debugging you may run npm start; do not also launch a second manual copy unless you are testing follower behavior. The bridge stays on localhost:1995. Check it with curl http://localhost:1995/ping (the other endpoints require the bearer token).

Architecture

MCP client ──stdio──> Node server ──WebSocket──> Figma plugin ──> Figma Plugin API

The project is organized as independently licensed packages under the MIT License. See CONTRIBUTING.md for how to get involved and SECURITY.md for vulnerability reporting.

Notable tools

  • inspect_selection is the primary design-to-code tool. It returns a detailed textual UI specification and an optional native screenshot, so it works with both vision and non-vision agents.
  • export_selection_assets extracts exact raster fills and vector/icon candidates into a safe project-relative directory (default public/figma-assets/) without overwriting different existing files.
  • render_design creates or reconciles a nested design tree. Give nodes stable key values and use mode: "reconcile" for repeatable updates.
  • create_component, create_instance, set_instance_properties, swap_instance_component, and detach_instance cover the common component workflow.
  • create_variable_collection, create_variable, set_variable_values, and bind_variable support local design tokens.
  • batch runs safe, non-destructive operations sequentially. delete_nodes remains confirmation-gated.
  • validate_design checks a tree before rendering it; commitUndo: true on render_design creates a single undo checkpoint.
  • Editing: set_gradient_fill (linear/radial/angular/diamond), set_effects (shadows and blurs), set_stroke_properties (weight, alignment, dash, caps, joins), set_node_visibility, and set_solid_fill (hex or rgba).
  • Search: find_nodes and find_text match by substring or /regex/, optionally filtered by type and page.
  • Session: get_path, undo, redo, get_changes, and clear_changes keep agents oriented and auditable.
  • Export and analysis: save_screenshots writes explicit node lists to public/figma-screenshots/, and extract_design_tokens summarizes a page's typography, colors, radii, spacing, and opacities.

First-use checklist

  1. Run npm install && npm run build && npm run setup.
  2. Import pholly-figma-plugin/manifest.json into Figma.
  3. Run the plugin in every file the agent should access.
  4. Restart the MCP client after adding the configuration.
  5. Ask the agent to call list_files; pass the returned fileKey for multi-file work.

The plugin must be running in Figma's Design editor for write operations. Dev Mode is intentionally read-only.

Security

The bridge is local-first and locked down by default:

  • The HTTP server and WebSocket bridge bind to 127.0.0.1 only.
  • A per-machine bearer token guards /files, /rpc, /mcp, and plugin registration. The token lives at $XDG_CONFIG_HOME/pholly-figma-mcp/token (mode 0600) and can be overridden with the PHOLLY_TOKEN environment variable. The setup command stamps it into the plugin's code.js and ui.html and assigns a unique per-machine plugin ID; plugins without a valid token are rejected and closed.
  • HTTP requests with a non-local Host header are refused (blocks DNS-rebinding attacks), and WebSocket upgrades from non-local Origins are rejected (blocks cross-site WebSocket hijacking from malicious web pages).
  • A connected file key can only be claimed by the plugin that currently owns it; a live registration is never overwritten by another connection.

Troubleshooting

  • Plugin loops between "Connecting…" and "Disconnected · retrying": the plugin in Figma is stale (Figma caches imports under the plugin ID). Delete the plugin entry under Plugins → Development, re-run setup, and re-import the generated pholly-figma-plugin/manifest.json.
  • list_files returns []: the plugin is not connected. Make sure it is running in a design file and the status chip shows "Connected".
  • Bridge rejects with "Invalid bridge token": the imported plugin was stamped for a different token. Re-run setup on the same machine the bridge runs on, then re-import.

Packaging

The server package is named @mubizzu/pholly-figma-mcp. npm run pack produces mubizzu-pholly-figma-mcp-0.1.1.tgz containing:

  • dist/ — the compiled MCP server with the pholly-figma-mcp binary
  • plugin/ — the bundled Figma plugin (code.js, ui.html, manifest.json)

The setup subcommand copies the bundled plugin into a project, stamps the machine bridge token into it, and prints the Figma import path:

pholly-figma-mcp setup [target-dir]   # default target: ./pholly-figma-plugin

Once published, users would configure it in their MCP client exactly like any npx server:

{
  "pholly-figma": {
    "type": "local",
    "command": ["npx", "-y", "@mubizzu/pholly-figma-mcp"],
    "enabled": true
  }
}

The bridge remains local-first: the plugin in Figma connects to ws://localhost:1995/ws on the same machine. Multiple MCP clients on one machine share the bridge; later starters automatically become followers that proxy to the leader.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选