@diviops/mcp-server 0.2.4 → 0.2.6

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,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 (48)
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,15 +142,16 @@ 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 |
148
149
 
149
- ### Utility (1)
150
+ ### Utility (2)
150
151
  | Tool | Description |
151
152
  |------|-------------|
152
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` |
153
155
 
154
156
  ## WP-CLI Security
155
157
 
package/dist/index.js CHANGED
@@ -1316,16 +1316,70 @@ 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 },
1334
+ });
1335
+ return {
1336
+ content: [
1337
+ { type: "text", text: JSON.stringify(result, null, 2) },
1338
+ ],
1339
+ };
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
+ });
1351
+ server.registerTool("diviops_flush_static_cache", {
1352
+ 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.",
1353
+ inputSchema: {
1354
+ post_id: z
1355
+ .number()
1356
+ .int()
1357
+ .positive()
1358
+ .optional()
1359
+ .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}/."),
1360
+ all: z
1361
+ .boolean()
1362
+ .optional()
1363
+ .default(false)
1364
+ .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)."),
1365
+ after: z
1366
+ .number()
1367
+ .int()
1368
+ .positive()
1369
+ .optional()
1370
+ .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."),
1371
+ },
1372
+ }, async ({ post_id, all, after }) => {
1373
+ const body = {};
1374
+ if (post_id !== undefined)
1375
+ body.post_id = post_id;
1376
+ if (all)
1377
+ body.all = true;
1378
+ if (after !== undefined)
1379
+ body.after = after;
1380
+ const result = await wp.request("/flush-static-cache", {
1381
+ method: "POST",
1382
+ body,
1329
1383
  });
1330
1384
  return {
1331
1385
  content: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diviops/mcp-server",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "MCP server exposing Divi 5 Visual Builder as tools for Claude",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",