@diviops/mcp-server 0.2.10 → 0.2.11

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 CHANGED
@@ -141,7 +141,7 @@ The server connects via standard WordPress REST API and works with any environme
141
141
  | `diviops_save_to_library` | Save block markup to Divi Library |
142
142
  | `diviops_update_tb_layout` | Update a Theme Builder layout's block markup |
143
143
  | `diviops_create_tb_template` | Create Theme Builder template with header/footer and conditions |
144
- | `diviops_create_variable` | Create a design token variable. For `type=numbers` fluid tokens, pass `min`+`max` shorthand (anchors default to 320px/1920px) or explicit `targets` like `{"320px":"20px","1920px":"60px"}` — server generates arithmetically-correct `clamp()` instead of hand-written math that silently under-reaches the stated max. Px inputs only in this MVP; rem inputs should be converted to px (1rem=16px) before calling |
144
+ | `diviops_create_variable` | Create a design token variable. For `type=numbers` fluid tokens, pass `min`+`max` shorthand (anchors default to 320px/1920px) or explicit `targets` like `{"320px":"20px","1920px":"60px"}` — server generates arithmetically-correct `clamp()` instead of hand-written math that silently under-reaches the stated max. All-px inputs emit px (root-agnostic). Rem inputs OR rem output require explicit opt-in: pass `output_unit="rem"` (accepts the 1rem=16px default) or `root_font_size_px:N` (declares your site's actual root font-size, e.g. `10` for `html { font-size: 62.5% }`, `20` for `html { font-size: 20px }`) |
145
145
  | `diviops_delete_variable` | Delete a variable by ID. Returns HTTP 409 when live references exist unless `force=true` (use `diviops_variables_scan_orphans` to find reference locations). Returns HTTP 403 for Divi's customizer-bound defaults (`gcid-primary-color`, `gcid-secondary-color`, `gcid-heading-color`, `gcid-body-color`, `gcid-link-color` — managed via WP Customizer) |
146
146
  | `diviops_create_canvas` | Create a canvas page |
147
147
  | `diviops_update_canvas` | Update canvas content |
@@ -2,7 +2,7 @@
2
2
  * Version compatibility between MCP server and WP plugin.
3
3
  */
4
4
  /** Minimum WP plugin version this server requires. */
5
- export declare const MIN_PLUGIN_VERSION = "1.0.0-beta.28";
5
+ export declare const MIN_PLUGIN_VERSION = "1.0.0-beta.30";
6
6
  /**
7
7
  * Compare two semver-like version strings (supports pre-release tags).
8
8
  *
@@ -2,7 +2,7 @@
2
2
  * Version compatibility between MCP server and WP plugin.
3
3
  */
4
4
  /** Minimum WP plugin version this server requires. */
5
- export const MIN_PLUGIN_VERSION = '1.0.0-beta.28';
5
+ export const MIN_PLUGIN_VERSION = '1.0.0-beta.30';
6
6
  /**
7
7
  * Compare two semver-like version strings (supports pre-release tags).
8
8
  *
package/dist/index.js CHANGED
@@ -1285,7 +1285,7 @@ server.registerTool("diviops_list_variables", {
1285
1285
  };
1286
1286
  });
1287
1287
  server.registerTool("diviops_create_variable", {
1288
- description: 'Create a design token variable in the Divi Variable Manager. Colors (type "colors") use gcid-* IDs and hex values. Numbers/strings/etc use gvid-* IDs. For type="numbers" fluid tokens, pass min+max shorthand (anchors default to 320px/1920px) or explicit targets — server generates arithmetically-correct clamp() formulas. Px inputs only in this MVP; rem inputs must be converted to px (1rem=16px) before calling. Mutually exclusive with value.',
1288
+ description: 'Create a design token variable in the Divi Variable Manager. Colors (type "colors") use gcid-* IDs and hex values. Numbers/strings/etc use gvid-* IDs. For type="numbers" fluid tokens, pass min+max shorthand (anchors default to 320px/1920px) or explicit targets — server generates arithmetically-correct clamp() formulas. All-px inputs emit px (safe default, root-agnostic). Rem inputs OR rem output require explicit opt-in: pass output_unit="rem" (accepts the 1rem=16px default) or root_font_size_px:N (declares your site\'s actual root font-size for correct rem emission on non-16px-root sites). Mutually exclusive with value.',
1289
1289
  inputSchema: {
1290
1290
  type: z
1291
1291
  .enum(["colors", "numbers", "strings", "images", "links", "fonts"])
@@ -1304,20 +1304,29 @@ server.registerTool("diviops_create_variable", {
1304
1304
  min: z
1305
1305
  .string()
1306
1306
  .optional()
1307
- .describe('Fluid minimum value in px (e.g. "20px"). Paired with max. Anchors default to 320px/1920px. type="numbers" only. Rem not supported convert to px (1rem=16px) before calling.'),
1307
+ .describe('Fluid minimum value (e.g. "20px" or "1.25rem"). Paired with max. Anchors default to 320px/1920px. Rem inputs require explicit opt-in via output_unit or root_font_size_px. type="numbers" only.'),
1308
1308
  max: z
1309
1309
  .string()
1310
1310
  .optional()
1311
- .describe('Fluid maximum value in px (e.g. "60px"). Paired with min.'),
1311
+ .describe('Fluid maximum value (e.g. "60px" or "3.75rem"). Paired with min.'),
1312
1312
  targets: z
1313
1313
  .record(z.string(), z.string())
1314
1314
  .refine((m) => !m || Object.keys(m).length === 2, {
1315
1315
  message: "targets must contain exactly 2 viewport entries",
1316
1316
  })
1317
1317
  .optional()
1318
- .describe('Explicit two-anchor fluid spec, px only. Example: {"320px":"20px","1920px":"60px"} → clamp(20px, 12px + 2.5vw, 60px). Exactly 2 entries required. type="numbers" only. Mutually exclusive with min/max.'),
1318
+ .describe('Explicit two-anchor fluid spec, object keyed by viewport width (px only). Example: {"320px":"20px","1920px":"60px"} → clamp(20px, 12px + 2.5vw, 60px). Exactly 2 entries required. type="numbers" only. Mutually exclusive with min/max. Rem values require explicit opt-in via output_unit or root_font_size_px.'),
1319
+ output_unit: z
1320
+ .enum(["rem", "px"])
1321
+ .optional()
1322
+ .describe('Unit for generated clamp formula. Omit for all-px inputs (safe default — emits px, root-agnostic). Pass "rem" to emit rem (accepts the 1rem=16px assumption unless root_font_size_px is also passed); required when inputs include rem unless root_font_size_px is passed. Pass "px" to force px output regardless of input unit.'),
1323
+ root_font_size_px: z
1324
+ .number()
1325
+ .positive()
1326
+ .optional()
1327
+ .describe("Site's root font-size in px (positive number), used for correct rem↔px conversion in the generated clamp() formula. Defaults to 16 (standard browser default) when omitted. Pass explicitly for sites that customize `html { font-size }` (e.g. 10 for `html { font-size: 62.5% }`, 20 for `html { font-size: 20px }`). Also counts as an opt-in signal for rem emission — passing it alone (without output_unit) implies rem output. Only applies when min/max/targets is used."),
1319
1328
  },
1320
- }, async ({ type, id, label, value, min, max, targets }) => {
1329
+ }, async ({ type, id, label, value, min, max, targets, output_unit, root_font_size_px, }) => {
1321
1330
  const body = { type, label };
1322
1331
  if (value !== undefined)
1323
1332
  body.value = value;
@@ -1329,6 +1338,10 @@ server.registerTool("diviops_create_variable", {
1329
1338
  body.max = max;
1330
1339
  if (targets !== undefined)
1331
1340
  body.targets = targets;
1341
+ if (output_unit !== undefined)
1342
+ body.output_unit = output_unit;
1343
+ if (root_font_size_px !== undefined)
1344
+ body.root_font_size_px = root_font_size_px;
1332
1345
  const result = await wp.request("/variable/create", {
1333
1346
  method: "POST",
1334
1347
  body,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diviops/mcp-server",
3
- "version": "0.2.10",
3
+ "version": "0.2.11",
4
4
  "description": "MCP server exposing Divi 5 Visual Builder as tools for Claude",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",