@diviops/mcp-server 0.2.5 → 0.2.7

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
@@ -91,7 +91,7 @@ The server connects via standard WordPress REST API and works with any environme
91
91
 
92
92
  > **WP-CLI note:** `WP_PATH` keeps the existing Local by Flywheel behavior by running `wp` directly on the host filesystem. For Docker-based environments (DDEV, wp-env, DevKinsta, WordPress Studio), set `WP_CLI_CMD` to the wrapper command instead. When `WP_CLI_CMD` is set, the server executes the wrapper from `WP_PATH` if provided, otherwise from its current working directory. The MCP server still validates the requested WP-CLI subcommand against its allowlist before executing either path.
93
93
 
94
- ## Available Tools (47)
94
+ ## Available Tools (48)
95
95
 
96
96
  ### Read (26)
97
97
  | Tool | Description |
@@ -141,16 +141,17 @@ 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 |
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 |
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 |
148
148
  | `diviops_delete_canvas` | Delete a canvas page |
149
149
 
150
- ### Utility (1)
150
+ ### Utility (2)
151
151
  | Tool | Description |
152
152
  |------|-------------|
153
153
  | `diviops_wp_cli` | Run WP-CLI commands (allowlisted, requires `WP_PATH` or `WP_CLI_CMD`) |
154
+ | `diviops_flush_static_cache` | Flush Divi's compiled CSS cache under `wp-content/et-cache/`. `wp cache flush` does NOT touch these files — the frontend can keep serving stale CSS after mutations. Delegates to Divi's native clearer (`ET_Core_PageResource::remove_static_resources`) when available — also clears Theme Builder / archive / taxonomy / home / notfound CSS, object cache, module features cache, post features cache, dynamic assets cache, Google Fonts cache, post meta caches. Falls back to a filesystem walk of numeric-named subdirs when Divi is inactive. Response includes `backend: "divi_native"` or `"fs_fallback"`. Exactly one selector required: `post_id`, `all`, or `after` (unix ts) — no default to `all` |
154
155
 
155
156
  ## WP-CLI Security
156
157
 
@@ -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.22";
5
+ export declare const MIN_PLUGIN_VERSION = "1.0.0-beta.28";
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.22';
5
+ export const MIN_PLUGIN_VERSION = '1.0.0-beta.28';
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.',
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.',
1289
1289
  inputSchema: {
1290
1290
  type: z
1291
1291
  .enum(["colors", "numbers", "strings", "images", "links", "fonts"])
@@ -1299,12 +1299,36 @@ server.registerTool("diviops_create_variable", {
1299
1299
  .describe("Human-readable label shown in the VB Variable Manager"),
1300
1300
  value: z
1301
1301
  .string()
1302
- .describe('Variable value: hex color for colors (e.g. "#3a7a6a"), CSS value for numbers (e.g. "clamp(30px, 8vw, 100px)")'),
1302
+ .optional()
1303
+ .describe('Variable value (required unless using fluid min/max/targets for type=numbers): hex color for colors (e.g. "#3a7a6a"), CSS value for numbers (e.g. "clamp(30px, 8vw, 100px)" or "2rem")'),
1304
+ min: z
1305
+ .string()
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.'),
1308
+ max: z
1309
+ .string()
1310
+ .optional()
1311
+ .describe('Fluid maximum value in px (e.g. "60px"). Paired with min.'),
1312
+ targets: z
1313
+ .record(z.string(), z.string())
1314
+ .refine((m) => !m || Object.keys(m).length === 2, {
1315
+ message: "targets must contain exactly 2 viewport entries",
1316
+ })
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.'),
1303
1319
  },
1304
- }, async ({ type, id, label, value }) => {
1305
- const body = { type, label, value };
1320
+ }, async ({ type, id, label, value, min, max, targets }) => {
1321
+ const body = { type, label };
1322
+ if (value !== undefined)
1323
+ body.value = value;
1306
1324
  if (id)
1307
1325
  body.id = id;
1326
+ if (min !== undefined)
1327
+ body.min = min;
1328
+ if (max !== undefined)
1329
+ body.max = max;
1330
+ if (targets !== undefined)
1331
+ body.targets = targets;
1308
1332
  const result = await wp.request("/variable/create", {
1309
1333
  method: "POST",
1310
1334
  body,
@@ -1348,6 +1372,45 @@ server.registerTool("diviops_variables_scan_orphans", {
1348
1372
  ],
1349
1373
  };
1350
1374
  });
1375
+ server.registerTool("diviops_flush_static_cache", {
1376
+ description: "Flush Divi's compiled static CSS cache under wp-content/et-cache/. wp cache flush does NOT touch these files — the frontend can keep serving stale CSS after a preset/variable/module mutation until the cache is cleared. Delegates to Divi's native ET_Core_PageResource::remove_static_resources when available (response backend: \"divi_native\"), which additionally clears Theme Builder CSS scattered across other post dirs, archive/taxonomy/home/notfound CSS, the object cache, module features cache, post features cache, Google Fonts cache, dynamic assets cache, and post meta caches. Falls back to a targeted filesystem walk of numeric-named et-cache subdirs when the Divi class is absent (backend: \"fs_fallback\"). Provide exactly one selector — no site-wide default to prevent accidental full flush. Idempotent: missing cache root returns 200 with empty list.",
1377
+ inputSchema: {
1378
+ post_id: z
1379
+ .number()
1380
+ .int()
1381
+ .positive()
1382
+ .optional()
1383
+ .describe("Flush cache for one post. Native backend also clears matching Theme Builder CSS in other post dirs; fs_fallback only clears wp-content/et-cache/{post_id}/."),
1384
+ all: z
1385
+ .boolean()
1386
+ .optional()
1387
+ .default(false)
1388
+ .describe("Flush every cached file. Native backend clears archive/taxonomy/home/notfound CSS + multi-layer WP caches; fs_fallback only clears numeric-named subdirs (siblings like .cache-cleared-at, global/, en_US/, notfound/, *.data are preserved in either mode)."),
1389
+ after: z
1390
+ .number()
1391
+ .int()
1392
+ .positive()
1393
+ .optional()
1394
+ .describe("Unix timestamp — iterate numeric subdirs with mtime greater than this value, flushing each. Useful for flushing entries touched since a known deployment or mutation batch. Native clearer runs once per matched post."),
1395
+ },
1396
+ }, async ({ post_id, all, after }) => {
1397
+ const body = {};
1398
+ if (post_id !== undefined)
1399
+ body.post_id = post_id;
1400
+ if (all)
1401
+ body.all = true;
1402
+ if (after !== undefined)
1403
+ body.after = after;
1404
+ const result = await wp.request("/flush-static-cache", {
1405
+ method: "POST",
1406
+ body,
1407
+ });
1408
+ return {
1409
+ content: [
1410
+ { type: "text", text: JSON.stringify(result, null, 2) },
1411
+ ],
1412
+ };
1413
+ });
1351
1414
  // ── Start ────────────────────────────────────────────────────────────
1352
1415
  async function main() {
1353
1416
  // Version handshake — verify plugin compatibility before accepting tool calls.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diviops/mcp-server",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "MCP server exposing Divi 5 Visual Builder as tools for Claude",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",