8. `ud mcp`

ud mcp is a stdio MCP server named ui-designer (SRS CMD-7).

Esta página está em inglês; a tradução está a caminho.

text
ud mcp [--file f] [--read-only] [--allow use_figma,get_*] [--proposal pp-…] [--as name] [--port-range a-b]
ud mcp install [--scope workspace|user]

ud mcp is a stdio MCP server named ui-designer (SRS CMD-7). ud mcp install adds it to .mcp.json of the workspace:

json
{ "mcpServers": { "ui-designer": { "command": "ud", "args": ["mcp"] } } }

It serves:

Kind Items
Tools The supported tools of section 3 with Figma’s names and schemas, and the native tools ud_run ({ command, params, fileKey }), ud_apply, ud_help, ud_tree (0.1), ud_render (0.2), ud_system (0.4), ud_lint (0.6).
Prompts create_design_system_rules: writes a rules file that maps the file’s design system to the workspace’s code conventions.
Resources ud://system/<fileKey> (design-system digest), ud://plugin-api/coverage, ud://plugin-api/typings, skill://ui-designer/<skill>/SKILL.md and their references (AI-001 §3).

In Claude Code the tools appear as mcp__ui-designer__use_figma and so on. Skills that name tools by their Figma names find them. When the Figma MCP server is also connected, both serve tools of the same names. The ui-designer skill tells the agent to use ui-designer for .design files and figma for figma.com files.

--file is the default fileKey; with it, fileKey becomes optional in every served schema (section 3, D8). --read-only serves only reading tools. --allow is an allowlist: only the named tools and registry commands (globs allowed, get_*) are served and every other call is refused with usage; the AI panel starts ud mcp with the allowlist of AI-001 §6, so the tool list is the boundary the panel relies on. --proposal routes every write to that proposal of the live editor (AI-001 §6.5). --as sets the signing actor (section 2.4). Every request runs through the same code as the command line, with the same live-editor behaviour, licence checks (section 2.5) and signing. Errors are tool results with isError: true whose text starts with the error code.

8.1 What --proposal refuses#

A proposal is meant to change nothing but the document until the user accepts it (review decision D4). Two flags on every registry command make that checkable; ud commands --json and ud help show them, and the registry test of SRS CMD-17 keeps them complete:

Flag Set on commands that
writesFiles write anywhere outside the .design file and its .assets/ folder: export.* with an output path, codegen.*, token export, document.new, import.html with a capture, …
network fetch from or send to a URL: asset.add with a URL, import.figma, import.html with a URL, createImageAsync(url), …

Under ud mcp --proposal:

  • every command flagged writesFiles or network is refused, whether it is called as a tool, through ud_run or ud_apply, or from a use_figma script (ud.run and the Plugin API members that map to it). The tools that are flagged whole are create_new_file, generate_figma_design and upload_assets without local paths;
  • every URL input is refused: paths entries that are URLs, createImageAsync with http(s):, ud import URLs. Local files inside the workspace stay allowed;
  • the refusal is exit code 2, code usage, sub-code not_allowed_in_proposal (section 9), and its message names the flag that caused it. Nothing of the call is applied.

--allow and --proposal are independent: the panel passes both, an external agent that installed with ud mcp install --proposal auto gets the second only.