@tempad-dev/mcp 0.8.0 → 0.9.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.
@@ -11,18 +11,19 @@ const MCP_PORT_CANDIDATES = [
11
11
  ];
12
12
  const TEMPAD_MCP_BRIDGE_SUBPROTOCOL = "tempad-mcp";
13
13
  const TEMPAD_MCP_BRIDGE_SUPPORTED_PROTOCOL_VERSIONS = [13];
14
- const MCP_MAX_PAYLOAD_BYTES = 4 * 1024 * 1024;
15
- const MCP_TOOL_INLINE_BUDGET_BYTES = 64 * 1024;
16
- const MCP_APPLY_CANVAS_RUNTIME_BUDGET_BYTES = 2 * 1024;
14
+ const MCP_MAX_PAYLOAD_BYTES = 4194304;
15
+ const MCP_TOOL_INLINE_BUDGET_BYTES = 65536;
16
+ const MCP_APPLY_CANVAS_RUNTIME_BUDGET_BYTES = 2048;
17
17
  const MCP_TOOL_TIMEOUT_MS = 15e3;
18
18
  const MCP_GET_CODE_TIMEOUT_MS = 3e4;
19
+ const MCP_GET_DESIGN_SYSTEM_TIMEOUT_MS = 45e3;
19
20
  const MCP_APPLY_CANVAS_TIMEOUT_MS = 12e4;
20
21
  const MCP_AUTO_ACTIVATE_GRACE_MS = 1500;
21
- const MCP_MAX_ASSET_BYTES = 8 * 1024 * 1024;
22
- const MCP_MAX_ASSET_STORE_BYTES = 256 * 1024 * 1024;
23
- const MCP_ASSET_TTL_MS = 720 * 60 * 60 * 1e3;
22
+ const MCP_MAX_ASSET_BYTES = 8388608;
23
+ const MCP_MAX_ASSET_STORE_BYTES = 268435456;
24
+ const MCP_ASSET_TTL_MS = 2592e6;
24
25
  const MCP_HASH_PATTERN = new RegExp(`^(?:[a-f0-9]{64}|[a-f0-9]{8})$`);
25
- const MCP_DESIGN_TASK_LEASE_MS = 5 * 6e4;
26
+ const MCP_DESIGN_TASK_LEASE_MS = 3e5;
26
27
  const DesignTaskIdSchema = z.string().min(1).max(128);
27
28
  const DesignTaskParameterSchema = DesignTaskIdSchema.describe("Task id returned by begin_design. Pass it on every call belonging to that design task; omit for independent reads.").optional();
