Brilliant Design

v0.1.11
design.brilliant/mcp Checked 2 days ago Published 15 days ago

Design canvas for coding agents: real editable vectors, auto layout, components, export to code.

No-config local MCP bridge for brilliant.design. Your coding agent drives your live Brilliant web tab (or the desktop app) with near-zero setup. Everything runs on 127.0.0.1 - zero bytes of MCP or design data touch Brilliant's servers. stdio is the universal denominator, so the same package serves every MCP client (Claude Code, Codex, Gemini, Cursor, VS Code, Windsurf, Zed, Claude Desktop, …). install merges into the tool's config without clobbering foreign servers, preserves JSONC comments, and is comment-/byte-stable on remove.

Summary extracted from the README.

@brilliant-hq/mcp

No-config local MCP bridge for brilliant.design. Your coding agent drives your live Brilliant web tab (or the desktop app) with near-zero setup. Everything runs on 127.0.0.1 - zero bytes of MCP or design data touch Brilliant's servers.

Setup (once per machine, ever)

claude mcp add brilliant -- npx -y @brilliant-hq/mcp

stdio is the universal denominator, so the same package serves every MCP client (Claude Code, Codex, Gemini, Cursor, VS Code, Windsurf, Zed, Claude Desktop, …).

How it works

  • The helper is a dumb router: MCP JSON-RPC crosses it verbatim; MCP semantics live in the Brilliant tab (or desktop app), never here.
  • The first instance becomes the leader (owns one tab socket, one permission grant, one binding table); every other MCP client's helper is a follower that forwards over loopback /rpc. Leadership reassigns when the leader exits.
  • No tab connected yet? Your first tool call opens brilliant.design and pairs via a URL fragment - discovery and pairing in one step.
  • The Brilliant desktop app is detected on 127.0.0.1:3333/3334/3335 and covered by the same entry.

Full wire contract: PROTOCOL.md.

CLI

npx @brilliant-hq/mcp                          # run the stdio MCP server (default)
npx @brilliant-hq/mcp --version
npx @brilliant-hq/mcp install <client>         # add the server to <client>'s MCP config
npx @brilliant-hq/mcp install <client> --dry-run   # preview the change, write nothing
npx @brilliant-hq/mcp install <client> --remove    # remove it (exact inverse)

install merges into the tool's config without clobbering foreign servers, preserves JSONC comments, and is comment-/byte-stable on remove. Supported <client>: claude-code, cursor, vscode, codex, gemini, antigravity, windsurf, zed, opencode, claude-desktop. Per-client facts come from clients.json (the one shared table this package ships).

Security

  • Every listener binds the 127.0.0.1 literal - never 0.0.0.0, never a scan of private ranges.
  • The tab socket validates Origin: https://brilliant.design, a loopback Host (anti-DNS-rebinding), and a pairing token or an approved association.
  • The pairing token is never served from any local endpoint; leader.json is mode 0600; the tab never reads it.

Requires Node ≥ 20.

Development

npm install
npm test        # node --test

Real-tab battery

battery/real_tab_pairing.mjs proves the production pairing lane end to end with no stub on either side: this repo's helper over stdio + a real Chrome tab on the served https://brilliant.design, signed in as the locked qa-e2e identity. It runs p1 fragment pairing, p2 a project tab re-pairing over 127.0.0.1:3363-3365 with no fragment, p3 a reload, p4 a leader restart re-pairing with no reload, and p5 a fresh unpaired profile that must dial nothing.

  • Opt-in: BRILLIANT_REAL_TAB_BATTERY=1 node battery/real_tab_pairing.mjs [--headed] [--out <json>] (Windows: scripts/windows/test/real_tab_pairing_battery.ps1). It lives outside test/, so npm test stays hermetic.
  • Prerequisites, each refused by name: real Chrome (BRILLIANT_CHROME_EXE), nothing listening on 3333-3335 or 3363-3365 (a foreign leader is never touched), npm ci here, the qa-e2e session (BRILLIANT_QA_STATE, else minted through scripts/lib/qa_web_session.mjs).
  • Chrome 147+ gates loopback per site; the cell writes the Allow a user would give, the content setting profile.content_settings.exceptions.loopback_network for https://brilliant.design:443, into its fresh profile.
  • Exit codes: 0 every assertion passed, 1 any FAIL, 2 NOT MEASURED (a named missing prerequisite; never 0). Output is one PASS|FAIL pN <what> <number> line per assertion.
  • The summary JSON lands in qa-inbox/real_tab_pairing-<stamp>.json (or --out), with the log dir (tab console, WebSocket events, helper stderr) beside it as <summary>-logs/.