figma-prototype-mcp 0.30.1 → 0.30.2

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.
@@ -8,6 +8,45 @@ import { fileURLToPath } from "url";
8
8
 
9
9
  // src/server/sessions.ts
10
10
  import { randomUUID } from "crypto";
11
+
12
+ // src/server/messages.ts
13
+ var COMMUNITY_URL = "https://www.figma.com/community/plugin/1647184714488719280";
14
+ var PLUGIN_NOT_CONNECTED = [
15
+ `Figma plugin not connected. The MCP server is running, but no Figma plugin has connected yet.`,
16
+ `To connect: in Figma, open your file \u2192 Plugins \u2192 run "Prototype MCP".`,
17
+ `If you haven't installed it, get it from Figma Community:`,
18
+ COMMUNITY_URL,
19
+ `The plugin auto-connects to ws://localhost:3000/ws \u2014 once it shows "Connected", retry your request.`,
20
+ ``,
21
+ `Figma \uD50C\uB7EC\uADF8\uC778\uC774 \uC5F0\uACB0\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4. MCP \uC11C\uBC84\uB294 \uC2E4\uD589 \uC911\uC774\uC9C0\uB9CC \uD50C\uB7EC\uADF8\uC778\uC774 \uC544\uC9C1 \uC5F0\uACB0\uB418\uC9C0 \uC54A\uC558\uC5B4\uC694.`,
22
+ `\uC5F0\uACB0 \uBC29\uBC95: Figma\uC5D0\uC11C \uD30C\uC77C\uC744 \uC5F4\uACE0 \u2192 Plugins \u2192 "Prototype MCP" \uC2E4\uD589.`,
23
+ `\uC124\uCE58 \uC804\uC774\uB77C\uBA74 Figma Community\uC5D0\uC11C \uBC1B\uC73C\uC138\uC694:`,
24
+ COMMUNITY_URL,
25
+ `\uD50C\uB7EC\uADF8\uC778\uC740 ws://localhost:3000/ws\uC5D0 \uC790\uB3D9 \uC5F0\uACB0\uB429\uB2C8\uB2E4 \u2014 "Connected"\uAC00 \uB728\uBA74 \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uC138\uC694.`
26
+ ].join("\n");
27
+ var PLUGIN_DISCONNECTED = [
28
+ `The Figma plugin disconnected before the command finished. This usually means the Figma tab/file or the plugin window was closed.`,
29
+ `Reopen "Prototype MCP" in Figma \u2014 it auto-reconnects \u2014 then retry.`,
30
+ ``,
31
+ `\uBA85\uB839\uC774 \uB05D\uB098\uAE30 \uC804\uC5D0 Figma \uD50C\uB7EC\uADF8\uC778 \uC5F0\uACB0\uC774 \uB04A\uACBC\uC2B5\uB2C8\uB2E4. \uBCF4\uD1B5 Figma \uD0ED/\uD30C\uC77C\uC774\uB098 \uD50C\uB7EC\uADF8\uC778 \uCC3D\uC744 \uB2EB\uC558\uC744 \uB54C \uBC1C\uC0DD\uD574\uC694.`,
32
+ `Figma\uC5D0\uC11C "Prototype MCP"\uB97C \uB2E4\uC2DC \uC2E4\uD589\uD558\uBA74 \uC790\uB3D9 \uC7AC\uC5F0\uACB0\uB429\uB2C8\uB2E4 \u2014 \uADF8 \uD6C4 \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uC138\uC694.`
33
+ ].join("\n");
34
+ var PLUGIN_CONNECTION_REPLACED = [
35
+ `Your plugin connection was replaced by a newer one. Only one Figma plugin can be active at a time (newest wins) \u2014 this usually means the plugin connected from a second Figma tab or file.`,
36
+ `Use the most recently opened "Prototype MCP" plugin, then retry.`,
37
+ ``,
38
+ `\uD50C\uB7EC\uADF8\uC778 \uC5F0\uACB0\uC774 \uB354 \uC0C8\uB85C\uC6B4 \uC5F0\uACB0\uB85C \uAD50\uCCB4\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uD55C \uBC88\uC5D0 \uD558\uB098\uC758 Figma \uD50C\uB7EC\uADF8\uC778\uB9CC \uD65C\uC131\uD654\uB429\uB2C8\uB2E4(\uCD5C\uC2E0 \uC6B0\uC120) \u2014 \uBCF4\uD1B5 \uB450 \uBC88\uC9F8 Figma \uD0ED\uC774\uB098 \uD30C\uC77C\uC5D0\uC11C \uD50C\uB7EC\uADF8\uC778\uC774 \uC5F0\uACB0\uB410\uC744 \uB54C \uBC1C\uC0DD\uD574\uC694.`,
39
+ `\uAC00\uC7A5 \uCD5C\uADFC\uC5D0 \uC5F0 "Prototype MCP" \uD50C\uB7EC\uADF8\uC778\uC744 \uC0AC\uC6A9\uD55C \uB4A4 \uC7AC\uC2DC\uB3C4\uD558\uC138\uC694.`
40
+ ].join("\n");
41
+ var pluginCommandTimeout = (command, ms) => [
42
+ `The Figma plugin is connected but didn't respond within ${ms}ms (command: ${command}).`,
43
+ `Figma may be busy, or the plugin may be stuck. Try closing and relaunching "Prototype MCP" in Figma, then retry.`,
44
+ ``,
45
+ `Figma \uD50C\uB7EC\uADF8\uC778\uC774 \uC5F0\uACB0\uB3FC \uC788\uC9C0\uB9CC ${ms}ms \uC548\uC5D0 \uC751\uB2F5\uD558\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4 (\uBA85\uB839: ${command}).`,
46
+ `Figma\uAC00 \uBC14\uC058\uAC70\uB098 \uD50C\uB7EC\uADF8\uC778\uC774 \uBA48\uCDC4\uC744 \uC218 \uC788\uC5B4\uC694. Figma\uC5D0\uC11C "Prototype MCP"\uB97C \uB2EB\uC558\uB2E4\uAC00 \uB2E4\uC2DC \uC2E4\uD589\uD55C \uB4A4 \uC7AC\uC2DC\uB3C4\uD558\uC138\uC694.`
47
+ ].join("\n");
48
+
49
+ // src/server/sessions.ts
11
50
  var PluginSession = class {
12
51
  active = null;
13
52
  pending = /* @__PURE__ */ new Map();
@@ -31,7 +70,7 @@ var PluginSession = class {
31
70
  this.active.close();
32
71
  } catch {
33
72
  }
34
- this.failAllPending(new Error("Plugin connection replaced by newer connection"));
73
+ this.failAllPending(new Error(PLUGIN_CONNECTION_REPLACED));
35
74
  }
