@diviops/mcp-server 0.2.3 → 0.2.5

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.
Files changed (3) hide show
  1. package/README.md +19 -3
  2. package/dist/index.js +20 -5
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -91,9 +91,9 @@ 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 (46)
94
+ ## Available Tools (47)
95
95
 
96
- ### Read (25)
96
+ ### Read (26)
97
97
  | Tool | Description |
98
98
  |------|-------------|
99
99
  | `diviops_test_connection` | Test WordPress connection and Divi version |
@@ -119,6 +119,7 @@ The server connects via standard WordPress REST API and works with any environme
119
119
  | `diviops_list_tb_templates` | List Theme Builder templates with conditions and layout IDs |
120
120
  | `diviops_get_tb_layout` | Get a Theme Builder layout's block markup (header/body/footer) |
121
121
  | `diviops_list_variables` | List design token variables (filter by type or prefix) |
122
+ | `diviops_variables_scan_orphans` | Find `gvid-`/`gcid-` refs with no backing Variable Manager entry (orphans render as invalid CSS) + unused variables (defined, never referenced). Scans pages, Theme Builder layouts (header/body/footer), Divi Library items, canvas pages, and the preset registry |
122
123
  | `diviops_list_canvases` | List all canvas pages |
123
124
  | `diviops_get_canvas` | Get canvas content |
124
125
 
@@ -141,7 +142,7 @@ The server connects via standard WordPress REST API and works with any environme
141
142
  | `diviops_update_tb_layout` | Update a Theme Builder layout's block markup |
142
143
  | `diviops_create_tb_template` | Create Theme Builder template with header/footer and conditions |
143
144
  | `diviops_create_variable` | Create a design token variable |
144
- | `diviops_delete_variable` | Delete a variable by ID |
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) |
145
146
  | `diviops_create_canvas` | Create a canvas page |
146
147
  | `diviops_update_canvas` | Update canvas content |
147
148
  | `diviops_delete_canvas` | Delete a canvas page |
@@ -237,6 +238,21 @@ The MCP server and WP plugin versions are incompatible. Update whichever side is
237
238
  curl -u "username:apppassword" http://site.local/wp-json/diviops/v1/settings
238
239
  ```
239
240
 
241
+ ### Preset edits not visible on the frontend
242
+
243
+ After `preset_update` / `preset_create`, the preset option is updated immediately but Divi serves frontend CSS from a **per-post static cache** that neither `wp cache flush` nor `wp transient delete --all` invalidates.
244
+
245
+ Cache location: `wp-content/et-cache/{post_id}/` — contains files like `et-divi-dynamic-tb-*-{post_id}-critical.css` with preset CSS baked in.
246
+
247
+ To force regeneration for a specific page:
248
+ ```bash
249
+ rm -rf wp-content/et-cache/{post_id}/
250
+ ```
251
+
252
+ Next visit re-renders and writes fresh CSS. Applies to: any change that affects preset-derived CSS output (preset_update, preset_create when used by an existing page, preset_reassign in apply mode).
253
+
254
+ The preset option (`et_divi_builder_global_presets_d5`) always reflects the current MCP-written state — if `wp option get et_divi_builder_global_presets_d5` shows your change but the frontend doesn't, it's this cache.
255
+
240
256
  ## License
241
257
 
242
258
  MIT
package/dist/index.js CHANGED
@@ -620,14 +620,14 @@ server.registerTool("diviops_preset_cleanup", {
620
620
  };
621
621
  });
622
622
  server.registerTool("diviops_preset_update", {
623
- description: "Update a specific preset by ID. Can rename and/or replace its style attributes.",
623
+ description: "Update a specific preset by ID. Can rename and/or replace its style attributes. Note: Divi serves frontend CSS from a per-post static cache at wp-content/et-cache/{post_id}/ that wp cache flush does NOT invalidate — if you're verifying a preset change on the rendered frontend, delete that dir for affected pages to force regeneration. Server-side preset state updates immediately; only the pre-rendered CSS file is stale.",
624
624
  inputSchema: {
625
625
  preset_id: z.string().describe("Preset ID (UUID or short ID)"),
626
626
  name: z.string().optional().describe("New display name for the preset"),
627
627
  attrs: z
628
628
  .record(z.string(), z.any())
629
629
  .optional()
630
- .describe("New style attributes (replaces both attrs and styleAttrs)"),
630
+ .describe("New style attributes (replaces attrs, styleAttrs, and renderAttrs — matches VB save semantics so render cache stays in sync with edit state)"),
631
631
  },
632
632
  }, async ({ preset_id, name, attrs }) => {
633
633
  const body = { preset_id };
@@ -1316,16 +1316,21 @@ server.registerTool("diviops_create_variable", {
1316
1316
  };
1317
1317
  });
1318
1318
  server.registerTool("diviops_delete_variable", {
1319
- description: "Delete a design token variable by ID. Auto-detects storage from ID prefix (gcid-* = colors, gvid-* = numbers/strings/etc).",
1319
+ description: "Delete a design token variable by ID. Auto-detects storage from ID prefix (gcid-* = colors, gvid-* = numbers/strings/etc). Returns HTTP 409 when live references exist unless force=true — run diviops_variables_scan_orphans to see where the references live. Returns HTTP 403 for Divi's customizer-bound defaults (gcid-primary-color, gcid-secondary-color, gcid-heading-color, gcid-body-color, gcid-link-color); those are managed via WP Customizer theme options and can't be deleted via this tool.",
1320
1320
  inputSchema: {
1321
1321
  id: z
1322
1322
  .string()
1323
1323
  .describe('Variable ID to delete (e.g. "gcid-oa-accent" or "gvid-oa-size-xl")'),
1324
+ force: z
1325
+ .boolean()
1326
+ .optional()
1327
+ .default(false)
1328
+ .describe("Delete even if live references exist. Orphans will remain in page/preset content and render as invalid CSS on the frontend — run diviops_variables_scan_orphans afterwards to audit."),
1324
1329
  },
1325
- }, async ({ id }) => {
1330
+ }, async ({ id, force }) => {
1326
1331
  const result = await wp.request("/variable/delete", {
1327
1332
  method: "POST",
1328
- body: { id },
1333
+ body: { id, force },
1329
1334
  });
1330
1335
  return {
1331
1336
  content: [
@@ -1333,6 +1338,16 @@ server.registerTool("diviops_delete_variable", {
1333
1338
  ],
1334
1339
  };
1335
1340
  });
1341
+ server.registerTool("diviops_variables_scan_orphans", {
1342
+ description: "Scan pages, Theme Builder layouts (header/body/footer), Divi Library items, canvas pages, and the preset registry for gvid-/gcid- references that have no backing entry in the Variable Manager (orphans), plus variables defined but referenced nowhere (unused). Orphans render as invalid CSS on the frontend — the $variable()$ resolver falls through with no fallback. Use after a deletion with force=true, or periodically as a hygiene check. Symmetric to diviops_preset_scan_orphans.",
1343
+ }, async () => {
1344
+ const result = await wp.request("/variables-scan-orphans");
1345
+ return {
1346
+ content: [
1347
+ { type: "text", text: JSON.stringify(result, null, 2) },
1348
+ ],
1349
+ };
1350
+ });
1336
1351
  // ── Start ────────────────────────────────────────────────────────────
1337
1352
  async function main() {
1338
1353
  // 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.3",
3
+ "version": "0.2.5",
4
4
  "description": "MCP server exposing Divi 5 Visual Builder as tools for Claude",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",