figma-console-mcp 1.28.0 → 1.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/README.md +17 -9
  2. package/dist/cloudflare/core/config.js +0 -8
  3. package/dist/cloudflare/core/console-monitor.js +3 -3
  4. package/dist/cloudflare/core/design-system-tools.js +1 -1
  5. package/dist/cloudflare/core/diagnose-tool.js +96 -0
  6. package/dist/cloudflare/core/figma-api.js +19 -0
  7. package/dist/cloudflare/core/figma-tools.js +69 -229
  8. package/dist/cloudflare/core/identity.js +96 -0
  9. package/dist/cloudflare/core/library-tools.js +580 -0
  10. package/dist/cloudflare/core/tokens/alias-resolver.js +135 -0
  11. package/dist/cloudflare/core/tokens/config.js +284 -0
  12. package/dist/cloudflare/core/tokens/figma-converter.js +195 -0
  13. package/dist/cloudflare/core/tokens/formatters/css-vars.js +329 -0
  14. package/dist/cloudflare/core/tokens/formatters/dtcg.js +300 -0
  15. package/dist/cloudflare/core/tokens/formatters/index.js +45 -0
  16. package/dist/cloudflare/core/tokens/formatters/json.js +187 -0
  17. package/dist/cloudflare/core/tokens/formatters/less.js +4 -0
  18. package/dist/cloudflare/core/tokens/formatters/scss.js +252 -0
  19. package/dist/cloudflare/core/tokens/formatters/stubs.js +13 -0
  20. package/dist/cloudflare/core/tokens/formatters/style-dictionary-v3.js +207 -0
  21. package/dist/cloudflare/core/tokens/formatters/tailwind-v3.js +237 -0
  22. package/dist/cloudflare/core/tokens/formatters/tailwind-v4.js +330 -0
  23. package/dist/cloudflare/core/tokens/formatters/tokens-studio.js +250 -0
  24. package/dist/cloudflare/core/tokens/formatters/ts-module.js +198 -0
  25. package/dist/cloudflare/core/tokens/index.js +15 -0
  26. package/dist/cloudflare/core/tokens/parsers/css-vars.js +4 -0
  27. package/dist/cloudflare/core/tokens/parsers/dtcg.js +253 -0
  28. package/dist/cloudflare/core/tokens/parsers/index.js +138 -0
  29. package/dist/cloudflare/core/tokens/parsers/json.js +7 -0
  30. package/dist/cloudflare/core/tokens/parsers/scss.js +4 -0
  31. package/dist/cloudflare/core/tokens/parsers/stubs.js +20 -0
  32. package/dist/cloudflare/core/tokens/parsers/style-dictionary-v3.js +4 -0
  33. package/dist/cloudflare/core/tokens/parsers/tailwind-v3.js +4 -0
  34. package/dist/cloudflare/core/tokens/parsers/tailwind-v4.js +4 -0
  35. package/dist/cloudflare/core/tokens/parsers/tokens-studio.js +4 -0
  36. package/dist/cloudflare/core/tokens/schemas.js +148 -0
  37. package/dist/cloudflare/core/tokens/transforms/color.js +12 -0
  38. package/dist/cloudflare/core/tokens/transforms/index.js +29 -0
  39. package/dist/cloudflare/core/tokens/transforms/size.js +7 -0
  40. package/dist/cloudflare/core/tokens/types.js +18 -0
  41. package/dist/cloudflare/core/tokens-tools.js +859 -0
  42. package/dist/cloudflare/core/version-tools.js +151 -7
  43. package/dist/cloudflare/core/websocket-server.js +77 -55
  44. package/dist/cloudflare/index.js +45 -26
  45. package/dist/core/design-system-tools.d.ts +50 -0
  46. package/dist/core/design-system-tools.d.ts.map +1 -1
  47. package/dist/core/design-system-tools.js +1 -1
  48. package/dist/core/design-system-tools.js.map +1 -1
  49. package/dist/core/figma-api.d.ts +15 -0
  50. package/dist/core/figma-api.d.ts.map +1 -1
  51. package/dist/core/figma-api.js +19 -0
  52. package/dist/core/figma-api.js.map +1 -1
  53. package/dist/core/library-tools.d.ts +17 -0
  54. package/dist/core/library-tools.d.ts.map +1 -0
  55. package/dist/core/library-tools.js +581 -0
  56. package/dist/core/library-tools.js.map +1 -0
  57. package/dist/core/tokens/alias-resolver.d.ts +15 -0
  58. package/dist/core/tokens/alias-resolver.d.ts.map +1 -1
  59. package/dist/core/tokens/alias-resolver.js +37 -0
  60. package/dist/core/tokens/alias-resolver.js.map +1 -1
  61. package/dist/core/tokens/formatters/json.d.ts.map +1 -1
  62. package/dist/core/tokens/formatters/json.js +30 -21
  63. package/dist/core/tokens/formatters/json.js.map +1 -1
  64. package/dist/core/tokens/formatters/stubs.d.ts +3 -3
  65. package/dist/core/tokens/formatters/stubs.d.ts.map +1 -1
  66. package/dist/core/tokens/formatters/stubs.js +6 -4
  67. package/dist/core/tokens/formatters/stubs.js.map +1 -1
  68. package/dist/core/tokens/formatters/tailwind-v3.d.ts.map +1 -1
  69. package/dist/core/tokens/formatters/tailwind-v3.js +37 -23
  70. package/dist/core/tokens/formatters/tailwind-v3.js.map +1 -1
  71. package/dist/core/tokens/formatters/tailwind-v4.js +31 -15
  72. package/dist/core/tokens/formatters/tailwind-v4.js.map +1 -1
  73. package/dist/core/tokens/formatters/ts-module.d.ts.map +1 -1
  74. package/dist/core/tokens/formatters/ts-module.js +23 -16
  75. package/dist/core/tokens/formatters/ts-module.js.map +1 -1
  76. package/dist/core/tokens/index.d.ts +1 -1
  77. package/dist/core/tokens/index.d.ts.map +1 -1
  78. package/dist/core/tokens/index.js +1 -1
  79. package/dist/core/tokens/index.js.map +1 -1
  80. package/dist/core/tokens/parsers/stubs.d.ts +9 -5
  81. package/dist/core/tokens/parsers/stubs.d.ts.map +1 -1
  82. package/dist/core/tokens/parsers/stubs.js +13 -6
  83. package/dist/core/tokens/parsers/stubs.js.map +1 -1
  84. package/dist/core/tokens-tools.js +1 -1
  85. package/dist/local.d.ts.map +1 -1
  86. package/dist/local.js +6 -0
  87. package/dist/local.js.map +1 -1
  88. package/figma-desktop-bridge/code.js +1 -1
  89. package/package.json +1 -1
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **Your design system as an API.** Model Context Protocol server that bridges design and development—giving AI assistants complete access to Figma for **extraction**, **creation**, **debugging**, and **bidirectional token sync**.
10
10
 