28
29
  const FigmaSessionSchema = z.object({
@@ -503,14 +504,6 @@ function pluginCliAction(agent) {
503
504
  value: buildPluginSetupCommand(agent)
504
505
  };
505
506
  }
506
- /**
507
- * Only the desktop app gets a deep link: it can run the install itself. Terminal clients read the
508
- * command directly instead of having an agent relay it.
509
- */
510
- function buildCodexAppDeepLink() {
511
- const prompt = `Install the TemPad Dev plugin using the native marketplace command below, then confirm that its MCP server and figma-design-to-code and figma-canvas-authoring skills are available.\n\n${buildPluginSetupCommand("codex")}`;
512
- return `codex://new?prompt=${encodeURIComponent(prompt)}`;
513
- }
514
507
  function buildSkillsInstallCommand(agent) {
515
508
  return `${SKILLS_INSTALL_COMMAND} --global --agent ${agent}`;
516
509
  }
@@ -585,23 +578,18 @@ const AGENT_INTEGRATIONS_BY_ID = {
585
578
  codex: {
586
579
  id: "codex",
587
580
  name: "Codex",
588
- actions: [{
589
- id: "plugin-app",
590
- label: "App install",
591
- kind: "deep-link",
592
- value: buildCodexAppDeepLink()
593
- }, pluginCliAction("codex")]
594
- },
595
- cursor: {
596
- id: "cursor",
597
- name: "Cursor",
598
- actions: [pluginCliAction("cursor")]
581
+ actions: [pluginCliAction("codex")]
599
582
  },
600
583
  claude: {
601
584
  id: "claude",
602
585
  name: "Claude Code",
603
586
  actions: [pluginCliAction("claude-code")]
604
587
  },
588
+ cursor: {
589
+ id: "cursor",
590
+ name: "Cursor",
591
+ actions: [pluginCliAction("cursor")]
592
+ },
605
593
  gemini: {
606
594
  id: "gemini",
607
595
  name: "Gemini",
@@ -792,6 +780,7 @@ function buildGetCodeToolResult(payload) {
792
780
  return buildTextToolResult(summary.join("\n"), payload);
793
781
  }
794
782
  function buildGetDesignSystemToolResult(payload) {
783
+ if ("scope" in payload && payload.scope === "pages") return buildTextToolResult(`Returned ${formatCount(payload.pages.length, "Figma page")}.${payload.nextCursor === void 0 ? "" : ` Continue the page list with cursor ${payload.nextCursor}.`} Use an exact pageId to limit component discovery when only that page is relevant.`, payload);
795
784
  if ("scope" in payload) return buildTextToolResult(`Returned ${payload.fonts?.length ?? payload.families?.length ?? 0} available font ${payload.fonts ? "faces" : "families"}.${payload.nextCursor === void 0 ? "" : ` Continue with the same font filters and cursor ${payload.nextCursor}.`} Availability does not establish glyph coverage; verify rendered text.`, payload);
796
785
  if (payload.details) return buildTextToolResult(`Returned bounded ${payload.details.kind} definition ${payload.details.ref} from catalog ${payload.catalogId}.`, payload);
797
786
  return buildTextToolResult(`${`Returned ${formatCount(payload.components.length, "component")}, ${formatCount(payload.variables.length, "variable")}, ${formatCount(payload.styles.length, "style")}, ${formatCount(payload.collections.length, "collection")}, and ${formatCount(payload.shaders?.length ?? 0, "shader")} from catalog ${payload.catalogId}.`}${payload.warnings?.length ? `\n${payload.warnings.join("\n")}` : ""}\nRead structuredContent for deterministic short refs and component tags.${payload.nextCursor === void 0 ? "" : ` Continue this catalog with cursor ${payload.nextCursor} to inspect omitted resources.`} Read one bounded definition with this catalogId and a returned ref.`, payload);
@@ -884,8 +873,8 @@ function countOutlineNodes(nodes) {
884
873
  }
885
874
  function formatBytes(bytes) {
886
875
  if (bytes < 1024) return `${bytes} B`;
887
- if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
888
- return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
876
+ if (bytes < 1048576) return `${(bytes / 1024).toFixed(1)} KB`;
877
+ return `${(bytes / 1048576).toFixed(1)} MB`;
889
878
  }
890
879
  function formatCount(count, singular, plural = `${singular}s`) {
891
880
  return `${count} ${count === 1 ? singular : plural}`;
@@ -1921,7 +1910,7 @@ const CanvasAssetHashSchema = z.string().regex(MCP_HASH_PATTERN);
1921
1910
  const CanvasAssetSchema = z.union([
1922
1911
  z.object({
1923
1912
  type: z.literal("SVG"),
1924
- svg: z.string().min(1).max(32 * 1024)
1913
+ svg: z.string().min(1).max(32768)
1925
1914
  }).strict(),
1926
1915
  z.object({
1927
1916
  type: z.literal("SVG"),
@@ -1932,7 +1921,7 @@ const CanvasAssetSchema = z.union([
1932
1921
  assetHash: CanvasAssetHashSchema
1933
1922
  }).strict()
1934
1923
  ]);
1935
- const CanvasAssetsSchema = z.record(CanvasStableKeySchema, CanvasAssetSchema).refine((assets) => Object.keys(assets).length <= 32, { message: "Canvas assets may contain at most 32 entries." }).refine((assets) => Object.values(assets).reduce((bytes, asset) => bytes + ("svg" in asset ? new TextEncoder().encode(asset.svg).byteLength : 0), 0) <= 64 * 1024, { message: "Inline SVG assets may contain at most 64 KiB in total." });
1924
+ const CanvasAssetsSchema = z.record(CanvasStableKeySchema, CanvasAssetSchema).refine((assets) => Object.keys(assets).length <= 32, { message: "Canvas assets may contain at most 32 entries." }).refine((assets) => Object.values(assets).reduce((bytes, asset) => bytes + ("svg" in asset ? new TextEncoder().encode(asset.svg).byteLength : 0), 0) <= 65536, { message: "Inline SVG assets may contain at most 64 KiB in total." });
1936
1925
  const CanvasNativeBindingSchema = z.object({
1937
1926
  component: z.object({ id: z.string().min(1) }).strict().describe("Exact live component or component-set id from prior canvas work.").optional(),
1938
1927
  componentProperties: z.record(z.string().min(1), CanvasComponentPropertyValueSchema).describe("Values keyed by an exact Figma property name or a TemPad-authored stable key.").optional(),
@@ -2105,6 +2094,7 @@ const ApplyCanvasResultSchema = z.object({
2105
2094
  path: ["rootRemoved"]
2106
2095
  });
2107
2096
  });
2097
+ const ExactReadSessionParameterSchema = z.string().min(1).describe("Exact sessionId from list_design_sessions; omit for the active badge target.").optional();
2108
2098
  const AssetDescriptorSchema = z.object({
2109
2099
  hash: z.string().regex(MCP_HASH_PATTERN),
2110
2100
  url: z.string().url(),
@@ -2121,6 +2111,7 @@ const AssetDescriptorSchema = z.object({
2121
2111
  const GetCodeParametersSchema = z.object({
2122
2112
  taskId: DesignTaskParameterSchema,
2123
2113
  taskEpoch: DesignTaskEpochSchema,
2114
+ sessionId: ExactReadSessionParameterSchema,
2124
2115
  nodeId: z.string().describe("Optional exact target node id; omit to use the current single selection.").optional(),
2125
2116
  preferredLang: z.enum(["jsx", "vue"]).describe("Preferred output language to bias the snapshot; otherwise uses the design’s hint/detected language, then falls back to JSX.").optional(),
2126
2117
  resolveTokens: z.boolean().describe("Inline token values instead of references for quick renders; default false returns token metadata plus bounded repeated-unbound-color diagnostics so you can reconcile the theming system. When true, values are resolved per-node (mode-aware) and literal diagnostics are omitted.").optional(),
@@ -2129,17 +2120,20 @@ const GetCodeParametersSchema = z.object({
2129
2120
  const GetTokenDefsParametersSchema = z.object({
2130
2121
  taskId: DesignTaskParameterSchema,
2131
2122
  taskEpoch: DesignTaskEpochSchema,
2123
+ sessionId: ExactReadSessionParameterSchema,
2132
2124
  names: z.array(z.string().regex(/^--[a-zA-Z0-9-_]+$/)).min(1).describe("Canonical token names (CSS variable form) from Object.keys(get_code.tokens) or your own list to resolve, e.g., --color-primary."),
2133
2125
  includeAllModes: z.boolean().describe("Include all token modes (light/dark/etc.) instead of just the active one to mirror responsive tokens; default false.").optional()
2134
2126
  });
2135
2127
  const GetScreenshotParametersSchema = z.object({
2136
2128
  taskId: DesignTaskParameterSchema,
2137
2129
  taskEpoch: DesignTaskEpochSchema,
2130
+ sessionId: ExactReadSessionParameterSchema,
2138
2131
  nodeId: z.string().describe("Optional exact node id to render; omit to use the current single selection.").optional()
2139
2132
  });
2140
2133
  const GetStructureParametersSchema = z.object({
2141
2134
  taskId: DesignTaskParameterSchema,
2142
2135
  taskEpoch: DesignTaskEpochSchema,
2136
+ sessionId: ExactReadSessionParameterSchema,
2143
2137
  nodeId: z.string().describe("Optional node id to outline; defaults to the current single selection when no page identity is supplied.").optional(),
2144
2138
  pageId: z.string().min(1).describe("Exact local page id to outline.").optional(),
2145
2139
  pageKey: CanvasStableKeySchema.describe("Exact stable key of a local page authored through apply_canvas.").optional(),
@@ -2161,11 +2155,17 @@ const GetStructureParametersSchema = z.object({
2161
2155
  const GetDesignSystemParametersSchema = z.object({
2162
2156
  taskId: DesignTaskParameterSchema,
2163
2157
  taskEpoch: DesignTaskEpochSchema,
2164
- scope: z.enum(["resources", "fonts"]).optional(),
2158
+ sessionId: ExactReadSessionParameterSchema,
2159
+ scope: z.enum([
2160
+ "resources",
2161
+ "fonts",
2162
+ "pages"
2163
+ ]).optional(),
2164
+ pageId: z.string().min(1).describe("Load this exact page and limit component discovery to it; local file-wide resources remain included.").optional(),
2165
2165
  query: z.string().trim().min(1).max(100).describe("Case-insensitive font-family search.").optional(),
2166
2166
  families: z.array(z.string().min(1)).min(1).max(8).describe("Exact font families to inspect for available native style names.").optional(),
2167
2167
  catalogId: z.string().min(1).describe("Catalog returned by an earlier discovery call.").optional(),
2168
- cursor: z.number().int().nonnegative().describe("Continuation cursor from the same catalog, or font query with the same filters.").optional(),
2168
+ cursor: z.number().int().nonnegative().describe("Continuation cursor for a catalog, font query, or page list.").optional(),
2169
2169
  ref: z.string().min(1).describe("Exact resource ref from the same catalog.").optional()
2170
2170
  }).strict().superRefine((value, context) => {
2171
2171
  const issue = (message, path) => context.addIssue({
@@ -2173,8 +2173,13 @@ const GetDesignSystemParametersSchema = z.object({
2173
2173
  message,
2174
2174
  path: [path]
2175
2175
  });
2176
+ if (value.scope === "pages") {
2177
+ if (value.catalogId || value.ref || value.pageId || value.query || value.families) issue("Page listing accepts only scope and cursor.", "pageId");
2178
+ return;
2179
+ }
2176
2180
  if (value.scope === "fonts") {
2177
2181
  if (value.catalogId || value.ref) issue("Font queries cannot use resource catalog refs.", "catalogId");
2182
+ if (value.pageId) issue("Font queries cannot use a component page.", "pageId");
2178
2183
  if (value.query && value.families) issue("Use query or families, not both.", "query");
2179
2184
  return;
2180
2185
  }
@@ -2185,6 +2190,7 @@ const GetDesignSystemParametersSchema = z.object({
2185
2190
  return;
2186
2191
  }
2187
2192
  if (value.cursor === void 0 === (value.ref === void 0)) issue("Catalog reuse requires exactly one of cursor or ref.", "catalogId");
2193
+ if (value.pageId) issue("A component page cannot be changed within a catalog.", "pageId");
2188
2194
  });
2189
2195
  const DesignSystemCatalogPropertySchema = z.object({
2190
2196
  type: z.enum([
@@ -2291,7 +2297,22 @@ const DesignSystemFontsResultSchema = z.object({
2291
2297
  missingFamilies: z.array(z.string()).optional(),
2292
2298
  nextCursor: z.number().int().nonnegative().optional()
2293
2299
  }).strict().refine((value) => value.families === void 0 !== (value.fonts === void 0), "A font result requires either families or fonts.");
2294
- const GetDesignSystemResultSchema = z.union([DesignSystemResourcesResultSchema, DesignSystemFontsResultSchema]);
2300
+ const DesignSystemPagesResultSchema = z.object({
2301
+ scope: z.literal("pages"),
2302
+ pages: z.array(z.object({
2303
+ id: z.string().min(1),
2304
+ name: z.string(),
2305
+ index: z.number().int().nonnegative(),
2306
+ active: z.boolean(),
2307
+ isPageDivider: z.boolean().optional()
2308
+ }).strict()),
2309
+ nextCursor: z.number().int().nonnegative().optional()
2310
+ }).strict();
2311
+ const GetDesignSystemResultSchema = z.union([
2312
+ DesignSystemResourcesResultSchema,
2313
+ DesignSystemFontsResultSchema,
2314
+ DesignSystemPagesResultSchema
2315
+ ]);
2295
2316
  const GetAssetsParametersSchema = z.object({
2296
2317
  taskId: DesignTaskParameterSchema,
2297
2318
  taskEpoch: DesignTaskEpochSchema,
@@ -2372,7 +2393,7 @@ function bindRequestMetadata(binding, meta) {
2372
2393
  //#region package.json
2373
2394
  var package_default = {
2374
2395
  name: "@tempad-dev/mcp",
2375
- version: "0.8.0",
2396
+ version: "0.9.0",
2376
2397
  description: "Connect coding agents to Figma for design inspection, native canvas editing, and UI implementation.",
2377
2398
  license: "MIT",
2378
2399
  repository: {
@@ -2406,17 +2427,17 @@ var package_default = {
2406
2427
  "pino-pretty": "^13.1.3",
2407
2428
  "proper-lockfile": "^4.1.2",
2408
2429
  "ws": "^8.21.3",
2409
- "zod": "^4.5.4"
2430
+ "zod": "^4.6.5"
2410
2431
  },
2411
2432
  devDependencies: {
2412
2433
  "@tempad-dev/shared": "workspace:^0.1.0",
2413
- "@types/node": "^24.13.3",
2434
+ "@types/node": "^24.13.4",
2414
2435
  "@types/proper-lockfile": "^4.1.4",
2415
2436
  "@types/ws": "^8.18.1",
2416
- "tsdown": "^0.22.14",
2437
+ "tsdown": "^0.23.0",
2417
2438
  "typescript": "^6.0.3",
2418
2439
  "unplugin-raw": "^0.8.0",
2419
- "vitest": "4.1.11"
2440
+ "vitest": "5.0.0"
2420
2441
  },
2421
2442
  engines: { "node": "^22 || ^24 || >=26" }
2422
2443
  };
@@ -2461,7 +2482,8 @@ ensureDir(RUNTIME_DIR);
2461
2482
  ensureDir(LOG_DIR);
2462
2483
  ensureDir(ASSET_DIR);
2463
2484
  function ensureFile(filePath) {
2464
- closeSync(openSync(filePath, "a"));
2485
+ const fd = openSync(filePath, "a");
2486
+ closeSync(fd);
2465
2487
  }
2466
2488
  const LOCK_PATH = join(RUNTIME_DIR, "mcp.lock");
2467
2489
  const HUB_LOCK_PATH = join(RUNTIME_DIR, "hub.lock");
@@ -2486,6 +2508,6 @@ const log = pino({
2486
2508
  }, prettyTransport);
2487
2509
  const SOCK_PATH = resolveSockPath();
2488
2510
  //#endregion
2489
- export { TEMPAD_MCP_BRIDGE_SUBPROTOCOL as $, GetDesignSystemParametersSchema as A, MCP_AUTO_ACTIVATE_GRACE_MS as B, DesignTaskIdSchema as C, GetAssetsParametersSchema as D, FigmaSessionSchema as E, LegacyMessageFromExtensionSchema as F, MCP_MAX_PAYLOAD_BYTES as G, MCP_GET_CODE_TIMEOUT_MS as H, LegacyToolCallPayloadSchema as I, MCP_TOOL_TIMEOUT_MS as J, MCP_PORT_CANDIDATES as K, MCP_APPLY_CANVAS_RUNTIME_BUDGET_BYTES as L, GetScreenshotParametersSchema as M, GetStructureParametersSchema as N, GetAssetsResultSchema as O, GetTokenDefsParametersSchema as P, SetDesignAnchorParametersSchema as Q, MCP_APPLY_CANVAS_TIMEOUT_MS as R, DesignAnchorSchema as S, EndDesignParametersSchema as T, MCP_MAX_ASSET_BYTES as U, MCP_DESIGN_TASK_LEASE_MS as V, MCP_MAX_ASSET_STORE_BYTES as W, RESUMABLE_DESIGN_TASK_STATUSES as X, MessageFromExtensionSchema as Y, ResumeDesignParametersSchema as Z, runtimeIdentity as _, HUB_RUNTIME_IDENTITY_PATH as a, buildGetAssetsToolResult as at, ApplyCanvasResultSchema as b, RUNTIME_DIR as c, buildGetScreenshotToolResult as ct, ensureFile as d, buildUploadAssetToolResult as dt, TEMPAD_MCP_BRIDGE_SUPPORTED_PROTOCOL_VERSIONS as et, getRecordProperty as f, formatDesignFeedback as ft, clientDescriptor as g, bindRequestMetadata as h, HUB_LOCK_UPDATE_MS as i, buildApplyCanvasToolResult as it, GetDesignSystemResultSchema as j, GetCodeParametersSchema as k, SOCK_PATH as l, buildGetStructureToolResult as lt, ClientEventSchema as m, utf8Bytes as mt, HUB_LOCK_PATH as n, UploadAssetParametersSchema as nt, LOCK_PATH as o, buildGetCodeToolResult as ot, log as p, measureCallToolResultBytes as pt, MCP_TOOL_INLINE_BUDGET_BYTES as q, HUB_LOCK_STALE_MS as r, UploadAssetResultSchema as rt, PACKAGE_VERSION as s, buildGetDesignSystemToolResult as st, ASSET_DIR as t, TEMPAD_MCP_ERROR_CODES as tt, ensureDir as u, buildGetTokenDefsToolResult as ut, AGENT_CLIENTS as v, DesignTaskSchema as w, BeginDesignParametersSchema as x, ApplyCanvasParametersSchema as y, MCP_ASSET_TTL_MS as z };
2511
+ export { SetDesignAnchorParametersSchema as $, GetDesignSystemParametersSchema as A, MCP_AUTO_ACTIVATE_GRACE_MS as B, DesignTaskIdSchema as C, GetAssetsParametersSchema as D, FigmaSessionSchema as E, LegacyMessageFromExtensionSchema as F, MCP_MAX_ASSET_STORE_BYTES as G, MCP_GET_CODE_TIMEOUT_MS as H, LegacyToolCallPayloadSchema as I, MCP_TOOL_INLINE_BUDGET_BYTES as J, MCP_MAX_PAYLOAD_BYTES as K, MCP_APPLY_CANVAS_RUNTIME_BUDGET_BYTES as L, GetScreenshotParametersSchema as M, GetStructureParametersSchema as N, GetAssetsResultSchema as O, GetTokenDefsParametersSchema as P, ResumeDesignParametersSchema as Q, MCP_APPLY_CANVAS_TIMEOUT_MS as R, DesignAnchorSchema as S, EndDesignParametersSchema as T, MCP_GET_DESIGN_SYSTEM_TIMEOUT_MS as U, MCP_DESIGN_TASK_LEASE_MS as V, MCP_MAX_ASSET_BYTES as W, MessageFromExtensionSchema as X, MCP_TOOL_TIMEOUT_MS as Y, RESUMABLE_DESIGN_TASK_STATUSES as Z, runtimeIdentity as _, HUB_RUNTIME_IDENTITY_PATH as a, buildApplyCanvasToolResult as at, ApplyCanvasResultSchema as b, RUNTIME_DIR as c, buildGetDesignSystemToolResult as ct, ensureFile as d, buildGetTokenDefsToolResult as dt, TEMPAD_MCP_BRIDGE_SUBPROTOCOL as et, getRecordProperty as f, buildUploadAssetToolResult as ft, clientDescriptor as g, bindRequestMetadata as h, utf8Bytes as ht, HUB_LOCK_UPDATE_MS as i, UploadAssetResultSchema as it, GetDesignSystemResultSchema as j, GetCodeParametersSchema as k, SOCK_PATH as l, buildGetScreenshotToolResult as lt, ClientEventSchema as m, measureCallToolResultBytes as mt, HUB_LOCK_PATH as n, TEMPAD_MCP_ERROR_CODES as nt, LOCK_PATH as o, buildGetAssetsToolResult as ot, log as p, formatDesignFeedback as pt, MCP_PORT_CANDIDATES as q, HUB_LOCK_STALE_MS as r, UploadAssetParametersSchema as rt, PACKAGE_VERSION as s, buildGetCodeToolResult as st, ASSET_DIR as t, TEMPAD_MCP_BRIDGE_SUPPORTED_PROTOCOL_VERSIONS as tt, ensureDir as u, buildGetStructureToolResult as ut, AGENT_CLIENTS as v, DesignTaskSchema as w, BeginDesignParametersSchema as x, ApplyCanvasParametersSchema as y, MCP_ASSET_TTL_MS as z };
2490
2512
 
2491
- //# sourceMappingURL=shared--YD93aQ6.mjs.map
2513
+ //# sourceMappingURL=shared-8rz2qWXn.mjs.map