36
75
  this.active = ws;
37
76
  try {
@@ -43,7 +82,7 @@ var PluginSession = class {
43
82
  clearActive(ws) {
44
83
  if (this.active === ws) {
45
84
  this.active = null;
46
- this.failAllPending(new Error("Plugin disconnected"));
85
+ this.failAllPending(new Error(PLUGIN_DISCONNECTED));
47
86
  }
48
87
  }
49
88
  handleResponse(msg) {
@@ -58,14 +97,14 @@ var PluginSession = class {
58
97
  if (!this.isConnected()) {
59
98
  await this.waitForConnection(this.connectWaitMs);
60
99
  if (!this.isConnected()) {
61
- throw new Error("\uD53C\uADF8\uB9C8 \uD50C\uB7EC\uADF8\uC778 \uC5F0\uACB0\uC744 \uD655\uC778\uD574\uC8FC\uC138\uC694");
100
+ throw new Error(PLUGIN_NOT_CONNECTED);
62
101
  }
63
102
  }
64
103
  const id = randomUUID();
65
104
  return new Promise((resolve, reject) => {
66
105
  const timer = setTimeout(() => {
67
106
  this.pending.delete(id);
68
- reject(new Error(`Command ${command} timed out after ${this.commandTimeoutMs}ms`));
107
+ reject(new Error(pluginCommandTimeout(command, this.commandTimeoutMs)));
69
108
  }, this.commandTimeoutMs);
70
109
  this.pending.set(id, { resolve, reject, timer });
71
110
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "figma-prototype-mcp",
3
- "version": "0.30.1",
3
+ "version": "0.30.2",
4
4
  "description": "MCP server for creating Figma prototype interactions via natural language",
5
5
  "license": "MIT",
6
6
  "author": "smooeach",