11
- > **🆕 Token Sync Full Formatter Coverage (v1.28.0):** `figma_export_tokens` now ships **10 fully-implemented output formats**: DTCG JSON (canonical), CSS custom properties, Tailwind v4 `@theme inline`, Tailwind v3 config, SCSS, TypeScript module, JSON (flat + nested), Style Dictionary v3, and Tokens Studio multi-file. Pull Figma variables and emit code in whatever styling flavor your project uses no Style Dictionary or Tokens Studio install required. Diff-aware merge for round-trip; one Figma API call per changed value, not full rewrites. 103 tools total. [See what's new →](CHANGELOG.md#1280---2026-05-18)
11
+ > **🆕 Shared Library Inspection (v1.29.0):** Three new tools fill the gap between "I see a component key in search results" and "I can actually use it." `figma_get_library_component_by_key` resolves any component key to full property definitions + variant keys + visual specs without needing the source library file's URL. `figma_get_library_variables` lists every variable from your subscribed libraries (no Enterprise plan required uses the Plugin API path that works on Pro and Org). `figma_import_library_variable` brings a library token into the current file so it can be bound to nodes alongside the file's own variables. Works on every Figma plan. 106 tools total. [See what's new →](CHANGELOG.md#1290---2026-05-22)
12
12
 
13
13
  ## What is this?
14
14
 
@@ -55,9 +55,9 @@ Figma Console MCP connects AI assistants (like Claude) to Figma, enabling:
55
55
  | Real-time monitoring (console, selection) | ✅ | ❌ | ❌ |
56
56
  | Desktop Bridge plugin | ✅ | ✅ | ❌ |
57
57
  | Requires Node.js | Yes | **No** | No |
58
- | **Total tools available** | **103** | **95** | **9** |
58
+ | **Total tools available** | **106** | **95** | **9** |
59
59
 
60
- > **Bottom line:** Remote SSE is **read-only** with ~38% of the tools. **Cloud Mode** unlocks write access from web AI clients without Node.js. NPX/Local Git gives the full 103 tools with real-time monitoring.
60
+ > **Bottom line:** Remote SSE is **read-only** with ~38% of the tools. **Cloud Mode** unlocks write access from web AI clients without Node.js. NPX/Local Git gives the full 106 tools with real-time monitoring.
61
61
 
62
62
  ---
63
63
 
@@ -65,7 +65,7 @@ Figma Console MCP connects AI assistants (like Claude) to Figma, enabling:
65
65
 
66
66
  **Best for:** Designers who want full AI-assisted design capabilities.
67
67
 
68
- **What you get:** All 103 tools including design creation, variable management, and component instantiation.
68
+ **What you get:** All 106 tools including design creation, variable management, and component instantiation.
69
69
 
70
70
  #### Prerequisites
71
71
 
@@ -162,7 +162,7 @@ Create a simple frame with a blue background
162
162
 
163
163
  **Best for:** Developers who want to modify source code or contribute to the project.
164
164
 
165
- **What you get:** Same 103 tools as NPX, plus full source code access.
165
+ **What you get:** Same 106 tools as NPX, plus full source code access.
166
166
 
167
167
  #### Quick Setup
168
168
 
@@ -308,7 +308,7 @@ AI Client → Cloud MCP Server → Durable Object Relay → Desktop Bridge Plugi
308
308
  | Feature | NPX (Recommended) | Cloud Mode | Local Git | Remote SSE |
309
309
  |---------|-------------------|------------|-----------|------------|
310
310
  | **Setup time** | ~10 minutes | ~5 minutes | ~15 minutes | ~2 minutes |
311
- | **Total tools** | **103** | **95** | **103** | **9** (read-only) |
311
+ | **Total tools** | **106** | **95** | **106** | **9** (read-only) |
312
312
  | **Design creation** | ✅ | ✅ | ✅ | ❌ |
313
313
  | **Variable management** | ✅ | ✅ | ✅ | ❌ |
314
314
  | **Component instantiation** | ✅ | ✅ | ✅ | ❌ |
@@ -323,7 +323,7 @@ AI Client → Cloud MCP Server → Durable Object Relay → Desktop Bridge Plugi
323
323
  | **Automatic updates** | ✅ (`@latest`) | ✅ | Manual (`git pull`) | ✅ |
324
324
  | **Source code access** | ❌ | ❌ | ✅ | ❌ |
325
325
 
326
- > **Key insight:** Remote SSE is read-only. Cloud Mode adds write access for web AI clients without Node.js. NPX/Local Git give the full 103 tools.
326
+ > **Key insight:** Remote SSE is read-only. Cloud Mode adds write access for web AI clients without Node.js. NPX/Local Git give the full 106 tools.
327
327
 
328
328
  **📖 [Complete Feature Comparison](docs/mode-comparison.md)**
329
329
 
@@ -401,6 +401,12 @@ When you first use design system tools:
401
401
  - `figma_get_file_data` - Full file structure
402
402
  - `figma_get_file_for_plugin` - Optimized file data
403
403
 
404
+ ### 📚 Shared Library Inspection
405
+ - `figma_get_library_component_by_key` - **Resolve any component key to full properties + variants + visual specs** — without needing the source library file's URL. Works for both COMPONENT_SET and standalone COMPONENT keys. Adaptive compression at >500KB.
406
+ - `figma_get_library_components` - Discover all components in a library file (requires library file URL/key)
407
+ - `figma_get_library_variables` - List every variable from team libraries the current file has subscribed. **Works on every Figma plan** — uses the Plugin API path, not the Enterprise-only REST endpoint. Filter by `libraryName`, `collectionName`, or `resolvedType`.
408
+ - `figma_import_library_variable` - Import a library variable into the current file. Returns a local `id` ready to pass to `figma_set_fills` / `figma_update_variable` / any variable-binding tool.
409
+
404
410
  ### ☁️ Cloud Relay
405
411
  - `figma_pair_plugin` - Generate a pairing code to connect a Desktop Bridge plugin via the cloud relay
406
412
 
@@ -663,7 +669,7 @@ The **Figma Desktop Bridge** plugin is the recommended way to connect Figma to t
663
669
  - The MCP server communicates via **WebSocket** through the Desktop Bridge plugin
664
670
  - The server tries port 9223 first, then automatically falls back through ports 9224–9232 if needed
665
671
  - The plugin scans all ports in the range and connects to every active server it finds
666
- - All 103 tools work through the WebSocket transport
672
+ - All 106 tools work through the WebSocket transport
667
673
 
668
674
  **Multiple files:** The WebSocket server supports multiple simultaneous plugin connections — one per open Figma file. Each connection is tracked by file key with independent state (selection, document changes, console logs).
669
675
 
@@ -802,9 +808,11 @@ The architecture supports adding new apps with minimal boilerplate — each app
802
808
 
803
809
  ## 🛤️ Roadmap
804
810
 
805
- **Current Status:** v1.28.0 (Stable) - Production-ready with 10-format token export pipeline (DTCG, CSS, Tailwind v4, Tailwind v3, SCSS, TS module, JSON flat/nested, Style Dictionary v3, Tokens Studio), bidirectional Figma↔code token sync, version history & time-series awareness, FigJam + Slides support, Cloud Write Relay, Design System Kit, WebSocket-only connectivity, smart multi-file tracking, **103 tools** (Local) / **95 tools** (Cloud) / **9 tools** (Remote read-only), Comments API, cross-MCP identity disambiguation, and MCP Apps.
811
+ **Current Status:** v1.29.0 (Stable) - Production-ready with shared-library inspection (key-based component resolution + library variable read/import without Enterprise plan), 10-format token export pipeline (DTCG, CSS, Tailwind v4, Tailwind v3, SCSS, TS module, JSON flat/nested, Style Dictionary v3, Tokens Studio), bidirectional Figma↔code token sync, version history & time-series awareness, FigJam + Slides support, Cloud Write Relay, Design System Kit, WebSocket-only connectivity, smart multi-file tracking, **106 tools** (Local) / **95 tools** (Cloud) / **9 tools** (Remote read-only), Comments API, cross-MCP identity disambiguation, and MCP Apps.
806
812
 
807
813
  **Recent Releases:**
814
+ - [x] **v1.29.0** - Shared library inspection: three new tools close the gap between "I have a component key" and "I can actually use it." `figma_get_library_component_by_key` resolves any 40-char component key to full `componentPropertyDefinitions` + variants (with their published keys) + per-variant visual specs — without needing the source library file's URL. `figma_get_library_variables` lists library tokens via Plugin API (works on every Figma plan; the REST equivalent is Enterprise-only). `figma_import_library_variable` imports a library token to the current file so it can be bound to nodes. 27 new tests, 1178 total passing. Plugin re-import optional.
815
+ - [x] **v1.28.1** - Bug fix patch surfacing from live-fire testing of the v1.28.0 formatters against multi-tier semantic-token design systems. Fixes: Tailwind v3 emitted empty `module.exports` for alias-only sets (now resolves alias chains to literal values); TypeScript module + JSON flat + JSON nested formatters emitted `"{alias.path}"` strings as literal values (now resolves); Tailwind v4 namespace-prefix doubling (`--color-theme-color-X` is now `--color-theme-X`). Adds `resolveAliasChain` public helper. 1151 tests still passing.
808
816
  - [x] **v1.28.0** - Full formatter coverage for `figma_export_tokens`. Seven new output formats: Tailwind v4 `@theme inline`, Tailwind v3 config, SCSS variables, TypeScript module, JSON flat/nested, Style Dictionary v3, Tokens Studio multi-file. Combined with DTCG + CSS variables, ships **10 fully-implemented output formats** with zero third-party build-tool dependencies. Tool description updated, docs/tools.md table all-green. 22 new Jest tests, 1151 total passing.
809
817
  - [x] **v1.27.1** - Documentation patch. No code behavior changes. Sweeps stale "Phase 1 ships with DTCG only" claims across tool descriptions, error messages, and internal comments after CSS variables formatter and the apply phase shipped during the v1.27.0 dev cycle. Refreshes README banner + capability bullets + roadmap. Adds `Phase 3.5: Stale-Content Audit` to the release runbook so future releases get a strict pre-publish grep sweep across banners, tool descriptions, error messages, source comments, and tool-count consistency.
810
818
  - [x] **v1.27.0** - Bidirectional token sync: `figma_export_tokens` + `figma_import_tokens` replace Style Dictionary and Tokens Studio's export pipeline. Canonical DTCG JSON + CSS custom properties. Diff-aware merge with round-trip ID preservation via `$extensions["figma-console-mcp"]`. Apply phase pushes hex-value edits back to Figma via the plugin bridge. Verified end-to-end against 713-token + 280-token design systems.
@@ -48,10 +48,6 @@ const DEFAULT_CONFIG = {
48
48
  quality: 90,
49
49
  storePath: join(process.env.TMPDIR || '/tmp', 'figma-console-mcp', 'screenshots'),
50
50
  },
51
- local: {
52
- debugHost: process.env.FIGMA_DEBUG_HOST || 'localhost',
53
- debugPort: parseInt(process.env.FIGMA_DEBUG_PORT || '9222', 10),
54
- },
55
51
  };
56
52
  /**
57
53
  * Possible config file locations (checked in order)
@@ -111,10 +107,6 @@ function mergeConfig(defaults, overrides) {
111
107
  ...defaults.screenshots,
112
108
  ...(overrides.screenshots || {}),
113
109
  },
114
- local: {
115
- ...defaults.local,
116
- ...(overrides.local || {}),
117
- },
118
110
  };
119
111
  }
120
112
  /**
@@ -14,14 +14,14 @@ export class ConsoleMonitor {
14
14
  constructor(config) {
15
15
  this.logs = [];
16
16
  this.isMonitoring = false;
17
- this.page = null; // Supports both puppeteer-core and @cloudflare/puppeteer
17
+ this.page = null; // @cloudflare/puppeteer Page (this class is cloud-mode-only after Phase 3).
18
18
  this.workers = new Set();
19
19
  this.lastUrl = ''; // Track the last URL to detect real navigations vs hash changes
20
20
  this.config = config;
21
21
  }
22
22
  /**
23
- * Start monitoring console logs on a page
24
- * Accepts any puppeteer Page type (puppeteer-core or @cloudflare/puppeteer)
23
+ * Start monitoring console logs on a page.
24
+ * Accepts the @cloudflare/puppeteer Page type (cloud mode only).
25
25
  */
26
26
  async startMonitoring(page) {
27
27
  if (this.isMonitoring && this.page === page) {
@@ -42,7 +42,7 @@ function rgbaToHex(color) {
42
42
  * Extract a compact visual specification from a Figma node.
43
43
  * Captures the essential CSS-equivalent properties an AI needs to reproduce the component.
44
44
  */
45
- function extractVisualSpec(node) {
45
+ export function extractVisualSpec(node) {
46
46
  if (!node)
47
47
  return undefined;
48
48
  const spec = {};
@@ -0,0 +1,96 @@
1
+ /**
2
+ * figma_diagnose — a designer-readable health check for figma-console-mcp.
3
+ *
4
+ * This is the one tool to point a confused user at. It self-identifies the
5
+ * server, reports the transport / plugin / token state in plain language,
6
+ * and explicitly disclaims any token or OAuth error a user might be seeing
7
+ * in chat (those typically come from a different MCP). The response is
8
+ * structured so an LLM is likely to surface the `report` field verbatim.
9
+ */
10
+ import { z } from "zod";
11
+ import { MCP_NAME, withIdentity } from "./identity.js";
12
+ function buildReport(opts) {
13
+ const lines = [];
14
+ lines.push(`# ${MCP_NAME} diagnostic`);
15
+ lines.push("");
16
+ lines.push(`Server version: ${opts.getServerVersion()}`);
17
+ lines.push(`Mode: ${opts.mode === "local" ? "Local (stdio + WebSocket plugin bridge)" : "Cloud (Cloudflare Workers)"}`);
18
+ lines.push("");
19
+ const plugin = opts.getPluginState?.();
20
+ lines.push("## Plugin connection");
21
+ if (!plugin) {
22
+ lines.push("- No WebSocket server (cloud mode runs without a local plugin bridge unless paired).");
23
+ }
24
+ else if (plugin.connected) {
25
+ const portInfo = plugin.portFallbackFrom && plugin.port && plugin.port !== plugin.portFallbackFrom
26
+ ? `port ${plugin.port} (fallback from ${plugin.portFallbackFrom})`
27
+ : plugin.port
28
+ ? `port ${plugin.port}`
29
+ : "connected";
30
+ lines.push(`- ✅ Desktop Bridge plugin connected on ${portInfo}.`);
31
+ if (plugin.fileName) {
32
+ lines.push(`- Active file: **${plugin.fileName}**${plugin.currentPage ? ` (page: ${plugin.currentPage})` : ""}.`);
33
+ }
34
+ if (plugin.editorType && plugin.editorType !== "figma") {
35
+ lines.push(`- Editor type: ${plugin.editorType}.`);
36
+ }
37
+ }
38
+ else {
39
+ lines.push(`- ⚠️ Desktop Bridge plugin not connected${plugin.port ? ` (server is listening on port ${plugin.port})` : ""}.`);
40
+ lines.push("- To fix: open the Figma Desktop Bridge plugin in Figma Desktop. If it was already running, close and reopen it once.");
41
+ }
42
+ lines.push("");
43
+ const token = opts.getTokenState?.();
44
+ lines.push("## REST API token");
45
+ if (!token) {
46
+ lines.push("- Token state not available in this mode.");
47
+ }
48
+ else if (token.hasToken) {
49
+ lines.push(`- ✅ Figma access token detected (source: ${token.source ?? "unknown"}). REST-based tools should work.`);
50
+ }
51
+ else {
52
+ lines.push("- ⚠️ No Figma access token detected. Plugin-based tools still work; REST-only tools (file data, version history, image rendering) will return an auth error.");
53
+ if (opts.mode === "local") {
54
+ lines.push("- To enable REST tools: set FIGMA_ACCESS_TOKEN in your MCP client config. Generate a token at https://www.figma.com/developers/api#access-tokens.");
55
+ }
56
+ else {
57
+ lines.push("- To enable REST tools: authenticate via your MCP client's OAuth flow or pass a Figma personal access token (figd_...) as a Bearer token.");
58
+ }
59
+ }
60
+ lines.push("");
61
+ lines.push("## If you're seeing token / OAuth errors in chat");
62
+ lines.push(`If you see messages like "API token has expired" or "Bearer token has expired" and the response above does NOT show a token problem, the error is most likely coming from a **different MCP server**, not from ${MCP_NAME}.`);
63
+ lines.push("");
64
+ lines.push("Common cause: Figma's native MCP (often listed as just `Figma` in your MCP client) is also installed and its OAuth session expired. Check your MCP client's server list. Errors from those servers are not produced by figma-console-mcp.");
65
+ lines.push("");
66
+ return lines.join("\n");
67
+ }
68
+ export function registerDiagnoseTool(server, options) {
69
+ server.tool("figma_diagnose", `Designer-readable health check for ${MCP_NAME}. Use this when something seems wrong — it self-identifies the server, reports plugin connection / file / token status in plain language, and disambiguates errors that may be coming from a different Figma-related MCP server. Recommended as the first step when a user reports a "token expired" or "plugin disconnected" issue.`, {
70
+ verbose: z
71
+ .boolean()
72
+ .optional()
73
+ .default(false)
74
+ .describe("Include the raw structured state alongside the human-readable report."),
75
+ }, async ({ verbose }) => {
76
+ const report = buildReport(options);
77
+ const details = verbose
78
+ ? {
79
+ plugin: options.getPluginState?.() ?? null,
80
+ token: options.getTokenState?.() ?? null,
81
+ }
82
+ : undefined;
83
+ const payload = withIdentity({
84
+ report,
85
+ ...(details ? { details } : {}),
86
+ });
87
+ return {
88
+ content: [
89
+ {
90
+ type: "text",
91
+ text: JSON.stringify(payload),
92
+ },
93
+ ],
94
+ };
95
+ });
96
+ }
@@ -242,6 +242,25 @@ export class FigmaAPI {
242
242
  async getComponentSets(fileKey) {
243
243
  return this.request(`/files/${fileKey}/component_sets`);
244
244
  }
245
+ /**
246
+ * GET /v1/components/:key
247
+ * Get metadata for a single published component by its key.
248
+ * Returns { status, error, meta: PublishedComponent } where meta includes
249
+ * file_key, node_id, name, description, containing_frame, user, etc.
250
+ * Use this to resolve a componentKey (from search results) to its source file.
251
+ */
252
+ async getComponentByKey(key) {
253
+ return this.request(`/components/${key}`);
254
+ }
255
+ /**
256
+ * GET /v1/component_sets/:key
257
+ * Get metadata for a single published component set (variant container) by its key.
258
+ * Returns { status, error, meta: PublishedComponentSet } with the same fields
259
+ * as getComponentByKey. The node_id points to the parent COMPONENT_SET node.
260
+ */
261
+ async getComponentSetByKey(key) {
262
+ return this.request(`/component_sets/${key}`);
263
+ }
245
264
  /**
246
265
  * GET /v1/images/:file_key
247
266
  * Renders images for specified nodes