@atomixstudio/mcp 1.0.28 → 1.0.29

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/dist/index.js CHANGED
@@ -1289,6 +1289,9 @@ function getTokenStats(data) {
1289
1289
  }
1290
1290
 
1291
1291
  // src/index.ts
1292
+ import {
1293
+ buildFigmaPayloadsFromDS
1294
+ } from "@atomix/figma_tools";
1292
1295
  import * as path2 from "path";
1293
1296
  import * as fs2 from "fs";
1294
1297
  import { execSync } from "child_process";
@@ -1465,373 +1468,6 @@ function sendBridgeRequest(method, params, timeoutMs = FIGMA_BRIDGE_TIMEOUT_MS)
1465
1468
  }
1466
1469
  });
1467
1470
  }
1468
- function figmaColorNameWithGroup(key) {
1469
- if (key.includes("/")) {
1470
- const [group2, ...rest] = key.split("/");
1471
- const name2 = rest.join("/").trim();
1472
- if (!name2) return key;
1473
- const groupDisplay2 = group2.charAt(0).toUpperCase() + group2.slice(1).toLowerCase();
1474
- return `${groupDisplay2} / ${name2}`;
1475
- }
1476
- const firstDash = key.indexOf("-");
1477
- if (firstDash <= 0) return key;
1478
- const group = key.slice(0, firstDash);
1479
- const name = key.slice(firstDash + 1);
1480
- const groupDisplay = group.charAt(0).toUpperCase() + group.slice(1).toLowerCase();
1481
- return `${groupDisplay} / ${name}`;
1482
- }
1483
- var FIGMA_SHADOW_ORDER = {
1484
- none: 0,
1485
- xs: 1,
1486
- sm: 2,
1487
- md: 3,
1488
- lg: 4,
1489
- xl: 5,
1490
- "2xl": 6,
1491
- focus: 7
1492
- };
1493
- function tokenValueToNumber(s) {
1494
- if (typeof s !== "string" || !s.trim()) return 0;
1495
- const t = s.trim();
1496
- if (t.endsWith("rem")) {
1497
- const n2 = parseFloat(t.replace(/rem$/, ""));
1498
- return Number.isFinite(n2) ? Math.round(n2 * 16) : 0;
1499
- }
1500
- if (t.endsWith("px")) {
1501
- const n2 = parseFloat(t.replace(/px$/, ""));
1502
- return Number.isFinite(n2) ? Math.round(n2) : 0;
1503
- }
1504
- const n = parseFloat(t);
1505
- return Number.isFinite(n) ? n : 0;
1506
- }
1507
- function parseBoxShadowToFigmaEffect(shadowStr) {
1508
- const s = shadowStr.trim();
1509
- if (!s || s.toLowerCase() === "none") return null;
1510
- const parsePx = (x) => typeof x === "string" ? parseFloat(x.replace(/px$/i, "")) : NaN;
1511
- const colorMatch = s.match(/(rgba?\s*\([^)]+\)|#[0-9A-Fa-f]{3,8})\s*$/i);
1512
- const colorStr = colorMatch ? colorMatch[1].trim() : void 0;
1513
- const rest = (colorMatch ? s.slice(0, colorMatch.index) : s).trim();
1514
- const parts = rest ? rest.split(/\s+/) : [];
1515
- if (parts.length < 3) return null;
1516
- const offsetX = parsePx(parts[0]);
1517
- const offsetY = parsePx(parts[1]);
1518
- const blur = parsePx(parts[2]);
1519
- let spread = 0;
1520
- if (parts.length >= 4) spread = parsePx(parts[3]);
1521
- let r = 0, g = 0, b = 0, a = 0.1;
1522
- if (colorStr) {
1523
- const rgbaMatch = colorStr.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+)\s*)?\)/i);
1524
- if (rgbaMatch) {
1525
- r = Number(rgbaMatch[1]) / 255;
1526
- g = Number(rgbaMatch[2]) / 255;
1527
- b = Number(rgbaMatch[3]) / 255;
1528
- a = rgbaMatch[4] != null ? parseFloat(rgbaMatch[4]) : 1;
1529
- } else {
1530
- const hexMatch = colorStr.match(/^#?([0-9A-Fa-f]{6})([0-9A-Fa-f]{2})?$/);
1531
- if (hexMatch) {
1532
- r = parseInt(hexMatch[1].slice(0, 2), 16) / 255;
1533
- g = parseInt(hexMatch[1].slice(2, 4), 16) / 255;
1534
- b = parseInt(hexMatch[1].slice(4, 6), 16) / 255;
1535
- a = hexMatch[2] ? parseInt(hexMatch[2], 16) / 255 : 0.1;
1536
- }
1537
- }
1538
- }
1539
- if (!Number.isFinite(offsetX) || !Number.isFinite(offsetY) || !Number.isFinite(blur)) return null;
1540
- return {
1541
- type: "DROP_SHADOW",
1542
- offset: { x: offsetX, y: offsetY },
1543
- radius: Math.max(0, blur),
1544
- spread: Number.isFinite(spread) ? spread : 0,
1545
- color: { r, g, b, a },
1546
- visible: true,
1547
- blendMode: "NORMAL"
1548
- };
1549
- }
1550
- function parseBoxShadowToFigmaEffects(shadowStr) {
1551
- const s = (shadowStr || "").trim();
1552
- if (!s || s.toLowerCase() === "none") return [];
1553
- const out = [];
1554
- const segments = s.split(/\s*,\s*/);
1555
- for (const seg of segments) {
1556
- const effect = parseBoxShadowToFigmaEffect(seg.trim());
1557
- if (effect) out.push(effect);
1558
- }
1559
- return out;
1560
- }
1561
- function buildFigmaPayloadsFromDS(data) {
1562
- const tokens = data.tokens;
1563
- const colors = tokens?.colors;
1564
- const typography = tokens?.typography;
1565
- const modes = [];
1566
- const variables = [];
1567
- const paintStyles = [];
1568
- const hexRe = /^#?[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$/;
1569
- const addedNames = /* @__PURE__ */ new Set();
1570
- if (colors?.modes) {
1571
- const light = colors.modes.light ?? {};
1572
- const dark = colors.modes.dark ?? {};
1573
- if (Object.keys(light).length > 0) modes.push("Light");
1574
- if (Object.keys(dark).length > 0 && !modes.includes("Dark")) modes.push("Dark");
1575
- if (modes.length === 0) modes.push("Light");
1576
- const orderedKeys = [...Object.keys(light)];
1577
- for (const k of Object.keys(dark)) {
1578
- if (!orderedKeys.includes(k)) orderedKeys.push(k);
1579
- }
1580
- for (const key of orderedKeys) {
1581
- const lightHex = light[key];
1582
- const darkHex = dark[key];
1583
- if (typeof lightHex === "string" && hexRe.test(lightHex)) {
1584
- const figmaName = figmaColorNameWithGroup(key);
1585
- if (addedNames.has(figmaName)) continue;
1586
- addedNames.add(figmaName);
1587
- const values = {};
1588
- if (modes.includes("Light")) values.Light = lightHex;
1589
- if (modes.includes("Dark")) values.Dark = typeof darkHex === "string" && hexRe.test(darkHex) ? darkHex : lightHex;
1590
- variables.push({ name: figmaName, values });
1591
- paintStyles.push({ name: figmaName, color: lightHex });
1592
- }
1593
- }
1594
- }
1595
- if (colors?.static?.brand && typeof colors.static.brand === "object") {
1596
- for (const [key, hex] of Object.entries(colors.static.brand)) {
1597
- if (typeof hex !== "string" || !hexRe.test(hex)) continue;
1598
- const figmaName = figmaColorNameWithGroup(`brand/${key}`);
1599
- if (addedNames.has(figmaName)) continue;
1600
- addedNames.add(figmaName);
1601
- paintStyles.push({ name: figmaName, color: hex });
1602
- if (modes.length === 0) modes.push("Light");
1603
- const values = {};
1604
- for (const m of modes) values[m] = hex;
1605
- variables.push({ name: figmaName, values });
1606
- }
1607
- }
1608
- if (variables.length === 0 && modes.length === 0) modes.push("Light");
1609
- const dsName = data.meta?.name;
1610
- const collectionPrefix = dsName ? `${dsName} ` : "";
1611
- const colorCollectionName = `${collectionPrefix}Colors`;
1612
- const textStyles = [];
1613
- const sizeToPx = (val, basePx = 16) => {
1614
- if (typeof val === "number") return Math.round(val);
1615
- const s = String(val).trim();
1616
- const pxMatch = s.match(/^([\d.]+)\s*px$/i);
1617
- if (pxMatch) return Math.round(parseFloat(pxMatch[1]));
1618
- const remMatch = s.match(/^([\d.]+)\s*rem$/i);
1619
- if (remMatch) return Math.round(parseFloat(remMatch[1]) * basePx);
1620
- const n = parseFloat(s);
1621
- if (Number.isFinite(n)) return n <= 0 ? basePx : n < 50 ? Math.round(n * basePx) : Math.round(n);
1622
- return basePx;
1623
- };
1624
- const letterSpacingToPx = (val, fontSizePx) => {
1625
- if (val === void 0 || val === null) return void 0;
1626
- if (typeof val === "number") return Math.round(val);
1627
- const s = String(val).trim();
1628
- const pxMatch = s.match(/^([-\d.]+)\s*px$/i);
1629
- if (pxMatch) return Math.round(parseFloat(pxMatch[1]));
1630
- const emMatch = s.match(/^([-\d.]+)\s*em$/i);
1631
- if (emMatch) return Math.round(parseFloat(emMatch[1]) * fontSizePx);
1632
- const n = parseFloat(s);
1633
- return Number.isFinite(n) ? Math.round(n) : void 0;
1634
- };
1635
- const firstFont = (obj) => {
1636
- if (typeof obj === "string") {
1637
- const primary = obj.split(",")[0].trim().replace(/^['"]|['"]$/g, "");
1638
- return primary || "Inter";
1639
- }
1640
- if (obj && typeof obj === "object" && !Array.isArray(obj)) {
1641
- const v = obj.body ?? obj.heading ?? obj.display ?? Object.values(obj)[0];
1642
- return firstFont(v);
1643
- }
1644
- return "Inter";
1645
- };
1646
- const toFontFamilyString = (val) => {
1647
- if (typeof val === "string") {
1648
- const s = val.trim().replace(/^["']|["']$/g, "");
1649
- return s || "Inter";
1650
- }
1651
- return firstFont(val);
1652
- };
1653
- const fontFamilyMap = typography?.fontFamily ?? {};
1654
- const defaultFontFamily = typography ? firstFont(typography.fontFamily ?? "Inter") : "Inter";
1655
- const fontSizeMap = typography?.fontSize;
1656
- const fontWeightMap = typography?.fontWeight;
1657
- const lineHeightMap = typography?.lineHeight;
1658
- const letterSpacingMap = typography?.letterSpacing;
1659
- const textTransformMap = typography?.textTransform;
1660
- const textDecorationMap = typography?.textDecoration;
1661
- if (fontSizeMap && typeof fontSizeMap === "object" && Object.keys(fontSizeMap).length > 0) {
1662
- for (const [key, sizeVal] of Object.entries(fontSizeMap)) {
1663
- const fontSize = sizeToPx(sizeVal);
1664
- if (fontSize <= 0) continue;
1665
- const role = typesetKeyToFontFamilyRole(key);
1666
- const fontFamily = toFontFamilyString(
1667
- fontFamilyMap[role] ?? fontFamilyMap.body ?? fontFamilyMap.heading ?? fontFamilyMap.display ?? defaultFontFamily
1668
- );
1669
- const lh = lineHeightMap && typeof lineHeightMap === "object" ? lineHeightMap[key] : void 0;
1670
- const weight = fontWeightMap && typeof fontWeightMap === "object" ? fontWeightMap[key] : void 0;
1671
- const fontWeight = weight != null ? String(weight) : "400";
1672
- const letterSpacingPx = letterSpacingToPx(
1673
- letterSpacingMap && typeof letterSpacingMap === "object" ? letterSpacingMap[key] : void 0,
1674
- fontSize
1675
- );
1676
- const textTransform = textTransformMap && typeof textTransformMap === "object" ? textTransformMap[key] : void 0;
1677
- const textDecoration = textDecorationMap && typeof textDecorationMap === "object" ? textDecorationMap[key] : void 0;
1678
- const namePart = key.replace(/-/g, " / ");
1679
- const style = {
1680
- name: namePart.startsWith("Typography") ? namePart : `Typography / ${namePart}`,
1681
- fontFamily,
1682
- fontWeight,
1683
- fontSize,
1684
- lineHeightUnit: "PERCENT",
1685
- letterSpacingUnit: "PIXELS",
1686
- ...letterSpacingPx !== void 0 && letterSpacingPx !== 0 ? { letterSpacingValue: letterSpacingPx } : {}
1687
- };
1688
- if (lh != null && typeof lh === "number" && lh > 0) {
1689
- style.lineHeightValue = lh >= 10 ? Math.round(lh / fontSize * 100) : Math.round(lh * 100);
1690
- } else {
1691
- style.lineHeightValue = 150;
1692
- }
1693
- if (textTransform === "uppercase") style.textCase = "UPPER";
1694
- else if (textTransform === "lowercase") style.textCase = "LOWER";
1695
- else if (textTransform === "capitalize") style.textCase = "TITLE";
1696
- else style.textCase = "ORIGINAL";
1697
- if (textDecoration === "underline") style.textDecoration = "UNDERLINE";
1698
- else style.textDecoration = "NONE";
1699
- textStyles.push(style);
1700
- }
1701
- }
1702
- const textStylesMap = typography?.textStyles;
1703
- if (textStyles.length === 0 && textStylesMap && typeof textStylesMap === "object") {
1704
- for (const [styleName, style] of Object.entries(textStylesMap)) {
1705
- if (!style || typeof style !== "object") continue;
1706
- const fontSize = sizeToPx(style.fontSize ?? "1rem");
1707
- const lhStr = style.lineHeight;
1708
- const lineHeightUnitless = lhStr != null ? lhStr.endsWith("%") ? parseFloat(lhStr) / 100 : sizeToPx(lhStr) / fontSize : 1.5;
1709
- const payload = {
1710
- name: styleName.startsWith("Typography") ? styleName : `Typography / ${styleName.replace(/\//g, " / ")}`,
1711
- fontFamily: defaultFontFamily,
1712
- fontWeight: String(style.fontWeight ?? "400"),
1713
- fontSize,
1714
- lineHeightUnit: "PERCENT",
1715
- lineHeightValue: Math.round((Number.isFinite(lineHeightUnitless) ? lineHeightUnitless : 1.5) * 100),
1716
- letterSpacingUnit: "PIXELS",
1717
- textCase: "ORIGINAL",
1718
- textDecoration: "NONE"
1719
- };
1720
- textStyles.push(payload);
1721
- }
1722
- }
1723
- textStyles.sort((a, b) => {
1724
- if (a.fontSize !== b.fontSize) return a.fontSize - b.fontSize;
1725
- return (a.name || "").localeCompare(b.name || "");
1726
- });
1727
- const numberVariableCollections = [];
1728
- const spacing = tokens?.spacing;
1729
- if (spacing?.scale && typeof spacing.scale === "object") {
1730
- const variables2 = [];
1731
- for (const [key, val] of Object.entries(spacing.scale)) {
1732
- const n = tokenValueToNumber(val);
1733
- if (n >= 0) variables2.push({ name: `Spacing / ${key}`, value: n });
1734
- }
1735
- variables2.sort((a, b) => a.value - b.value);
1736
- if (variables2.length > 0) numberVariableCollections.push({ collectionName: `${collectionPrefix}Spacing`, categoryKey: "Spacing", variables: variables2, scopes: ["GAP"] });
1737
- }
1738
- const radius = tokens?.radius;
1739
- if (radius?.scale && typeof radius.scale === "object") {
1740
- const variables2 = [];
1741
- for (const [key, val] of Object.entries(radius.scale)) {
1742
- const n = tokenValueToNumber(val);
1743
- if (n >= 0) variables2.push({ name: `Radius / ${key}`, value: n });
1744
- }
1745
- variables2.sort((a, b) => a.value - b.value);
1746
- if (variables2.length > 0) numberVariableCollections.push({ collectionName: `${collectionPrefix}Radius`, categoryKey: "Radius", variables: variables2, scopes: ["CORNER_RADIUS"] });
1747
- }
1748
- const borders = tokens?.borders;
1749
- if (borders?.width && typeof borders.width === "object") {
1750
- const variables2 = [];
1751
- for (const [key, val] of Object.entries(borders.width)) {
1752
- const n = tokenValueToNumber(val);
1753
- if (n >= 0) variables2.push({ name: `Borders / ${key}`, value: n });
1754
- }
1755
- variables2.sort((a, b) => a.value - b.value);
1756
- if (variables2.length > 0) numberVariableCollections.push({ collectionName: `${collectionPrefix}Borders`, categoryKey: "Borders", variables: variables2, scopes: ["STROKE_FLOAT"] });
1757
- }
1758
- const sizing = tokens?.sizing;
1759
- const sizingVariables = [];
1760
- if (sizing?.height && typeof sizing.height === "object") {
1761
- for (const [key, val] of Object.entries(sizing.height)) {
1762
- const n = tokenValueToNumber(val);
1763
- if (n >= 0) sizingVariables.push({ name: `Height / ${key}`, value: n });
1764
- }
1765
- }
1766
- if (sizing?.icon && typeof sizing.icon === "object") {
1767
- for (const [key, val] of Object.entries(sizing.icon)) {
1768
- const n = tokenValueToNumber(val);
1769
- if (n >= 0) sizingVariables.push({ name: `Icon / ${key}`, value: n });
1770
- }
1771
- }
1772
- sizingVariables.sort((a, b) => a.value - b.value);
1773
- if (sizingVariables.length > 0) {
1774
- numberVariableCollections.push({ collectionName: `${collectionPrefix}Sizing`, categoryKey: "Sizing", variables: sizingVariables, scopes: ["WIDTH_HEIGHT"] });
1775
- }
1776
- const layout = tokens?.layout;
1777
- if (layout?.breakpoint && typeof layout.breakpoint === "object") {
1778
- const variables2 = [];
1779
- for (const [key, val] of Object.entries(layout.breakpoint)) {
1780
- const n = tokenValueToNumber(val);
1781
- if (n >= 0) variables2.push({ name: `Breakpoint / ${key}`, value: n });
1782
- }
1783
- variables2.sort((a, b) => a.value - b.value);
1784
- if (variables2.length > 0) numberVariableCollections.push({ collectionName: `${collectionPrefix}Layout`, categoryKey: "Layout", variables: variables2, scopes: ["WIDTH_HEIGHT"] });
1785
- }
1786
- const effectStyles = [];
1787
- const shadows = tokens?.shadows;
1788
- if (shadows?.elevation && typeof shadows.elevation === "object") {
1789
- for (const [key, val] of Object.entries(shadows.elevation)) {
1790
- if (typeof val !== "string") continue;
1791
- const effects = parseBoxShadowToFigmaEffects(val);
1792
- if (effects.length > 0) {
1793
- effectStyles.push({
1794
- name: `Shadow / ${key}`,
1795
- effects
1796
- });
1797
- }
1798
- }
1799
- }
1800
- if (shadows?.focus && typeof shadows.focus === "string") {
1801
- const effects = parseBoxShadowToFigmaEffects(shadows.focus);
1802
- if (effects.length > 0) {
1803
- effectStyles.push({ name: "Shadow / focus", effects });
1804
- }
1805
- }
1806
- effectStyles.sort((a, b) => {
1807
- const nameA = a.name.startsWith("Shadow / ") ? a.name.slice(9) : a.name;
1808
- const nameB = b.name.startsWith("Shadow / ") ? b.name.slice(9) : b.name;
1809
- const orderA = FIGMA_SHADOW_ORDER[nameA] ?? 100;
1810
- const orderB = FIGMA_SHADOW_ORDER[nameB] ?? 100;
1811
- if (orderA !== orderB) return orderA - orderB;
1812
- return nameA.localeCompare(nameB);
1813
- });
1814
- return {
1815
- colorVariables: { collectionName: colorCollectionName, modes, variables },
1816
- paintStyles,
1817
- textStyles,
1818
- numberVariableCollections,
1819
- effectStyles
1820
- };
1821
- }
1822
- function getExpectedFigmaNamesFromDS(data) {
1823
- const payloads = buildFigmaPayloadsFromDS(data);
1824
- const numberVariableNames = payloads.numberVariableCollections.flatMap(
1825
- (c) => c.variables.map((v) => v.name)
1826
- );
1827
- return {
1828
- colorVariableNames: payloads.colorVariables.variables.map((v) => v.name),
1829
- paintStyleNames: payloads.paintStyles.map((s) => s.name),
1830
- textStyleNames: payloads.textStyles.map((s) => s.name),
1831
- effectStyleNames: payloads.effectStyles.map((s) => s.name),
1832
- numberVariableNames
1833
- };
1834
- }
1835
1471
  function parseArgs() {
1836
1472
  const args = process.argv.slice(2);
1837
1473
  let dsId2 = null;
@@ -1867,21 +1503,6 @@ function hasValidAuthConfig() {
1867
1503
  }
1868
1504
  var AUTH_REQUIRED_MESSAGE = "Atomix MCP requires authentication. Add both --ds-id and --atomix-token to your MCP config (Settings \u2192 MCP), then restart your AI tool. Get your token from Atomix Studio: Export modal or Settings \u2192 Regenerate Atomix access token.";
1869
1505
  var lastChangeSummary = null;
1870
- var FIGMA_SYNC_TOOL_NAME = "syncToFigma";
1871
- var FIGMA_DESIGN_TOOL_NAMES = /* @__PURE__ */ new Set([
1872
- "getFigmaVariablesAndStyles",
1873
- "createDesignPlaceholder",
1874
- "resolveFigmaIdsForTokens",
1875
- "designCreateFrame",
1876
- "designCreateText",
1877
- "designCreateRectangle",
1878
- "designSetAutoLayout",
1879
- "designSetLayoutConstraints",
1880
- "designAppendChild",
1881
- "getDesignScreenshot",
1882
- "finalizeDesignFrame"
1883
- ]);
1884
- var FIGMA_TOOL_NAMES = /* @__PURE__ */ new Set([FIGMA_SYNC_TOOL_NAME, ...FIGMA_DESIGN_TOOL_NAMES]);
1885
1506
  var lastSyncAffectedTokens = null;
1886
1507
  function getLastChangeSummary() {
1887
1508
  return lastChangeSummary;
@@ -1998,7 +1619,7 @@ function buildTypesetsList(typography, cssPrefix = "atmx") {
1998
1619
  var server = new Server(
1999
1620
  {
2000
1621
  name: "atomix-mcp-user",
2001
- version: "1.0.27"
1622
+ version: "1.0.28"
2002
1623
  },
2003
1624
  {
2004
1625
  capabilities: {
@@ -2018,11 +1639,9 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
2018
1639
  try {
2019
1640
  await fetchDesignSystemForMCP(true);
2020
1641
  if (cachedMcpTier === "pro") {
2021
- console.error("[Atomix MCP] Resolved tier = pro. Figma sync/design tools are available.");
1642
+ console.error("[Atomix MCP] Resolved tier = pro.");
2022
1643
  } else if (cachedMcpTier === "free") {
2023
- console.error(
2024
- "[Atomix MCP] Resolved tier = free. Figma design tools and --design-in-figma are hidden. syncToFigma and /--sync-to-figma are available. Pro design tools appear when the DS owner has Pro and the pro_figma_export flag is enabled."
2025
- );
1644
+ console.error("[Atomix MCP] Resolved tier = free. syncToFigma and /--sync-to-figma are available.");
2026
1645
  }
2027
1646
  } catch (err) {
2028
1647
  const msg = err instanceof Error ? err.message : String(err);
@@ -2164,7 +1783,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
2164
1783
  },
2165
1784
  {
2166
1785
  name: "syncAll",
2167
- description: "Sync tokens, AI rules, skills (SKILL.md, FIGMA-SKILL.md), and atomix-dependencies.json. Use dryRun: true first to report what would change without writing; then dryRun: false to apply. Response includes a VALIDATION section\u2014agent must check it to confirm success. Optional: output (default ./tokens.css), format (default css), skipTokens (if true, only skills and manifest), dryRun (if true, report only; no files written).",
1786
+ description: "Sync tokens, AI rules, skills (.cursor/skills/atomix-ds/SKILL.md), and atomix-dependencies.json. Use dryRun: true first to report what would change without writing; then dryRun: false to apply. Response includes a VALIDATION section\u2014agent must check it to confirm success. Optional: output (default ./tokens.css), format (default css), skipTokens (if true, only skills and manifest), dryRun (if true, report only; no files written).",
2168
1787
  inputSchema: {
2169
1788
  type: "object",
2170
1789
  properties: {
@@ -2216,160 +1835,9 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
2216
1835
  properties: {},
2217
1836
  required: []
2218
1837
  }
2219
- },
2220
- {
2221
- name: "getFigmaVariablesAndStyles",
2222
- description: "Get all local variable collections (with variable names and ids) and local paint, text, and effect styles from the open Figma file. Call after syncToFigma when designing in Figma; use with resolveFigmaIdsForTokens to get ids for granular design commands. Requires Atomix Figma plugin connected.",
2223
- inputSchema: {
2224
- type: "object",
2225
- properties: {},
2226
- required: []
2227
- }
2228
- },
2229
- {
2230
- name: "createDesignPlaceholder",
2231
- description: "Create a placeholder frame in Figma with name 'Atomix: Preparing the design..', temporary background, and 'Design in progress...' text. Call this first when designing in Figma so the user sees the placeholder. Returns frameId; use that as parentId for designCreateFrame and other design commands. Optional width and height (default 400); use dimensions inferred from the request (e.g. mobile 390x844, card 400x300).",
2232
- inputSchema: {
2233
- type: "object",
2234
- properties: {
2235
- width: { type: "number", description: "Frame width in px (optional, default 400)" },
2236
- height: { type: "number", description: "Frame height in px (optional, default 400)" }
2237
- }
2238
- }
2239
- },
2240
- {
2241
- name: "resolveFigmaIdsForTokens",
2242
- description: "Resolve design system token names to Figma variable and style ids in the open file. Call after syncToFigma and getFigmaVariablesAndStyles. Returns a map keyed by Figma name (e.g. 'Spacing / lg', 'Background / surface') to { variableId?, paintStyleId?, textStyleId?, effectStyleId? }. Use these ids in designCreateFrame, designCreateText, designSetAutoLayout, etc. No arguments.",
2243
- inputSchema: {
2244
- type: "object",
2245
- properties: {},
2246
- required: []
2247
- }
2248
- },
2249
- {
2250
- name: "designCreateFrame",
2251
- description: "Create a frame in Figma under the given parent. Use fillVariableId or fillPaintStyleId from resolveFigmaIdsForTokens for background. Returns nodeId.",
2252
- inputSchema: {
2253
- type: "object",
2254
- properties: {
2255
- parentId: { type: "string", description: "Parent frame/node id (e.g. from createDesignPlaceholder)" },
2256
- name: { type: "string", description: "Layer name" },
2257
- width: { type: "number", description: "Width in px (optional)" },
2258
- height: { type: "number", description: "Height in px (optional)" },
2259
- fillVariableId: { type: "string", description: "Color variable id from resolveFigmaIdsForTokens" },
2260
- fillPaintStyleId: { type: "string", description: "Paint style id from resolveFigmaIdsForTokens" }
2261
- },
2262
- required: ["parentId", "name"]
2263
- }
2264
- },
2265
- {
2266
- name: "designCreateText",
2267
- description: "Create a text node in Figma. Bind to a text style via textStyleId from resolveFigmaIdsForTokens.",
2268
- inputSchema: {
2269
- type: "object",
2270
- properties: {
2271
- parentId: { type: "string", description: "Parent frame id" },
2272
- characters: { type: "string", description: "Text content" },
2273
- textStyleId: { type: "string", description: "Text style id from resolveFigmaIdsForTokens (required)" },
2274
- name: { type: "string", description: "Layer name (optional)" }
2275
- },
2276
- required: ["parentId", "characters", "textStyleId"]
2277
- }
2278
- },
2279
- {
2280
- name: "designCreateRectangle",
2281
- description: "Create a rectangle in Figma. Use fillVariableId or fillPaintStyleId from resolveFigmaIdsForTokens.",
2282
- inputSchema: {
2283
- type: "object",
2284
- properties: {
2285
- parentId: { type: "string", description: "Parent frame id" },
2286
- width: { type: "number", description: "Width in px" },
2287
- height: { type: "number", description: "Height in px" },
2288
- fillVariableId: { type: "string", description: "Color variable id" },
2289
- fillPaintStyleId: { type: "string", description: "Paint style id" },
2290
- name: { type: "string", description: "Layer name (optional)" }
2291
- },
2292
- required: ["parentId", "width", "height"]
2293
- }
2294
- },
2295
- {
2296
- name: "designSetAutoLayout",
2297
- description: "Set auto-layout on a frame. Use variable ids from resolveFigmaIdsForTokens for padding and itemSpacing (e.g. Spacing / lg).",
2298
- inputSchema: {
2299
- type: "object",
2300
- properties: {
2301
- nodeId: { type: "string", description: "Frame node id" },
2302
- direction: { type: "string", description: "HORIZONTAL or VERTICAL" },
2303
- paddingVariableId: { type: "string", description: "Number variable id for all padding" },
2304
- paddingTopVariableId: { type: "string" },
2305
- paddingRightVariableId: { type: "string" },
2306
- paddingBottomVariableId: { type: "string" },
2307
- paddingLeftVariableId: { type: "string" },
2308
- itemSpacingVariableId: { type: "string", description: "Number variable id for gap between children" },
2309
- primaryAxisAlignItems: { type: "string", description: "MIN, CENTER, MAX, SPACE_BETWEEN" },
2310
- counterAxisAlignItems: { type: "string", description: "MIN, CENTER, MAX, BASELINE" },
2311
- layoutSizingHorizontal: { type: "string", description: "HUG or FILL" },
2312
- layoutSizingVertical: { type: "string", description: "HUG or FILL" }
2313
- },
2314
- required: ["nodeId", "direction"]
2315
- }
2316
- },
2317
- {
2318
- name: "designSetLayoutConstraints",
2319
- description: "Set min/max width and height on a frame (e.g. breakpoint variables). Use number variable ids from resolveFigmaIdsForTokens.",
2320
- inputSchema: {
2321
- type: "object",
2322
- properties: {
2323
- nodeId: { type: "string", description: "Frame node id" },
2324
- minWidthVariableId: { type: "string" },
2325
- maxWidthVariableId: { type: "string" },
2326
- minHeightVariableId: { type: "string" },
2327
- maxHeightVariableId: { type: "string" }
2328
- },
2329
- required: ["nodeId"]
2330
- }
2331
- },
2332
- {
2333
- name: "designAppendChild",
2334
- description: "Move a node under a new parent (reparent). Use to reorder or nest nodes.",
2335
- inputSchema: {
2336
- type: "object",
2337
- properties: {
2338
- parentId: { type: "string", description: "New parent frame id" },
2339
- childId: { type: "string", description: "Node id to move" }
2340
- },
2341
- required: ["parentId", "childId"]
2342
- }
2343
- },
2344
- {
2345
- name: "getDesignScreenshot",
2346
- description: "Export a frame as PNG and return it as base64 so you can verify layout, content fill, and hug. Call after each design pass to check your work against the user's intent. Use the returned image to decide if another pass is needed.",
2347
- inputSchema: {
2348
- type: "object",
2349
- properties: {
2350
- frameId: { type: "string", description: "Frame node id (e.g. from createDesignPlaceholder)" },
2351
- scale: { type: "number", description: "Export scale 1\u20134 (optional, default 1)" }
2352
- },
2353
- required: ["frameId"]
2354
- }
2355
- },
2356
- {
2357
- name: "finalizeDesignFrame",
2358
- description: "Rename the design frame and remove the placeholder background. Call after the final design pass. Set name to a short description of the design plus ' \u2705'. Use fillVariableId or fillPaintStyleId from resolveFigmaIdsForTokens (e.g. Background / surface) so the gray placeholder is replaced.",
2359
- inputSchema: {
2360
- type: "object",
2361
- properties: {
2362
- frameId: { type: "string", description: "Frame node id to finalize" },
2363
- name: { type: "string", description: "New frame name (e.g. 'Login card \u2705')" },
2364
- fillVariableId: { type: "string", description: "Variable id for frame fill (removes placeholder bg)" },
2365
- fillPaintStyleId: { type: "string", description: "Paint style id for frame fill" }
2366
- },
2367
- required: ["frameId", "name"]
2368
- }
2369
1838
  }
2370
1839
  ];
2371
- const tools = cachedMcpTier === "pro" ? toolsList : toolsList.filter((t) => !FIGMA_DESIGN_TOOL_NAMES.has(t.name));
2372
- return { tools };
1840
+ return { tools: toolsList };
2373
1841
  });
2374
1842
  server.setRequestHandler(CallToolRequestSchema, async (request) => {
2375
1843
  const { name, arguments: args } = request.params;
@@ -2385,17 +1853,6 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
2385
1853
  try {
2386
1854
  const shouldForceRefresh = name === "syncAll";
2387
1855
  const data = await fetchDesignSystemForMCP(shouldForceRefresh);
2388
- if (FIGMA_DESIGN_TOOL_NAMES.has(name) && cachedMcpTier !== "pro") {
2389
- return {
2390
- content: [
2391
- {
2392
- type: "text",
2393
- text: "This design system does not have Pro Figma access. Figma design tools (design-in-Figma, createDesignPlaceholder, resolveFigmaIdsForTokens, etc.) are available when the design system owner has a Pro subscription. Sync to Figma (syncToFigma) is available on all tiers."
2394
- }
2395
- ],
2396
- isError: true
2397
- };
2398
- }
2399
1856
  async function performTokenSyncAndRules(designSystemData, tokenOutput, tokenFormat, dryRun) {
2400
1857
  const output = tokenOutput;
2401
1858
  const format = tokenFormat;
@@ -2972,12 +2429,9 @@ Version: ${designSystemData.meta.version}`,
2972
2429
  const dsExportedAt = data.meta.exportedAt;
2973
2430
  const skillsDir = path2.resolve(process.cwd(), ".cursor/skills/atomix-ds");
2974
2431
  const skillPath1 = path2.join(skillsDir, "SKILL.md");
2975
- const skillPath2 = path2.join(skillsDir, "FIGMA-SKILL.md");
2976
2432
  const manifestPath = path2.resolve(process.cwd(), "atomix-dependencies.json");
2977
2433
  if (dryRun) {
2978
- parts.push(
2979
- cachedMcpTier === "pro" ? "Would write skills: .cursor/skills/atomix-ds/SKILL.md, .cursor/skills/atomix-ds/FIGMA-SKILL.md" : "Would write skills: .cursor/skills/atomix-ds/SKILL.md"
2980
- );
2434
+ parts.push("Would write skills: .cursor/skills/atomix-ds/SKILL.md");
2981
2435
  parts.push("Would write manifest: atomix-dependencies.json");
2982
2436
  const reportText = [parts.join("\n"), tokenResponseText].filter(Boolean).join("\n\n---\n\n");
2983
2437
  return {
@@ -2990,14 +2444,7 @@ ${reportText}` }]
2990
2444
  const genericWithVersion = injectSkillVersion(GENERIC_SKILL_MD, dsVersion, dsExportedAt);
2991
2445
  fs2.writeFileSync(skillPath1, genericWithVersion);
2992
2446
  allValidation.push({ path: skillPath1, status: fs2.existsSync(skillPath1) ? "OK" : "FAIL", detail: "Written." });
2993
- if (cachedMcpTier === "pro") {
2994
- const figmaWithVersion = injectSkillVersion(FIGMA_DESIGN_SKILL_MD, dsVersion, dsExportedAt);
2995
- fs2.writeFileSync(skillPath2, figmaWithVersion);
2996
- allValidation.push({ path: skillPath2, status: fs2.existsSync(skillPath2) ? "OK" : "FAIL", detail: "Written." });
2997
- }
2998
- parts.push(
2999
- cachedMcpTier === "pro" ? "Skills: .cursor/skills/atomix-ds/SKILL.md, .cursor/skills/atomix-ds/FIGMA-SKILL.md (synced at DS v" + dsVersion + ")" : "Skills: .cursor/skills/atomix-ds/SKILL.md (synced at DS v" + dsVersion + ")"
3000
- );
2447
+ parts.push("Skills: .cursor/skills/atomix-ds/SKILL.md (synced at DS v" + dsVersion + ")");
3001
2448
  const tokens = data.tokens;
3002
2449
  const typography = tokens?.typography;
3003
2450
  const fontFamily = typography?.fontFamily;
@@ -3028,7 +2475,6 @@ ${reportText}` }]
3028
2475
  fonts: { families: fontNames },
3029
2476
  skills: {
3030
2477
  skill: ".cursor/skills/atomix-ds/SKILL.md",
3031
- ...cachedMcpTier === "pro" ? { skillFigmaDesign: ".cursor/skills/atomix-ds/FIGMA-SKILL.md" } : {},
3032
2478
  syncedAtVersion: data.meta.version ?? "1.0.0"
3033
2479
  }
3034
2480
  };
@@ -3085,12 +2531,6 @@ ${tokenResponseText}${validationBlock}` : `${summary}${validationBlock}`);
3085
2531
  path: ".cursor/skills/atomix-ds/SKILL.md",
3086
2532
  content: GENERIC_SKILL_MD
3087
2533
  },
3088
- ...cachedMcpTier === "pro" ? {
3089
- skillFigmaDesign: {
3090
- path: ".cursor/skills/atomix-ds/FIGMA-SKILL.md",
3091
- content: FIGMA_DESIGN_SKILL_MD
3092
- }
3093
- } : {},
3094
2534
  tokenFiles: {
3095
2535
  files: ["tokens.css", "tokens.json"],
3096
2536
  copyInstructions: "Call the syncAll MCP tool to create the token file, skills, and atomix-dependencies.json; do not only suggest the user run sync later."
@@ -3303,268 +2743,13 @@ ${JSON.stringify(out, null, 2)}` : JSON.stringify(out, null, 2);
3303
2743
  ...out.error ? { isError: true } : {}
3304
2744
  };
3305
2745
  }
3306
- case "getFigmaVariablesAndStyles": {
3307
- try {
3308
- const reachable = await isBridgeReachable();
3309
- if (!reachable) {
3310
- return {
3311
- content: [{
3312
- type: "text",
3313
- text: JSON.stringify({
3314
- error: "Figma bridge not reachable.",
3315
- bridgeNotRunning: true,
3316
- agentInstruction: "The Figma bridge runs with this MCP server. Ensure your AI environment has this MCP server running, then in Figma run the Atomix plugin and tap Connect. Then call getFigmaVariablesAndStyles again."
3317
- }, null, 2)
3318
- }],
3319
- isError: true
3320
- };
3321
- }
3322
- const result = await sendBridgeRequest("get_figma_variables_and_styles");
3323
- return {
3324
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
3325
- };
3326
- } catch (e) {
3327
- const message = e instanceof Error ? e.message : String(e);
3328
- return {
3329
- content: [{
3330
- type: "text",
3331
- text: JSON.stringify({ error: message, hint: "Ensure the bridge is running and the Atomix plugin is connected." }, null, 2)
3332
- }],
3333
- isError: true
3334
- };
3335
- }
3336
- }
3337
- case "createDesignPlaceholder": {
3338
- try {
3339
- const reachable = await isBridgeReachable();
3340
- if (!reachable) {
3341
- return {
3342
- content: [{
3343
- type: "text",
3344
- text: JSON.stringify({
3345
- error: "Figma bridge not reachable.",
3346
- hint: "The bridge runs with this MCP server. Ensure your AI environment has this MCP server running, then run the Atomix plugin and tap Connect."
3347
- }, null, 2)
3348
- }],
3349
- isError: true
3350
- };
3351
- }
3352
- const w = args?.width;
3353
- const h = args?.height;
3354
- const placeholderParams = {};
3355
- if (typeof w === "number" && w > 0) placeholderParams.width = Math.round(w);
3356
- if (typeof h === "number" && h > 0) placeholderParams.height = Math.round(h);
3357
- const result = await sendBridgeRequest("create_design_placeholder", placeholderParams);
3358
- return {
3359
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
3360
- };
3361
- } catch (e) {
3362
- const message = e instanceof Error ? e.message : String(e);
3363
- return {
3364
- content: [{
3365
- type: "text",
3366
- text: JSON.stringify({ error: message }, null, 2)
3367
- }],
3368
- isError: true
3369
- };
3370
- }
3371
- }
3372
- case "resolveFigmaIdsForTokens": {
3373
- try {
3374
- const reachable = await isBridgeReachable();
3375
- if (!reachable) {
3376
- return {
3377
- content: [{
3378
- type: "text",
3379
- text: JSON.stringify({
3380
- error: "Figma bridge not reachable.",
3381
- hint: "Run syncToFigma first, then ensure the plugin is connected. Then call resolveFigmaIdsForTokens again."
3382
- }, null, 2)
3383
- }],
3384
- isError: true
3385
- };
3386
- }
3387
- const raw = await sendBridgeRequest("get_figma_variables_and_styles");
3388
- const response = raw;
3389
- const variableByName = /* @__PURE__ */ new Map();
3390
- if (response.variableCollections) {
3391
- const numberCategorySuffixes = [" Spacing", " Radius", " Borders", " Height", " Icon", " Breakpoint"];
3392
- for (const coll of response.variableCollections) {
3393
- if (coll.name.endsWith(" Colors")) {
3394
- for (const v of coll.variables || []) {
3395
- variableByName.set(v.name, v.id);
3396
- }
3397
- continue;
3398
- }
3399
- const numberSuffix = numberCategorySuffixes.find((s) => coll.name.endsWith(s));
3400
- if (numberSuffix) {
3401
- const category = numberSuffix.slice(1);
3402
- for (const v of coll.variables || []) {
3403
- variableByName.set(`${category} / ${v.name}`, v.id);
3404
- }
3405
- }
3406
- }
3407
- }
3408
- const paintByName = /* @__PURE__ */ new Map();
3409
- for (const s of response.paintStyles || []) {
3410
- paintByName.set(s.name, s.id);
3411
- }
3412
- const textByName = /* @__PURE__ */ new Map();
3413
- for (const s of response.textStyles || []) {
3414
- textByName.set(s.name, s.id);
3415
- }
3416
- const effectByName = /* @__PURE__ */ new Map();
3417
- for (const s of response.effectStyles || []) {
3418
- effectByName.set(s.name, s.id);
3419
- }
3420
- const expected = getExpectedFigmaNamesFromDS(data);
3421
- const resolved = {};
3422
- const allNames = /* @__PURE__ */ new Set([
3423
- ...expected.colorVariableNames,
3424
- ...expected.paintStyleNames,
3425
- ...expected.textStyleNames,
3426
- ...expected.effectStyleNames,
3427
- ...expected.numberVariableNames
3428
- ]);
3429
- for (const name2 of allNames) {
3430
- const entry = {};
3431
- const vId = variableByName.get(name2);
3432
- if (vId) entry.variableId = vId;
3433
- const pId = paintByName.get(name2);
3434
- if (pId) entry.paintStyleId = pId;
3435
- const tId = textByName.get(name2);
3436
- if (tId) entry.textStyleId = tId;
3437
- const eId = effectByName.get(name2);
3438
- if (eId) entry.effectStyleId = eId;
3439
- if (vId || pId || tId || eId) resolved[name2] = entry;
3440
- }
3441
- return {
3442
- content: [{ type: "text", text: JSON.stringify({ resolved }, null, 2) }]
3443
- };
3444
- } catch (e) {
3445
- const message = e instanceof Error ? e.message : String(e);
3446
- return {
3447
- content: [{
3448
- type: "text",
3449
- text: JSON.stringify({ error: message }, null, 2)
3450
- }],
3451
- isError: true
3452
- };
3453
- }
3454
- }
3455
- case "getDesignScreenshot": {
3456
- try {
3457
- const reachable = await isBridgeReachable();
3458
- if (!reachable) {
3459
- return {
3460
- content: [{
3461
- type: "text",
3462
- text: JSON.stringify({
3463
- error: "Figma bridge not reachable.",
3464
- hint: "Run the Atomix plugin in Figma and tap Connect, then retry."
3465
- }, null, 2)
3466
- }],
3467
- isError: true
3468
- };
3469
- }
3470
- const frameId = args?.frameId;
3471
- const scale = args?.scale;
3472
- const params = { frameId };
3473
- if (typeof scale === "number" && scale >= 1 && scale <= 4) params.scale = scale;
3474
- const result = await sendBridgeRequest("get_design_screenshot", params);
3475
- if (result.error) {
3476
- return {
3477
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
3478
- isError: true
3479
- };
3480
- }
3481
- const content = [
3482
- { type: "text", text: `Screenshot captured (format: ${result.format ?? "PNG"}, scale: ${result.scale ?? 1}). Use the image below to verify layout, fill, and content hug.` }
3483
- ];
3484
- if (result.imageBase64) {
3485
- content.push({ type: "image", data: result.imageBase64, mimeType: "image/png" });
3486
- }
3487
- return { content };
3488
- } catch (e) {
3489
- const message = e instanceof Error ? e.message : String(e);
3490
- return {
3491
- content: [{ type: "text", text: JSON.stringify({ error: message }, null, 2) }],
3492
- isError: true
3493
- };
3494
- }
3495
- }
3496
- case "finalizeDesignFrame": {
3497
- try {
3498
- const reachable = await isBridgeReachable();
3499
- if (!reachable) {
3500
- return {
3501
- content: [{
3502
- type: "text",
3503
- text: JSON.stringify({
3504
- error: "Figma bridge not reachable.",
3505
- hint: "Run the Atomix plugin in Figma and tap Connect, then retry."
3506
- }, null, 2)
3507
- }],
3508
- isError: true
3509
- };
3510
- }
3511
- const params = args && typeof args === "object" ? args : {};
3512
- const result = await sendBridgeRequest("finalize_design_frame", params);
3513
- return {
3514
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
3515
- };
3516
- } catch (e) {
3517
- const message = e instanceof Error ? e.message : String(e);
3518
- return {
3519
- content: [{ type: "text", text: JSON.stringify({ error: message }, null, 2) }],
3520
- isError: true
3521
- };
3522
- }
3523
- }
3524
- case "designCreateFrame":
3525
- case "designCreateText":
3526
- case "designCreateRectangle":
3527
- case "designSetAutoLayout":
3528
- case "designSetLayoutConstraints":
3529
- case "designAppendChild": {
3530
- try {
3531
- const reachable = await isBridgeReachable();
3532
- if (!reachable) {
3533
- return {
3534
- content: [{
3535
- type: "text",
3536
- text: JSON.stringify({
3537
- error: "Figma bridge not reachable.",
3538
- hint: "Run the Atomix plugin in Figma and tap Connect, then retry."
3539
- }, null, 2)
3540
- }],
3541
- isError: true
3542
- };
3543
- }
3544
- const method = normalizeBridgeMethod(name);
3545
- const params = args && typeof args === "object" ? args : {};
3546
- const result = await sendBridgeRequest(method, params);
3547
- return {
3548
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
3549
- };
3550
- } catch (e) {
3551
- const message = e instanceof Error ? e.message : String(e);
3552
- return {
3553
- content: [{
3554
- type: "text",
3555
- text: JSON.stringify({ error: message }, null, 2)
3556
- }],
3557
- isError: true
3558
- };
3559
- }
3560
- }
3561
2746
  default:
3562
2747
  return {
3563
2748
  content: [{
3564
2749
  type: "text",
3565
2750
  text: JSON.stringify({
3566
2751
  error: `Unknown tool: ${name}`,
3567
- availableTools: ["getToken", "listTokens", "listTypesets", "searchTokens", "validateUsage", "getAIToolRules", "exportMCPConfig", "getSetupInstructions", "syncAll", "getDependencies", "syncToFigma", "getFigmaVariablesAndStyles", "createDesignPlaceholder", "resolveFigmaIdsForTokens", "designCreateFrame", "designCreateText", "designCreateRectangle", "designSetAutoLayout", "designSetLayoutConstraints", "designAppendChild", "getDesignScreenshot", "finalizeDesignFrame"]
2752
+ availableTools: ["getToken", "listTokens", "listTypesets", "searchTokens", "validateUsage", "getAIToolRules", "exportMCPConfig", "getSetupInstructions", "syncAll", "getDependencies", "syncToFigma"]
3568
2753
  }, null, 2)
3569
2754
  }]
3570
2755
  };
@@ -3664,49 +2849,6 @@ Use the returned rules and token paths/values when generating or editing code. P
3664
2849
  - **No guessing:** If a value is not in the rules or token list, use searchTokens or listTokens to find the closest match rather than inventing a value.
3665
2850
  - **Version check:** If this skill file has frontmatter \`atomixDsVersion\`, compare it to the design system version from **getDependencies** (\`meta.designSystemVersion\`). If the design system is newer, suggest the user run **syncAll** to update skills and tokens.
3666
2851
  `;
3667
- var FIGMA_DESIGN_SKILL_MD = `---
3668
- name: atomix-design-in-figma
3669
- description: Design in Figma using granular MCP commands. Three passes: wireframe, then tokens/rules, then audit. Use getDesignScreenshot to verify; finalizeDesignFrame to rename and remove placeholder.
3670
- ---
3671
-
3672
- # Design in Figma (principal product designer)
3673
-
3674
- Use this skill when the user asks to **design in Figma** (e.g. /--design-in-figma). Design by calling a **sequence of MCP tools**\u2014no script generation. All values come from the owner's Figma variables and styles (via **syncToFigma** and **resolveFigmaIdsForTokens**).
3675
-
3676
- ## Mandatory: no hardcoding
3677
-
3678
- - **Only variable and style ids.** Use **resolveFigmaIdsForTokens** to get \`variableId\`, \`paintStyleId\`, \`textStyleId\`, \`effectStyleId\` keyed by Figma name (e.g. "Spacing / lg", "Background / surface"). Pass these ids into designCreateFrame, designCreateText, designSetAutoLayout, designSetLayoutConstraints. Never pass raw px, hex, or font sizes.
3679
-
3680
- ## Mandatory: user AI rules (colors, typography, buttons)
3681
-
3682
- - **Colors:** Only variable/paint style ids from resolveFigmaIdsForTokens and getAIToolRules; no hex or raw values.
3683
- - **Typography:** Only text style ids from resolved + rules; no raw font size/weight/family.
3684
- - **Buttons:** Use token-based sizing and hierarchy from getAIToolRules; primary/secondary/ghost from resolved styles.
3685
-
3686
- ## Mandatory: set up variables first
3687
-
3688
- - **Call syncToFigma first.** Then getAIToolRules, listTokens, and resolveFigmaIdsForTokens. Use the \`resolved\` map for every fill, text style, and spacing.
3689
-
3690
- ## Mandatory: auto-layout and breakpoints
3691
-
3692
- - **Every frame with children:** Call **designSetAutoLayout** with \`nodeId\`, \`direction\`, \`paddingVariableId\`, \`itemSpacingVariableId\` from resolved. Use \`layoutSizingHorizontal\` / \`layoutSizingVertical\` (HUG or FILL) so content hugs or fills as intended.
3693
- - **Breakpoints (non-mobile):** Use **designSetLayoutConstraints** with \`maxWidthVariableId\` from resolved for container frames.
3694
-
3695
- ## Three-pass flow (strict order)
3696
-
3697
- **Setup (once):** syncToFigma \u2192 createDesignPlaceholder (save \`frameId\`) \u2192 getAIToolRules + listTokens \u2192 resolveFigmaIdsForTokens. Keep \`resolved\` and \`frameId\` for all passes.
3698
-
3699
- **Pass 1 \u2014 Layout and contents (wireframe)**
3700
- Build structure only: frames, text nodes, rectangles, auto-layout, layout constraints. Focus on hierarchy, spacing, and content placement; temporary or neutral fills are acceptable. Then call **getDesignScreenshot** with \`frameId\`. Check the image: layout correct? Content and frames hugging/filling as intended? If not, fix with design commands and take another screenshot until satisfied.
3701
-
3702
- **Pass 2 \u2014 Apply design tokens and AI rules**
3703
- Apply the owner's design system: set all fills to variable/paint ids from \`resolved\` (e.g. Background / surface, Brand / primary). Set all text to text style ids from \`resolved\`. Apply button and component tokens from getAIToolRules (colors, typography, buttons). Then call **getDesignScreenshot**. Check: do colors, typography, and buttons match the design system and rules? If not, fix and re-check.
3704
-
3705
- **Pass 3 \u2014 Confirm no hardcoded values and follow AI rules**
3706
- Audit: ensure no raw px, hex, or font values were introduced. Verify every fill, text style, and spacing uses an id from \`resolved\`. Check getAIToolRules again for colors, typography, buttons. Then call **getDesignScreenshot** one last time. If all good: call **finalizeDesignFrame** with \`frameId\`, \`name\` = short description of the design + " \u2705", and \`fillVariableId\` (or \`fillPaintStyleId\`) for the surface/background so the placeholder gray is removed. Then **summarise** what was built and any fixes made across passes.
3707
-
3708
- Do not generate or run any JavaScript code. Use only the MCP tools listed above.
3709
- `;
3710
2852
  var SHOWCASE_HTML_TEMPLATE = `<!DOCTYPE html>
3711
2853
  <html lang="en">
3712
2854
  <head>
@@ -3845,7 +2987,6 @@ Get your DS ID and token from the Export modal or Settings \u2192 Regenerate Ato
3845
2987
  }
3846
2988
  throw new Error(`Unknown resource: ${uri}`);
3847
2989
  });
3848
- var FIGMA_DESIGN_PROMPT_NAMES = /* @__PURE__ */ new Set(["--design-in-figma"]);
3849
2990
  server.setRequestHandler(ListPromptsRequestSchema, async () => {
3850
2991
  if (!hasValidAuthConfig()) {
3851
2992
  authFailedNoTools = true;
@@ -3861,16 +3002,14 @@ server.setRequestHandler(ListPromptsRequestSchema, async () => {
3861
3002
  if (authFailedNoTools) {
3862
3003
  throw new Error(AUTH_REQUIRED_MESSAGE);
3863
3004
  }
3864
- const allPrompts = [
3005
+ const prompts = [
3865
3006
  { name: "--hello", description: "Get started with this design system - overview, tokens, and tools. Run this first!" },
3866
3007
  { name: "--get-started", description: "Get started with design system in project. Three phases: scan, report and ask, then create only after you approve." },
3867
3008
  { name: "--rules", description: "Get the design system governance rules for your AI coding tool (default: cursor)." },
3868
3009
  { name: "--sync", description: "Sync tokens, AI rules, skills files, and dependencies manifest (icons, fonts). Use /--refactor to migrate deprecated tokens." },
3869
3010
  { name: "--refactor", description: "Migrate deprecated tokens in codebase. Run after /--sync." },
3870
- { name: "--sync-to-figma", description: "Push this design system to Figma (variables, color + typography styles). Uses local bridge + plugin; no Figma token." },
3871
- { name: "--design-in-figma", description: "Design UI in Figma: 3 passes (wireframe \u2192 tokens/rules \u2192 audit), getDesignScreenshot after each pass, then finalizeDesignFrame (rename + \u2705, remove placeholder) and summarise." }
3011
+ { name: "--sync-to-figma", description: "Push this design system to Figma (variables, color + typography styles). Uses local bridge + plugin; no Figma token." }
3872
3012
  ];
3873
- const prompts = cachedMcpTier === "pro" ? allPrompts : allPrompts.filter((p) => !FIGMA_DESIGN_PROMPT_NAMES.has(p.name));
3874
3013
  return { prompts };
3875
3014
  });
3876
3015
  server.setRequestHandler(GetPromptRequestSchema, async (request) => {
@@ -3887,7 +3026,7 @@ server.setRequestHandler(GetPromptRequestSchema, async (request) => {
3887
3026
  }]
3888
3027
  };
3889
3028
  }
3890
- const canonicalName = name === "--hello" ? "hello" : name === "--get-started" ? "atomix-setup" : name === "--rules" ? "design-system-rules" : name === "--sync" ? "sync" : name === "--refactor" ? "refactor" : name === "--sync-to-figma" || name === "syncToFigma" ? "sync-to-figma" : name === "--design-in-figma" ? "design-in-figma" : name;
3029
+ const canonicalName = name === "--hello" ? "hello" : name === "--get-started" ? "atomix-setup" : name === "--rules" ? "design-system-rules" : name === "--sync" ? "sync" : name === "--refactor" ? "refactor" : name === "--sync-to-figma" || name === "syncToFigma" ? "sync-to-figma" : name;
3891
3030
  const shouldForceRefresh = canonicalName === "sync";
3892
3031
  let data = null;
3893
3032
  let stats = null;
@@ -3972,20 +3111,6 @@ Both are required. Configure the MCP server in your AI tool's MCP settings, then
3972
3111
  }
3973
3112
  throw error;
3974
3113
  }
3975
- if (FIGMA_DESIGN_PROMPT_NAMES.has(name) && cachedMcpTier !== "pro") {
3976
- return {
3977
- description: "Pro Figma required",
3978
- messages: [
3979
- {
3980
- role: "user",
3981
- content: {
3982
- type: "text",
3983
- text: "This design system does not have Pro Figma access. The design-in-Figma prompt is available when the design system owner has a Pro subscription. Sync to Figma (/--sync-to-figma) is available on all tiers."
3984
- }
3985
- }
3986
- ]
3987
- };
3988
- }
3989
3114
  const buildCategoryPrompt = (category, instructions) => {
3990
3115
  const lines = [];
3991
3116
  lines.push(`## Design System Information`);
@@ -4232,35 +3357,6 @@ Format the response as a markdown table with columns: Token Name | Value | CSS V
4232
3357
  ]
4233
3358
  };
4234
3359
  }
4235
- case "design-in-figma": {
4236
- return {
4237
- description: "Design in Figma using granular MCP commands: 3 passes (wireframe \u2192 tokens \u2192 audit), screenshot checks, then finalize and summarise",
4238
- messages: [
4239
- {
4240
- role: "user",
4241
- content: {
4242
- type: "text",
4243
- text: `You must **design in Figma** by calling a **sequence of MCP tools**\u2014do not generate or run any JavaScript code. Follow the design-in-Figma skill if present; otherwise follow this **three-pass flow**.
4244
-
4245
- Prerequisites: Figma bridge runs inside this MCP server. In Figma, run the Atomix plugin and tap Connect; leave the plugin open.
4246
-
4247
- **Setup (once):** syncToFigma \u2192 createDesignPlaceholder (save \`frameId\`) \u2192 getAIToolRules + listTokens \u2192 resolveFigmaIdsForTokens. Use the returned \`resolved\` map and \`frameId\` for all passes.
4248
-
4249
- **Pass 1 \u2014 Layout and contents (wireframe)**
4250
- Build the structure: designCreateFrame, designCreateText, designCreateRectangle, designSetAutoLayout (use paddingVariableId, itemSpacingVariableId, and layoutSizingHorizontal/layoutSizingVertical HUG or FILL from resolved), designSetLayoutConstraints, designAppendChild. Focus on hierarchy, spacing, and content placement. Then call **getDesignScreenshot** with \`frameId\`. Check the returned image: is layout correct? Do elements hug or fill as intended? If not, fix and take another screenshot until satisfied.
4251
-
4252
- **Pass 2 \u2014 Apply design tokens and AI rules**
4253
- Apply the owner's design system: set all fills and text styles using only ids from \`resolved\` (no raw px/hex). Strictly follow getAIToolRules for **colors, typography, and buttons**. Then call **getDesignScreenshot**. Check: do colors, typography, and buttons match the design system? If not, fix and re-check.
4254
-
4255
- **Pass 3 \u2014 Confirm no hardcoded values**
4256
- Audit: ensure no raw px, hex, or font values remain; every fill and text style must use an id from \`resolved\`. Call **getDesignScreenshot** once more. If everything is correct: call **finalizeDesignFrame** with \`frameId\`, \`name\` = a short description of the design + " \u2705", and \`fillVariableId\` (or \`fillPaintStyleId\`) from resolved for the surface/background so the placeholder gray is removed. Then **summarise** what was built and any fixes made across the three passes.
4257
-
4258
- If the bridge is not reachable: tell the user to run the Atomix plugin in Figma and tap Connect, then retry.`
4259
- }
4260
- }
4261
- ]
4262
- };
4263
- }
4264
3360
  case "refactor": {
4265
3361
  if (!lastSyncAffectedTokens) {
4266
3362
  return {
@@ -4385,8 +3481,8 @@ Use \`/color\`, \`/spacing\`, \`/radius\`, \`/typography\`, \`/shadow\`, \`/bord
4385
3481
 
4386
3482
  - Resolve platform/stack: infer from the project (e.g. package.json, build.gradle, Xcode) or ask once: "Which platform? (e.g. web, Android, iOS)" and if relevant "Which stack? (e.g. React, Vue, Next, Swift, Kotlin)." Do not assume a default.
4387
3483
  - Call **getDependencies** with \`platform\` and optional \`stack\`. If it fails, tell the user the design system could not be reached and stop.
4388
- - Scan the repo for: .cursor/skills/atomix-ds/SKILL.md, a tokens file (e.g. tokens.css or src/tokens.css), icon package from getDependencies, font links. If getDependencies returned \`skillFigmaDesign\`, also scan for .cursor/skills/atomix-ds/FIGMA-SKILL.md. **Web:** note any existing CSS (globals.css, main.css, Tailwind, etc.). **Native:** note any theme/style files (SwiftUI, Android themes, Compose).
4389
- - Build two lists: **Suggested** (from getDependencies minus what exists) and **Already present**. Include: icon package, font links, skill (.cursor/skills/atomix-ds/SKILL.md). Include **Figma design skill** (.cursor/skills/atomix-ds/FIGMA-SKILL.md) in Suggested/Already present only if getDependencies returned a \`skillFigmaDesign\` object; otherwise omit it. Include token files; for web, also include the **showcase page** (atomix-setup-showcase.html) if getDependencies returned a \`showcase\` object.
3484
+ - Scan the repo for: .cursor/skills/atomix-ds/SKILL.md, a tokens file (e.g. tokens.css or src/tokens.css), icon package from getDependencies, font links. **Web:** note any existing CSS (globals.css, main.css, Tailwind, etc.). **Native:** note any theme/style files (SwiftUI, Android themes, Compose).
3485
+ - Build two lists: **Suggested** (from getDependencies minus what exists) and **Already present**. Include: icon package, font links, skill (.cursor/skills/atomix-ds/SKILL.md), token files; for web, also include the **showcase page** (atomix-setup-showcase.html) if getDependencies returned a \`showcase\` object.
4390
3486
  - Do not write, create, or add anything in Phase 1.
4391
3487
 
4392
3488
  ## Phase 2 \u2013 Report and ask
@@ -4400,7 +3496,6 @@ Use \`/color\`, \`/spacing\`, \`/radius\`, \`/typography\`, \`/shadow\`, \`/bord
4400
3496
  - Run only when the user has said yes (all or specific items).
4401
3497
  - For each approved item:
4402
3498
  - **Skill:** Write the skill content from getDependencies \`skill.content\` to \`skill.path\` (.cursor/skills/atomix-ds/SKILL.md).
4403
- - **Figma design skill:** Only if getDependencies returned \`skillFigmaDesign\`, write \`skillFigmaDesign.content\` to \`skillFigmaDesign.path\` (.cursor/skills/atomix-ds/FIGMA-SKILL.md). Use this when designing in Figma so the agent follows principal-product-designer rules and prefers existing Figma variables. If \`skillFigmaDesign\` was not in the response, do not add this file.
4404
3499
  - **Token file:** Call **syncAll** with \`output\` set to the path (e.g. "./src/tokens.css" or "./tokens.css"). syncAll also writes skills and atomix-dependencies.json. You must call syncAll; do not only suggest the user run it later.
4405
3500
  - **Icon package:** Install per getDependencies. When rendering icons, apply the design system's icon tokens: use getToken(\`sizing.icon.*\`) or listTokens(\`sizing\`) for size, and getToken(\`icons.strokeWidth\`) for stroke width when the DS defines it; do not use hardcoded sizes or stroke widths.
4406
3501
  - **Fonts and typeset:** Add font links (e.g. \`<link>\` or \`@import\` from Google Fonts). Then build a **complete typeset CSS**: call **listTypesets** to get every typeset from the owner's design system (do not skip any). Emit **one CSS rule per typeset** using the \`cssClass\` and the \`fontFamilyVar\`, \`fontSizeVar\`, \`fontWeightVar\`, \`lineHeightVar\` (and \`letterSpacingVar\`, \`textTransformVar\`, \`textDecorationVar\` when present) returned by listTypesets. Include text-transform and text-decoration when the typeset has them so the result is **1:1** with the design system. The typeset file must define the full type scale\u2014not only a font import. Do not create a CSS file that contains only a font import.