@muloka/figma-console-mcp 0.5.7 → 0.6.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.
- package/README.md +111 -848
- package/dist/apps/design-system-dashboard/mcp-app.html +107 -94
- package/dist/apps/design-system-dashboard/server.d.ts +1 -1
- package/dist/apps/design-system-dashboard/server.d.ts.map +1 -1
- package/dist/apps/token-browser/mcp-app.html +95 -82
- package/dist/apps/token-browser/server.d.ts +1 -1
- package/dist/apps/token-browser/server.d.ts.map +1 -1
- package/dist/core/accessibility-tools.d.ts +1 -1
- package/dist/core/accessibility-tools.d.ts.map +1 -1
- package/dist/core/accessibility-tools.js +18 -15
- package/dist/core/accessibility-tools.js.map +1 -1
- package/dist/core/annotation-tools.d.ts +1 -1
- package/dist/core/annotation-tools.d.ts.map +1 -1
- package/dist/core/annotation-tools.js +35 -26
- package/dist/core/annotation-tools.js.map +1 -1
- package/dist/core/comment-tools.d.ts +2 -2
- package/dist/core/comment-tools.d.ts.map +1 -1
- package/dist/core/comment-tools.js +60 -51
- package/dist/core/comment-tools.js.map +1 -1
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +2 -17
- package/dist/core/config.js.map +1 -1
- package/dist/core/console-monitor.d.ts +1 -1
- package/dist/core/console-monitor.d.ts.map +1 -1
- package/dist/core/console-monitor.js +2 -2
- package/dist/core/console-monitor.js.map +1 -1
- package/dist/core/deep-component-tools.d.ts +1 -1
- package/dist/core/deep-component-tools.d.ts.map +1 -1
- package/dist/core/deep-component-tools.js +15 -9
- package/dist/core/deep-component-tools.js.map +1 -1
- package/dist/core/design-code-tools.d.ts +1 -1
- package/dist/core/design-code-tools.d.ts.map +1 -1
- package/dist/core/design-code-tools.js +51 -45
- package/dist/core/design-code-tools.js.map +1 -1
- package/dist/core/design-system-tools.d.ts +1 -1
- package/dist/core/design-system-tools.d.ts.map +1 -1
- package/dist/core/design-system-tools.js +39 -36
- package/dist/core/design-system-tools.js.map +1 -1
- package/dist/core/diagnose-tool.d.ts +4 -4
- package/dist/core/diagnose-tool.d.ts.map +1 -1
- package/dist/core/diagnose-tool.js +12 -14
- package/dist/core/diagnose-tool.js.map +1 -1
- package/dist/core/figjam-tools.d.ts +2 -2
- package/dist/core/figjam-tools.d.ts.map +1 -1
- package/dist/core/figjam-tools.js +159 -129
- package/dist/core/figjam-tools.js.map +1 -1
- package/dist/core/figma-tools.d.ts +1 -1
- package/dist/core/figma-tools.d.ts.map +1 -1
- package/dist/core/figma-tools.js +280 -253
- package/dist/core/figma-tools.js.map +1 -1
- package/dist/core/identity.d.ts +49 -9
- package/dist/core/identity.d.ts.map +1 -1
- package/dist/core/identity.js +137 -28
- package/dist/core/identity.js.map +1 -1
- package/dist/core/library-tools.d.ts +1 -1
- package/dist/core/library-tools.d.ts.map +1 -1
- package/dist/core/library-tools.js +45 -36
- package/dist/core/library-tools.js.map +1 -1
- package/dist/core/logger.d.ts +0 -1
- package/dist/core/logger.d.ts.map +1 -1
- package/dist/core/logger.js +1 -13
- package/dist/core/logger.js.map +1 -1
- package/dist/core/slides-tools.d.ts +2 -2
- package/dist/core/slides-tools.d.ts.map +1 -1
- package/dist/core/slides-tools.js +223 -172
- package/dist/core/slides-tools.js.map +1 -1
- package/dist/core/slot-tools.d.ts +1 -1
- package/dist/core/slot-tools.d.ts.map +1 -1
- package/dist/core/slot-tools.js +101 -86
- package/dist/core/slot-tools.js.map +1 -1
- package/dist/core/tokens/config.d.ts +88 -266
- package/dist/core/tokens/config.d.ts.map +1 -1
- package/dist/core/tokens/config.js +2 -3
- package/dist/core/tokens/config.js.map +1 -1
- package/dist/core/tokens/schemas.d.ts +104 -113
- package/dist/core/tokens/schemas.d.ts.map +1 -1
- package/dist/core/tokens/schemas.js +2 -2
- package/dist/core/tokens/schemas.js.map +1 -1
- package/dist/core/tokens-tools.d.ts +5 -3
- package/dist/core/tokens-tools.d.ts.map +1 -1
- package/dist/core/tokens-tools.js +9 -2
- package/dist/core/tokens-tools.js.map +1 -1
- package/dist/core/types/index.d.ts +1 -1
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/core/variable-resolver.d.ts +3 -3
- package/dist/core/variable-resolver.js +5 -5
- package/dist/core/variable-resolver.js.map +1 -1
- package/dist/core/version-tools.d.ts +4 -4
- package/dist/core/version-tools.d.ts.map +1 -1
- package/dist/core/version-tools.js +162 -144
- package/dist/core/version-tools.js.map +1 -1
- package/dist/core/websocket-connector.d.ts +2 -3
- package/dist/core/websocket-connector.d.ts.map +1 -1
- package/dist/core/websocket-connector.js +2 -3
- package/dist/core/websocket-connector.js.map +1 -1
- package/dist/core/write-tools.d.ts +2 -2
- package/dist/core/write-tools.d.ts.map +1 -1
- package/dist/core/write-tools.js +564 -471
- package/dist/core/write-tools.js.map +1 -1
- package/dist/local.d.ts +8 -1
- package/dist/local.d.ts.map +1 -1
- package/dist/local.js +341 -199
- package/dist/local.js.map +1 -1
- package/package.json +10 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,MAAM,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,SAAS,EAAE,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,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AC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,CAAC;IACzC,UAAU,EAAE,gBAAgB,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,KAAK,GAAG,MAAM,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;CAC3B"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Figma's Variables REST API (`/files/:key/variables/local`) is **Enterprise-only**
|
|
5
5
|
* and returns 403 for the majority of users (Starter/Pro/Org). The Desktop Bridge
|
|
6
|
-
*
|
|
6
|
+
* reads variables through the Plugin API
|
|
7
7
|
* (`figma.variables.getLocalVariablesAsync`), which works on **every** Figma plan.
|
|
8
8
|
*
|
|
9
9
|
* Orchestration tools (e.g. `figma_get_design_system_kit`) historically called the
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* bridge was connected. This helper mirrors `figma_get_variables`' resolution order
|
|
12
12
|
* so every variable-reading tool behaves consistently:
|
|
13
13
|
*
|
|
14
|
-
* 1. Desktop Bridge
|
|
14
|
+
* 1. Desktop Bridge (any plan) ← preferred
|
|
15
15
|
* 2. REST Variables API (Enterprise only) ← fallback
|
|
16
16
|
*
|
|
17
17
|
* It returns the same normalized shape as `formatVariables()`.
|
|
@@ -29,7 +29,7 @@ export interface ResolvedVariables {
|
|
|
29
29
|
source: "desktop_bridge" | "rest_api";
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
|
-
* Resolve + format local variables, preferring the Desktop Bridge
|
|
32
|
+
* Resolve + format local variables, preferring the Desktop Bridge and
|
|
33
33
|
* falling back to the Enterprise-only REST API only when no bridge is connected.
|
|
34
34
|
*
|
|
35
35
|
* @throws a bridge-pointing error when the bridge is unavailable AND the REST API
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Figma's Variables REST API (`/files/:key/variables/local`) is **Enterprise-only**
|
|
5
5
|
* and returns 403 for the majority of users (Starter/Pro/Org). The Desktop Bridge
|
|
6
|
-
*
|
|
6
|
+
* reads variables through the Plugin API
|
|
7
7
|
* (`figma.variables.getLocalVariablesAsync`), which works on **every** Figma plan.
|
|
8
8
|
*
|
|
9
9
|
* Orchestration tools (e.g. `figma_get_design_system_kit`) historically called the
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* bridge was connected. This helper mirrors `figma_get_variables`' resolution order
|
|
12
12
|
* so every variable-reading tool behaves consistently:
|
|
13
13
|
*
|
|
14
|
-
* 1. Desktop Bridge
|
|
14
|
+
* 1. Desktop Bridge (any plan) ← preferred
|
|
15
15
|
* 2. REST Variables API (Enterprise only) ← fallback
|
|
16
16
|
*
|
|
17
17
|
* It returns the same normalized shape as `formatVariables()`.
|
|
@@ -38,7 +38,7 @@ function bridgeArraysToFormatInput(data) {
|
|
|
38
38
|
return { variables, variableCollections };
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
|
-
* Resolve + format local variables, preferring the Desktop Bridge
|
|
41
|
+
* Resolve + format local variables, preferring the Desktop Bridge and
|
|
42
42
|
* falling back to the Enterprise-only REST API only when no bridge is connected.
|
|
43
43
|
*
|
|
44
44
|
* @throws a bridge-pointing error when the bridge is unavailable AND the REST API
|
|
@@ -48,7 +48,7 @@ function bridgeArraysToFormatInput(data) {
|
|
|
48
48
|
export async function resolveFormattedVariables(opts) {
|
|
49
49
|
const { getDesktopConnector, getFigmaAPI, fileKey } = opts;
|
|
50
50
|
const timeoutMs = opts.timeoutMs ?? 30000;
|
|
51
|
-
// 1. Desktop Bridge
|
|
51
|
+
// 1. Desktop Bridge — works on ANY plan. Preferred.
|
|
52
52
|
if (getDesktopConnector) {
|
|
53
53
|
try {
|
|
54
54
|
const connector = await getDesktopConnector();
|
|
@@ -79,7 +79,7 @@ export async function resolveFormattedVariables(opts) {
|
|
|
79
79
|
const msg = restErr instanceof Error ? restErr.message : String(restErr);
|
|
80
80
|
throw new Error(`[figma-console-mcp] Could not read variables. The Figma Variables REST API ` +
|
|
81
81
|
`is unavailable for this file (${msg}) — it requires an Enterprise plan. ` +
|
|
82
|
-
`Connect the Figma Console MCP Desktop Bridge plugin
|
|
82
|
+
`Connect the Figma Console MCP Desktop Bridge plugin ` +
|
|
83
83
|
`to read variables on ANY plan, then retry.`);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variable-resolver.js","sourceRoot":"","sources":["../../src/core/variable-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,eAAe,EAAE,WAAW,EAAiB,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,MAAM,GAAG,iBAAiB,CAAC,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC,CAAC;AAcrE;;;;GAIG;AACH,SAAS,yBAAyB,CAAC,IAGlC;IACA,MAAM,SAAS,GAAwB,EAAE,CAAC;IAC1C,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,SAAS,IAAI,EAAE,EAAE,CAAC;QACtC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE;YAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACpC,CAAC;IACD,MAAM,mBAAmB,GAAwB,EAAE,CAAC;IACpD,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,mBAAmB,IAAI,EAAE,EAAE,CAAC;QAChD,IAAI,CAAC,IAAI,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CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EACpE,gEAAgE,CAChE,CAAC;QACH,CAAC;IACF,CAAC;IAED,wDAAwD;IACxD,MAAM,GAAG,GAAG,MAAM,WAAW,EAAE,CAAC;IAChC,IAAI,CAAC;QACJ,MAAM,KAAK,GAAG,MAAM,WAAW,CAC9B,GAAG,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAC9B,SAAS,EACT,mBAAmB,CACnB,CAAC;QACF,MAAM,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;QACzC,MAAM,CAAC,IAAI,CACV,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,EACjE,iCAAiC,CACjC,CAAC;QACF,OAAO,EAAE,GAAG,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;IAC7C,CAAC;IAAC,OAAO,OAAO,EAAE,CAAC;QAClB,MAAM,GAAG,GAAG,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACzE,MAAM,IAAI,KAAK,CACd,6EAA6E;YAC5E,iCAAiC,GAAG,sCAAsC;YAC1E,sDAAsD;YACtD,4CAA4C,CAC7C,CAAC;IACH,CAAC;AACF,CAAC"}
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
* - figma_generate_changelog: human-readable markdown changelog on top of
|
|
15
15
|
* the diff, with author enrichment via figma_get_file_versions lookback.
|
|
16
16
|
*
|
|
17
|
-
* All tools work in
|
|
17
|
+
* All tools work in Local Mode. Required scope is
|
|
18
18
|
* file_versions:read on OAuth, or "Versions" Read on a Personal Access Token,
|
|
19
19
|
* plus the standard file_content:read for fetching file snapshots.
|
|
20
20
|
*
|
|
21
21
|
* Design notes at .notes/VERSION-HISTORY-DIFF-DESIGN.md.
|
|
22
22
|
*/
|
|
23
|
-
import type { McpServer } from "@modelcontextprotocol/
|
|
23
|
+
import type { McpServer } from "@modelcontextprotocol/server";
|
|
24
24
|
import type { FigmaAPI } from "./figma-api.js";
|
|
25
25
|
/** Test-only: clears the module-scoped snapshot cache so unit tests see fresh state. */
|
|
26
26
|
export declare function _clearVersionSnapshotCacheForTesting(): void;
|
|
@@ -51,8 +51,8 @@ export declare function registerVersionTools(server: McpServer, getFigmaAPI: ()
|
|
|
51
51
|
/**
|
|
52
52
|
* v1.25.0: optional metadata-change buffer reader. When wired (local mode),
|
|
53
53
|
* the diff engine consults this to surface description/annotation edits
|
|
54
|
-
* that Figma REST doesn't expose.
|
|
55
|
-
*
|
|
54
|
+
* that Figma REST doesn't expose. When no plugin buffer is wired, this
|
|
55
|
+
* stays undefined and the diff just doesn't surface
|
|
56
56
|
* those edits — but scope_coverage still tells callers about the gap.
|
|
57
57
|
*/
|
|
58
58
|
getMetadataChanges?: GetMetadataChanges): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version-tools.d.ts","sourceRoot":"","sources":["../../src/core/version-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"version-tools.d.ts","sourceRoot":"","sources":["../../src/core/version-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAsB/C,wFAAwF;AACxF,wBAAgB,oCAAoC,IAAI,IAAI,CAE3D;AAuFD;;;;;;GAMG;AACH,MAAM,WAAW,yBAAyB;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,EAAE,aAAa,GAAG,aAAa,CAAC;IACrC,SAAS,EAAE,GAAG,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB,KAAK,yBAAyB,EAAE,CAAC;AAElC,wBAAgB,oBAAoB,CACnC,MAAM,EAAE,SAAS,EACjB,WAAW,EAAE,MAAM,OAAO,CAAC,QAAQ,CAAC,EACpC,aAAa,EAAE,MAAM,MAAM,GAAG,IAAI,EAClC,QAAQ,CAAC,EAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,EACrC,yBAAyB,CAAC,EAAE,MAAM,MAAM,EAAE,GAAG,IAAI;AACjD;;;;;;GAMG;AACH,kBAAkB,CAAC,EAAE,kBAAkB,GACrC,IAAI,CA4tCN"}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* - figma_generate_changelog: human-readable markdown changelog on top of
|
|
15
15
|
* the diff, with author enrichment via figma_get_file_versions lookback.
|
|
16
16
|
*
|
|
17
|
-
* All tools work in
|
|
17
|
+
* All tools work in Local Mode. Required scope is
|
|
18
18
|
* file_versions:read on OAuth, or "Versions" Read on a Personal Access Token,
|
|
19
19
|
* plus the standard file_content:read for fetching file snapshots.
|
|
20
20
|
*
|
|
@@ -83,13 +83,13 @@ export function registerVersionTools(server, getFigmaAPI, getCurrentUrl, _option
|
|
|
83
83
|
/**
|
|
84
84
|
* v1.25.0: optional metadata-change buffer reader. When wired (local mode),
|
|
85
85
|
* the diff engine consults this to surface description/annotation edits
|
|
86
|
-
* that Figma REST doesn't expose.
|
|
87
|
-
*
|
|
86
|
+
* that Figma REST doesn't expose. When no plugin buffer is wired, this
|
|
87
|
+
* stays undefined and the diff just doesn't surface
|
|
88
88
|
* those edits — but scope_coverage still tells callers about the gap.
|
|
89
89
|
*/
|
|
90
90
|
getMetadataChanges) {
|
|
91
91
|
// Helper: read the current Figma selection as a list of node IDs, or null
|
|
92
|
-
// if no selection getter is wired
|
|
92
|
+
// if no selection getter is wired or selection is empty.
|
|
93
93
|
const readSelection = () => {
|
|
94
94
|
if (!getCurrentSelectedNodeIds)
|
|
95
95
|
return null;
|
|
@@ -106,29 +106,32 @@ getMetadataChanges) {
|
|
|
106
106
|
// -----------------------------------------------------------------------
|
|
107
107
|
// Tool: figma_get_file_versions
|
|
108
108
|
// -----------------------------------------------------------------------
|
|
109
|
-
server.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
109
|
+
server.registerTool("figma_get_file_versions", {
|
|
110
|
+
description: "List a Figma file's version history with metadata (label, description, author, timestamp). Auto-paginates up to max_versions. By default returns only labeled versions (skips auto-saves). Pass include_autosaves=true to see every saved state. Use the returned pagination.next_cursor to continue paging. Required scope: file_versions:read (OAuth) or 'Versions' Read (PAT).",
|
|
111
|
+
inputSchema: z.object({
|
|
112
|
+
fileUrl: z
|
|
113
|
+
.string()
|
|
114
|
+
.url()
|
|
115
|
+
.optional()
|
|
116
|
+
.describe("Figma file URL. Uses current URL if omitted."),
|
|
117
|
+
include_autosaves: z
|
|
118
|
+
.boolean()
|
|
119
|
+
.optional()
|
|
120
|
+
.default(false)
|
|
121
|
+
.describe("Include auto-saved versions (those without a label). Default: false."),
|
|
122
|
+
max_versions: z
|
|
123
|
+
.number()
|
|
124
|
+
.int()
|
|
125
|
+
.min(1)
|
|
126
|
+
.max(MAX_VERSIONS_HARD_CAP)
|
|
127
|
+
.optional()
|
|
128
|
+
.default(50)
|
|
129
|
+
.describe("Hard cap on returned versions. Default 50, max 200."),
|
|
130
|
+
cursor: z
|
|
131
|
+
.string()
|
|
132
|
+
.optional()
|
|
133
|
+
.describe("Version ID returned as pagination.next_cursor on a previous call. Pass to continue from where the last call stopped."),
|
|
134
|
+
}),
|
|
132
135
|
}, async ({ fileUrl, include_autosaves = false, max_versions = 50, cursor }) => {
|
|
133
136
|
try {
|
|
134
137
|
const url = fileUrl || getCurrentUrl();
|
|
@@ -268,26 +271,29 @@ getMetadataChanges) {
|
|
|
268
271
|
// -----------------------------------------------------------------------
|
|
269
272
|
// Tool: figma_get_file_at_version
|
|
270
273
|
// -----------------------------------------------------------------------
|
|
271
|
-
server.
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
274
|
+
server.registerTool("figma_get_file_at_version", {
|
|
275
|
+
description: "Fetch a Figma file (or specific nodes) as it existed at a past version_id. Thin snapshot tool — same shape as figma_get_file_data but bound to a historical version. Use figma_get_file_versions to discover version IDs. Combine with depth and node_ids to keep payloads small. Required scope: file_content:read (already standard).",
|
|
276
|
+
inputSchema: z.object({
|
|
277
|
+
fileUrl: z
|
|
278
|
+
.string()
|
|
279
|
+
.url()
|
|
280
|
+
.optional()
|
|
281
|
+
.describe("Figma file URL. Uses current URL if omitted."),
|
|
282
|
+
version_id: z
|
|
283
|
+
.string()
|
|
284
|
+
.describe("The version ID to snapshot (from figma_get_file_versions)."),
|
|
285
|
+
node_ids: z
|
|
286
|
+
.array(z.string())
|
|
287
|
+
.optional()
|
|
288
|
+
.describe("Optional: snapshot only these node IDs instead of the full file. Reduces payload significantly for targeted inspection."),
|
|
289
|
+
depth: z
|
|
290
|
+
.number()
|
|
291
|
+
.int()
|
|
292
|
+
.min(1)
|
|
293
|
+
.max(10)
|
|
294
|
+
.optional()
|
|
295
|
+
.describe("How deep into the document tree to recurse. Lower is cheaper. Default: full depth (no limit)."),
|
|
296
|
+
}),
|
|
291
297
|
}, async ({ fileUrl, version_id, node_ids, depth }) => {
|
|
292
298
|
try {
|
|
293
299
|
const url = fileUrl || getCurrentUrl();
|
|
@@ -511,7 +517,7 @@ getMetadataChanges) {
|
|
|
511
517
|
notes.push("Raw layout/visual properties are NOT tracked. This includes layoutSizingHorizontal/Vertical (hug vs. fill), primaryAxisSizingMode/counterAxisSizingMode, raw paddings/widths/cornerRadius when not bound to a variable, and unbound fills/strokes/effects. This tool surfaces structural deltas (children, property defs, name, description) and variable-BINDING deltas only.");
|
|
512
518
|
notes.push("Variable VALUE history is not retrievable from Figma REST API. Variable definition value changes between these versions are not represented; only binding-reference changes on scoped nodes are detected.");
|
|
513
519
|
// v1.25.0: surface metadata-buffer state. Either "tracked via plugin buffer"
|
|
514
|
-
// (and any limits) or "not tracked at all" (
|
|
520
|
+
// (and any limits) or "not tracked at all" (no buffer wired).
|
|
515
521
|
if (metadataBufferAvailable) {
|
|
516
522
|
notes.push("Description and annotation changes ARE tracked when the Desktop Bridge plugin was connected during the edit. They appear under each node's metadata_changes[]. Edits made while the plugin was disconnected (or before this MCP session started) WON'T appear in the buffer — the diff will silently miss them.");
|
|
517
523
|
if (bufferedMetadata.length === 0) {
|
|
@@ -519,7 +525,7 @@ getMetadataChanges) {
|
|
|
519
525
|
}
|
|
520
526
|
}
|
|
521
527
|
else {
|
|
522
|
-
notes.push("Description and annotation changes are NOT being tracked — no metadata buffer is wired
|
|
528
|
+
notes.push("Description and annotation changes are NOT being tracked — no metadata buffer is wired. For description/annotation visibility, run with the Desktop Bridge plugin connected.");
|
|
523
529
|
}
|
|
524
530
|
if (fetchErrors.length > 0) {
|
|
525
531
|
notes.push(`Failed to fetch ${fetchErrors.length} of ${component_ids?.length ?? 0} requested nodes — see _fetch_errors.`);
|
|
@@ -698,48 +704,54 @@ getMetadataChanges) {
|
|
|
698
704
|
// -----------------------------------------------------------------------
|
|
699
705
|
// Tool: figma_diff_versions
|
|
700
706
|
// -----------------------------------------------------------------------
|
|
701
|
-
server.
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
707
|
+
server.registerTool("figma_diff_versions", {
|
|
708
|
+
description: "Diff two versions of a Figma file. Always returns a cheap page-structure diff (added/removed/renamed pages, 2 API calls). Pass component_ids to additionally get per-node deep diffs at depth=2 (added/removed children, name/description changes, componentPropertyDefinitions changes for COMPONENT_SETs, boundVariables deltas) — costs 2 API calls per scoped node. Use 'current' for to_version to diff against HEAD. v1.25.0: when the Desktop Bridge plugin is connected, description and Dev Mode annotation changes are ALSO tracked via a session buffer and surfaced under `scoped_nodes[].metadata_changes[]` and `unscoped_metadata_changes[]` — Figma REST omits these from version snapshots so they're otherwise invisible. STILL NOT tracked: instances of components on the canvas, raw layout properties (layoutSizingHorizontal/Vertical, unbound paddings/widths), raw visual properties (cornerRadius, unbound fills), variable VALUE changes, style content, and metadata edits made while the plugin was disconnected. See `scope_coverage` and `notes[]` for the full coverage map and complementary tools.",
|
|
709
|
+
inputSchema: z.object({
|
|
710
|
+
fileUrl: z
|
|
711
|
+
.string()
|
|
712
|
+
.url()
|
|
713
|
+
.optional()
|
|
714
|
+
.describe("Figma file URL. Uses current URL if omitted."),
|
|
715
|
+
from_version: z
|
|
716
|
+
.string()
|
|
717
|
+
.describe("The earlier version_id to compare from. Get from figma_get_file_versions."),
|
|
718
|
+
to_version: z
|
|
719
|
+
.string()
|
|
720
|
+
.describe("The later version_id to compare to. Use 'current' for HEAD."),
|
|
721
|
+
component_ids: z
|
|
722
|
+
.array(z.string())
|
|
723
|
+
.optional()
|
|
724
|
+
.describe("Optional. Node IDs (typically COMPONENT_SETs) to diff in detail. If omitted, falls back to the current Figma selection. If neither is available, only the page-structure diff is returned. Use figma_get_design_system_kit or figma_search_components to discover IDs explicitly."),
|
|
725
|
+
mode: z
|
|
726
|
+
.enum(["summary", "standard", "detailed"])
|
|
727
|
+
.optional()
|
|
728
|
+
.default("standard")
|
|
729
|
+
.describe("Output verbosity. summary=counts only, standard=names+counts (default), detailed=full property/binding details."),
|
|
730
|
+
}),
|
|
722
731
|
}, async (args) => runDiff(args));
|
|
723
732
|
// -----------------------------------------------------------------------
|
|
724
733
|
// Tool: figma_get_changes_since_version
|
|
725
734
|
// -----------------------------------------------------------------------
|
|
726
|
-
server.
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
735
|
+
server.registerTool("figma_get_changes_since_version", {
|
|
736
|
+
description: "Convenience wrapper for figma_diff_versions: compares a given version against the current HEAD. Same output shape as figma_diff_versions, with to_version implicitly 'current'. Useful for 'what's changed since the last code-sync' workflows.",
|
|
737
|
+
inputSchema: z.object({
|
|
738
|
+
fileUrl: z
|
|
739
|
+
.string()
|
|
740
|
+
.url()
|
|
741
|
+
.optional()
|
|
742
|
+
.describe("Figma file URL. Uses current URL if omitted."),
|
|
743
|
+
since_version: z
|
|
744
|
+
.string()
|
|
745
|
+
.describe("The version_id to compare against the current HEAD."),
|
|
746
|
+
component_ids: z
|
|
747
|
+
.array(z.string())
|
|
748
|
+
.optional()
|
|
749
|
+
.describe("Optional. Node IDs to diff in detail. If omitted, falls back to the current Figma selection. Same semantics as figma_diff_versions otherwise."),
|
|
750
|
+
mode: z
|
|
751
|
+
.enum(["summary", "standard", "detailed"])
|
|
752
|
+
.optional()
|
|
753
|
+
.default("standard"),
|
|
754
|
+
}),
|
|
743
755
|
}, async ({ fileUrl, since_version, component_ids, mode }) => runDiff({
|
|
744
756
|
fileUrl,
|
|
745
757
|
from_version: since_version,
|
|
@@ -750,27 +762,30 @@ getMetadataChanges) {
|
|
|
750
762
|
// -----------------------------------------------------------------------
|
|
751
763
|
// Tool: figma_generate_changelog
|
|
752
764
|
// -----------------------------------------------------------------------
|
|
753
|
-
server.
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
765
|
+
server.registerTool("figma_generate_changelog", {
|
|
766
|
+
description: "Generate a human-readable markdown changelog between two versions. Wraps figma_diff_versions and enriches the output with author labels and timestamps via figma_get_file_versions lookback (one extra cheap API call). Returns BOTH a `markdown` string (paste into release notes / PRs / Storybook MDX) and the structured diff data. Same component_ids and mode semantics as figma_diff_versions. Use 'current' for to_version to changelog against HEAD.",
|
|
767
|
+
inputSchema: z.object({
|
|
768
|
+
fileUrl: z
|
|
769
|
+
.string()
|
|
770
|
+
.url()
|
|
771
|
+
.optional()
|
|
772
|
+
.describe("Figma file URL. Uses current URL if omitted."),
|
|
773
|
+
from_version: z
|
|
774
|
+
.string()
|
|
775
|
+
.describe("The earlier version_id. Get from figma_get_file_versions."),
|
|
776
|
+
to_version: z
|
|
777
|
+
.string()
|
|
778
|
+
.describe("The later version_id. Use 'current' for HEAD."),
|
|
779
|
+
component_ids: z
|
|
780
|
+
.array(z.string())
|
|
781
|
+
.optional()
|
|
782
|
+
.describe("Optional. Node IDs to include in the per-component changelog section. If omitted, falls back to the current Figma selection."),
|
|
783
|
+
mode: z
|
|
784
|
+
.enum(["summary", "standard", "detailed"])
|
|
785
|
+
.optional()
|
|
786
|
+
.default("standard")
|
|
787
|
+
.describe("Output verbosity. summary=one-liner, standard=sectioned with counts (default), detailed=full per-property/per-binding bullets."),
|
|
788
|
+
}),
|
|
774
789
|
}, async ({ fileUrl, from_version, to_version, component_ids, mode }) => {
|
|
775
790
|
const effectiveMode = mode ?? "standard";
|
|
776
791
|
try {
|
|
@@ -830,42 +845,45 @@ getMetadataChanges) {
|
|
|
830
845
|
// -----------------------------------------------------------------------
|
|
831
846
|
// Tool: figma_blame_node
|
|
832
847
|
// -----------------------------------------------------------------------
|
|
833
|
-
server.
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
848
|
+
server.registerTool("figma_blame_node", {
|
|
849
|
+
description: "Find the version that introduced a specific change to a node — answers 'who/when added this'. Walks version history backward via binary search (~log2(N) API calls instead of N) to localize the introduction point. Returns the version's metadata (label/author/timestamp). Default includes autosaves for finer attribution; system 'Figma' user appears occasionally for scheduled snapshots and is flagged via attribution_certainty='system_attributed'. Specify EXACTLY ONE of target_component_property or target_child_node_id. node_id is optional — if omitted, falls back to the first node in the current Figma selection.",
|
|
850
|
+
inputSchema: z.object({
|
|
851
|
+
fileUrl: z
|
|
852
|
+
.string()
|
|
853
|
+
.url()
|
|
854
|
+
.optional()
|
|
855
|
+
.describe("Figma file URL. Uses current URL if omitted."),
|
|
856
|
+
node_id: z
|
|
857
|
+
.string()
|
|
858
|
+
.optional()
|
|
859
|
+
.describe("The parent node ID to inspect (typically a COMPONENT_SET). If omitted, falls back to the first node in the current Figma selection."),
|
|
860
|
+
target_component_property: z
|
|
861
|
+
.string()
|
|
862
|
+
.optional()
|
|
863
|
+
.describe("A componentPropertyDefinitions key (e.g. 'Disabled#1:2') — find when this property was first added to the node."),
|
|
864
|
+
target_child_node_id: z
|
|
865
|
+
.string()
|
|
866
|
+
.optional()
|
|
867
|
+
.describe("A descendant node ID — find when this child was first added under node_id."),
|
|
868
|
+
start_version: z
|
|
869
|
+
.string()
|
|
870
|
+
.optional()
|
|
871
|
+
.default("current")
|
|
872
|
+
.describe("Version to walk backward from. Default 'current' (HEAD)."),
|
|
873
|
+
max_versions_to_walk: z
|
|
874
|
+
.number()
|
|
875
|
+
.int()
|
|
876
|
+
.min(2)
|
|
877
|
+
.max(500)
|
|
878
|
+
.optional()
|
|
879
|
+
.default(200)
|
|
880
|
+
.describe("Lookback cap. Binary search probes ~log2(N) of these. Default 200, max 500."),
|
|
881
|
+
include_autosaves: z
|
|
882
|
+
.boolean()
|
|
883
|
+
.optional()
|
|
884
|
+
.default(true)
|
|
885
|
+
.describe("Include auto-saved versions in the search range. Default true (better attribution accuracy; most autosaves carry the real human user)."),
|
|
886
|
+
}),
|
|
869
887
|
}, async ({ fileUrl, node_id, target_component_property, target_child_node_id, start_version, max_versions_to_walk, include_autosaves, }) => {
|
|
870
888
|
const lookback = max_versions_to_walk ?? 200;
|
|
871
889
|
const includeAuto = include_autosaves ?? true;
|