@diviops/mcp-server 1.5.37 → 1.5.38

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
@@ -83,7 +83,7 @@ The skill enforces the Divi block format, the design system, and the response co
83
83
 
84
84
  ## Tools at a glance
85
85
 
86
- The server exposes **91 always-on tools** across the categories below. Each category links to representative tools; the full table lives in [server-reference.md](../docs/server-reference.md).
86
+ The server exposes **94 always-on tools** across the categories below. Each category links to representative tools; the full table lives in [server-reference.md](../docs/server-reference.md).
87
87
 
88
88
  | Category | Use case | Tool prefixes |
89
89
  |----------|----------|---------------|
@@ -91,6 +91,7 @@ The server exposes **91 always-on tools** across the categories below. Each cate
91
91
  | Design system | Manage colors, fonts, variables, presets | `variable_*`, `global_color_*`, `global_font_*`, `preset_*` |
92
92
  | Library + templates | Reusable layouts + Theme Builder | `library_*`, `template_*`, `tb_*` |
93
93
  | WordPress menus | Author reusable nav menus and theme-location assignments | `menu_*` |
94
+ | Semantic SEO metadata | Inspect provider support and author two explicit TSF text fields with checksum/readback guards | `seo_*` |
94
95
  | Schema introspection | Module attribute discovery | `schema_*` |
95
96
  | Canvas / off-canvas | Popups, modals, menus | `canvas_*` |
96
97
  | SCF integration | Secure Custom Fields sync | `scf_*` |
@@ -274,13 +275,13 @@ Tools return a standardized envelope. The shape lets clients branch on `ok` and
274
275
  | `validation_failed` | 400 | `validate_blocks`-detected shape error |
275
276
  | `conflict` | 409 | Uniqueness collision |
276
277
  | `forbidden` | 403 | Row-level WordPress auth signal |
277
- | `capability_missing` | 412 | Plugin version below required for this tool |
278
+ | `capability_missing` | 412 | Connected plugin does not advertise the capability required by this tool; component versions are independent |
278
279
  | `wp_error` | 500 | Underlying WordPress error |
279
280
  | `divi_error` | 500 | Divi-specific error (block parser, validator, etc.) |
280
281
 
281
282
  ### Namespace-specific codes
282
283
 
283
- Namespaces extend the vocabulary using the `<namespace>.<reason>` convention — e.g. `meta_wp_cli.command_failed`, `scf.not_configured`, `preset.bucket_mismatch`, `variable.customizer_default_immutable`. Namespace-prefixed codes carry structured `error.data` documenting the failure (exit codes, conflicting fields, reference counts, etc.). Per-tool descriptions name the codes each tool emits and the `error.data` shape that accompanies them.
284
+ Namespaces extend the vocabulary using the `<namespace>.<reason>` convention — e.g. `meta_wp_cli.command_failed`, `scf.not_configured`, `preset.bucket_mismatch`, `variable.customizer_default_immutable`, `seo.provider_absent`, and `seo.metadata_drift`. Namespace-prefixed codes carry structured `error.data` documenting the failure (exit codes, conflicting fields, reference counts, checksums, rollback evidence, etc.). Per-tool descriptions name the codes each tool emits and the `error.data` shape that accompanies them.
284
285
 
285
286
  ### Per-tool `error.data` extensions
286
287
 
@@ -319,6 +320,13 @@ permission, refuses content or supported Divi post-meta drift before mutation,
319
320
  uses the same full-content integrity/readback guard, and has no force override
320
321
  or second pre-restore snapshot in this MVP.
321
322
 
323
+ `diviops_seo_metadata_update` is a separate explicit-metadata-only path. It
324
+ accepts no raw provider keys, requires the checksum from
325
+ `diviops_seo_metadata_get`, validates plain text before TSF sanitization,
326
+ verifies exact stored readback, and performs request-local restoration on a
327
+ mismatch. It does not create a persistent rollback snapshot; effective
328
+ provider output is verified through a follow-up get request.
329
+
322
330
  ### `_meta.idempotent` markers
323
331
 
324
332
  Every tool's `_meta.idempotent` field documents how it behaves under repeat calls with identical inputs. Some tools are silent-success idempotent (e.g. `page_trash` on an already-trashed post returns `ok: true` with `data.already_trashed = true`); others are side-effect-equivalent (re-running produces the same final state via different intermediate effects). See [idempotency-audit.md](../docs/idempotency-audit.md) for the per-tool record.
@@ -350,7 +358,7 @@ Common quick fixes — full reference in [troubleshooting.md](../docs/troublesho
350
358
  - **"Missing required environment variable(s)"** — ensure `WP_URL`, `WP_USER`, `WP_APP_PASSWORD` are all set on `claude mcp add`.
351
359
  - **`npx` fails with "could not determine executable to run"** — use `npx -y --package @diviops/mcp-server diviops-mcp`; this explicitly selects the MCP server bin.
352
360
  - **"Connection failed"** — verify the plugin is active by visiting `{WP_URL}/wp-json/diviops/v1/schema/settings`; test the credentials with `curl -u "user:pass" …`.
353
- - **"This tool requires plugin capability"** — the plugin doesn't advertise the capability this tool needs. Update the plugin to the latest release.
361
+ - **"This tool requires plugin capability"** — the connected plugin does not advertise the capability this tool needs. Server and plugin versions are independent; install a compatible plugin from the same DiviOps suite release or a newer supported component, then reconnect or restart the MCP session to refresh the handshake.
354
362
  - **Preset edits not visible on the frontend** — Divi serves frontend CSS from `wp-content/et-cache/{post_id}/`, which `wp cache flush` doesn't touch. Use `diviops_meta_flush_cache` after preset writes; `post_id` mode also sweeps that exact directory and reports `post_dir_sweep` evidence.
355
363
 
356
364
  ## Learn more
@@ -5,8 +5,13 @@ export type MissingCapabilityMcpResult = {
5
5
  text: string;
6
6
  }>;
7
7
  };
8
+ export type MissingCapabilityEnvelopeOptions = {
9
+ hint?: string;
10
+ serverVersion?: string | null;
11
+ releaseEvidence?: unknown;
12
+ };
8
13
  /**
9
14
  * Convert a server-side capability gate failure into the canonical DiviOps
10
15
  * response envelope carried in MCP text content.
11
16
  */
12
- export declare function missingCapabilityEnvelope(error: MissingCapabilityError, toolName: string, hint?: string): MissingCapabilityMcpResult;
17
+ export declare function missingCapabilityEnvelope(error: MissingCapabilityError, toolName: string, options?: MissingCapabilityEnvelopeOptions): MissingCapabilityMcpResult;
@@ -1,21 +1,32 @@
1
+ import { capabilityUpgradeHint, observedVersion, } from "./compatibility.js";
1
2
  import { ErrorCodes, serializeEnvelope, } from "./envelope.js";
2
- const DEFAULT_HINT = "Update the diviops-agent WP plugin to the version shipped with this MCP server release.";
3
3
  /**
4
4
  * Convert a server-side capability gate failure into the canonical DiviOps
5
5
  * response envelope carried in MCP text content.
6
6
  */
7
- export function missingCapabilityEnvelope(error, toolName, hint = DEFAULT_HINT) {
7
+ export function missingCapabilityEnvelope(error, toolName, options = {}) {
8
+ const pluginVersion = observedVersion(error.pluginVersion);
9
+ const serverVersion = observedVersion(options.serverVersion);
10
+ const diagnosticData = {
11
+ capability: error.capability,
12
+ plugin_component: error.pluginComponent === "pro" ? "diviops-agent-pro" : "diviops-agent",
13
+ tool: toolName,
14
+ };
15
+ if (pluginVersion)
16
+ diagnosticData.plugin_version = pluginVersion;
17
+ if (serverVersion)
18
+ diagnosticData.server_version = serverVersion;
19
+ if (options.releaseEvidence !== undefined) {
20
+ diagnosticData.release_evidence = options.releaseEvidence;
21
+ }
8
22
  const failure = {
9
23
  ok: false,
10
24
  error: {
11
25
  code: ErrorCodes.CAPABILITY_MISSING,
12
26
  message: error.message,
13
- hint,
14
- data: {
15
- capability: error.capability,
16
- plugin_version: error.pluginVersion,
17
- tool: toolName,
18
- },
27
+ hint: options.hint ??
28
+ capabilityUpgradeHint(error.capability, error.pluginComponent),
29
+ data: diagnosticData,
19
30
  },
20
31
  };
21
32
  return {
@@ -6,12 +6,11 @@
6
6
  * `/handshake`. See `wp-client.ts` (handshake parse) and `index.ts`
7
7
  * (`requireCapability` gate at each plugin-touching tool entry).
8
8
  *
9
- * Implicit floor: pre-1.2.0 plugins emit `capabilities` as a string[] of
10
- * coarse namespace tags, not the per-tool map this server expects.
11
- * `wp-client.ts` normalizes that legacy shape to an empty map, which makes
12
- * every gated tool fail fast with the upgrade hint. So while there is no
13
- * declared `MIN_PLUGIN_VERSION` constant, the capability-map shape change
14
- * effectively sets a 1.2.0 floor for any tool that calls `requireCapability`.
9
+ * Legacy plugins may emit `capabilities` as a string[] of coarse namespace
10
+ * tags, not the per-tool map this server expects. `wp-client.ts` normalizes
11
+ * that legacy shape to an empty map, which makes every gated tool fail fast
12
+ * with capability-based upgrade guidance. No numeric plugin-version floor is
13
+ * inferred from that legacy response.
15
14
  *
16
15
  * `compareVersions` is kept exported because handshake helper code and
17
16
  * future per-tool soft-deprecation messages may want it.
@@ -64,7 +63,7 @@ export interface HandshakePluginInfo {
64
63
  */
65
64
  export interface HandshakeResult {
66
65
  compatible: boolean;
67
- plugin_version: string;
66
+ plugin_version?: string | null;
68
67
  min_server: string;
69
68
  divi: {
70
69
  active: boolean;
@@ -99,6 +98,10 @@ export declare function proToolGatesSatisfied(state: {
99
98
  */
100
99
  export declare class MissingCapabilityError extends Error {
101
100
  readonly capability: string;
102
- readonly pluginVersion: string;
103
- constructor(capability: string, pluginVersion: string);
101
+ readonly pluginVersion?: string | null | undefined;
102
+ readonly pluginComponent: "free" | "pro";
103
+ constructor(capability: string, pluginVersion?: string | null | undefined, pluginComponent?: "free" | "pro");
104
104
  }
105
+ export declare function observedVersion(version?: string | null): string | null;
106
+ export declare function capabilityMissingMessage(capability: string, pluginVersion?: string | null, pluginComponent?: "free" | "pro"): string;
107
+ export declare function capabilityUpgradeHint(capability: string, pluginComponent?: "free" | "pro", alternative?: string): string;
@@ -6,12 +6,11 @@
6
6
  * `/handshake`. See `wp-client.ts` (handshake parse) and `index.ts`
7
7
  * (`requireCapability` gate at each plugin-touching tool entry).
8
8
  *
9
- * Implicit floor: pre-1.2.0 plugins emit `capabilities` as a string[] of
10
- * coarse namespace tags, not the per-tool map this server expects.
11
- * `wp-client.ts` normalizes that legacy shape to an empty map, which makes
12
- * every gated tool fail fast with the upgrade hint. So while there is no
13
- * declared `MIN_PLUGIN_VERSION` constant, the capability-map shape change
14
- * effectively sets a 1.2.0 floor for any tool that calls `requireCapability`.
9
+ * Legacy plugins may emit `capabilities` as a string[] of coarse namespace
10
+ * tags, not the per-tool map this server expects. `wp-client.ts` normalizes
11
+ * that legacy shape to an empty map, which makes every gated tool fail fast
12
+ * with capability-based upgrade guidance. No numeric plugin-version floor is
13
+ * inferred from that legacy response.
15
14
  *
16
15
  * `compareVersions` is kept exported because handshake helper code and
17
16
  * future per-tool soft-deprecation messages may want it.
@@ -100,11 +99,41 @@ export function proToolGatesSatisfied(state, gates) {
100
99
  export class MissingCapabilityError extends Error {
101
100
  capability;
102
101
  pluginVersion;
103
- constructor(capability, pluginVersion) {
104
- super(`Tool requires plugin capability "${capability}", which is not present in the active diviops-agent plugin (version ${pluginVersion}). ` +
105
- 'Upgrade the diviops-agent plugin to the version shipped alongside this MCP server release.');
102
+ pluginComponent;
103
+ constructor(capability, pluginVersion, pluginComponent = "free") {
104
+ super(capabilityMissingMessage(capability, pluginVersion, pluginComponent));
106
105
  this.capability = capability;
107
106
  this.pluginVersion = pluginVersion;
107
+ this.pluginComponent = pluginComponent;
108
108
  this.name = 'MissingCapabilityError';
109
109
  }
110
110
  }
111
+ export function observedVersion(version) {
112
+ if (typeof version !== "string")
113
+ return null;
114
+ const normalized = version.trim();
115
+ return normalized && normalized.toLowerCase() !== "unknown"
116
+ ? normalized
117
+ : null;
118
+ }
119
+ export function capabilityMissingMessage(capability, pluginVersion, pluginComponent = "free") {
120
+ const component = pluginComponent === "pro"
121
+ ? "Pro WordPress plugin"
122
+ : "Free WordPress plugin";
123
+ const version = observedVersion(pluginVersion);
124
+ const versionEvidence = version ? ` (observed version ${version})` : "";
125
+ return (`The connected ${component}${versionEvidence} does not advertise ` +
126
+ `the "${capability}" capability required by this operation. ` +
127
+ "MCP server and WordPress plugin versions are independent.");
128
+ }
129
+ export function capabilityUpgradeHint(capability, pluginComponent = "free", alternative) {
130
+ const component = pluginComponent === "pro"
131
+ ? "Pro WordPress plugin"
132
+ : "Free WordPress plugin";
133
+ const fallback = alternative ? ` ${alternative}` : "";
134
+ return ("MCP server and WordPress plugin versions are independent. " +
135
+ `Install a compatible ${component} from the same DiviOps suite release ` +
136
+ `or a newer supported component that advertises "${capability}", then ` +
137
+ "reconnect or restart the MCP session to refresh the capability handshake." +
138
+ fallback);
139
+ }
@@ -61,7 +61,7 @@ export declare const ErrorCodes: {
61
61
  readonly WP_ERROR: "wp_error";
62
62
  /** Divi-specific error (block parser, validator, etc.). HTTP 500. */
63
63
  readonly DIVI_ERROR: "divi_error";
64
- /** Plugin version below required for this tool (#486 handshake miss). HTTP 412. */
64
+ /** Connected plugin does not advertise the required capability. HTTP 412. */
65
65
  readonly CAPABILITY_MISSING: "capability_missing";
66
66
  /** validate_blocks-detected shape error in submitted markup. HTTP 400. */
67
67
  readonly VALIDATION_FAILED: "validation_failed";
package/dist/envelope.js CHANGED
@@ -29,7 +29,7 @@ export const ErrorCodes = {
29
29
  WP_ERROR: "wp_error",
30
30
  /** Divi-specific error (block parser, validator, etc.). HTTP 500. */
31
31
  DIVI_ERROR: "divi_error",
32
- /** Plugin version below required for this tool (#486 handshake miss). HTTP 412. */
32
+ /** Connected plugin does not advertise the required capability. HTTP 412. */
33
33
  CAPABILITY_MISSING: "capability_missing",
34
34
  /** validate_blocks-detected shape error in submitted markup. HTTP 400. */
35
35
  VALIDATION_FAILED: "validation_failed",
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
12
12
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
13
13
  import { z } from "zod";
14
14
  import { WPClient } from "./wp-client.js";
15
- import { MissingCapabilityError, proToolGatesSatisfied, } from "./compatibility.js";
15
+ import { capabilityUpgradeHint, MissingCapabilityError, observedVersion, proToolGatesSatisfied, } from "./compatibility.js";
16
16
  import { missingCapabilityEnvelope, } from "./capability-envelope.js";
17
17
  import { ErrorCodes, envelopeMap, recordIdempotent, serializeEnvelope, withCode, wrapResponse, } from "./envelope.js";
18
18
  import { preflightCrossEnvHeaderSync, } from "./cross-env-preflight/header-preflight.js";
@@ -310,7 +310,10 @@ function backupCapabilityError(toolName, backup) {
310
310
  }
311
311
  catch (e) {
312
312
  if (e instanceof MissingCapabilityError) {
313
- return missingCapabilityEnvelope(e, toolName, "Update the diviops-agent WP plugin to a version that supports rollback snapshot backup, or omit backup:true from this call.");
313
+ return missingCapabilityEnvelope(e, toolName, {
314
+ serverVersion: SERVER_VERSION,
315
+ hint: capabilityUpgradeHint(e.capability, e.pluginComponent, "Alternatively, omit backup:true from this call."),
316
+ });
314
317
  }
315
318
  throw e;
316
319
  }
@@ -339,7 +342,9 @@ function registerPluginTool(name, config, handler) {
339
342
  }
340
343
  catch (e) {
341
344
  if (e instanceof MissingCapabilityError) {
342
- return missingCapabilityEnvelope(e, name);
345
+ return missingCapabilityEnvelope(e, name, {
346
+ serverVersion: SERVER_VERSION,
347
+ });
343
348
  }
344
349
  throw e;
345
350
  }
@@ -438,7 +443,67 @@ const BACKUP_FIELD = z
438
443
  .optional()
439
444
  .default(false)
440
445
  .describe("When true on supported content writes, capture a rollback snapshot before applying. dry_run + backup only reports the planned snapshot and does not create one.");
446
+ const SEO_FIELD = z.enum(["seo_title", "meta_description"]);
447
+ const SEO_PROVIDER = z.enum(["auto", "tsf"]);
448
+ const SEO_CHANGE = z.discriminatedUnion("action", [
449
+ z.strictObject({
450
+ field: SEO_FIELD,
451
+ action: z.literal("set"),
452
+ value: z.string(),
453
+ }),
454
+ z.strictObject({
455
+ field: SEO_FIELD,
456
+ action: z.literal("clear"),
457
+ }),
458
+ ]);
459
+ const SEO_CHANGES = z
460
+ .array(SEO_CHANGE)
461
+ .min(1)
462
+ .max(2)
463
+ .superRefine((changes, context) => {
464
+ const seen = new Set();
465
+ changes.forEach((change, index) => {
466
+ if (seen.has(change.field)) {
467
+ context.addIssue({
468
+ code: "custom",
469
+ message: `Duplicate operation for semantic field '${change.field}'.`,
470
+ path: [index, "field"],
471
+ });
472
+ }
473
+ seen.add(change.field);
474
+ });
475
+ });
441
476
  // ── Read Tools ───────────────────────────────────────────────────────
477
+ registerPluginTool("diviops_seo_provider_list", {
478
+ description: "List the Free/core semantic SEO provider adapters and their installed, active, version, compatibility, field, and capability evidence. The first MVP reports only The SEO Framework and never loads an inactive provider. This is discovery only: it returns no post payload and provides no provider installation or activation path. Returns the standardized envelope.",
479
+ inputSchema: {},
480
+ annotations: { idempotentHint: true },
481
+ _meta: { idempotent: "true" },
482
+ }, async () => {
483
+ const result = await wp.requestEnveloped("/seo/provider/list");
484
+ return {
485
+ content: [
486
+ { type: "text", text: serializeEnvelope(result, "diviops_seo_provider_list") },
487
+ ],
488
+ };
489
+ });
490
+ registerPluginTool("diviops_seo_metadata_get", {
491
+ description: "Read explicit and effective semantic SEO metadata for one provider-supported post. Free/core and explicit-metadata-only: caller-visible fields are fixed to seo_title and meta_description; no raw metadata keys or provider maps are accepted or returned. Requires edit_post before stored payload exposure. Returns exact explicit presence/value, effective provider output, deterministic checksum, provider lifecycle/capability evidence, canonical WordPress identity evidence, and cache status. Error codes include not_found, forbidden, seo.provider_absent, seo.provider_incompatible, seo.provider_unsupported, and seo.post_type_unsupported. Returns the standardized envelope.",
492
+ inputSchema: {
493
+ post_id: z.number().int().positive().describe("WordPress post/page ID to inspect. Requires edit_post on this exact target."),
494
+ provider: SEO_PROVIDER.optional().default("auto").describe("Provider selector. auto resolves only the active supported TSF adapter in V1."),
495
+ },
496
+ annotations: { idempotentHint: true },
497
+ _meta: { idempotent: "true" },
498
+ }, async ({ post_id, provider }) => {
499
+ const params = new URLSearchParams({ provider: provider ?? "auto" }).toString();
500
+ const result = await wp.requestEnveloped(`/seo/metadata/${post_id}?${params}`);
501
+ return {
502
+ content: [
503
+ { type: "text", text: serializeEnvelope(result, "diviops_seo_metadata_get") },
504
+ ],
505
+ };
506
+ });
442
507
  registerPluginTool("diviops_page_list", {
443
508
  description: "List pages/posts in the WordPress site. Returns title, ID, URL, status, and whether each page uses Divi builder. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }.",
444
509
  inputSchema: {
@@ -743,7 +808,10 @@ registerPluginTool("diviops_schema_get_module", {
743
808
  if (handshakeState.kind === "ok" &&
744
809
  !handshakeState.capabilities["schema_get_module_dump_all"]) {
745
810
  const err = new MissingCapabilityError("schema_get_module_dump_all", handshakeState.pluginVersion);
746
- return missingCapabilityEnvelope(err, "diviops_schema_get_module", "Update the diviops-agent WP plugin to a version that exposes the dump-all surface, or use mode:'single'.");
811
+ return missingCapabilityEnvelope(err, "diviops_schema_get_module", {
812
+ serverVersion: SERVER_VERSION,
813
+ hint: capabilityUpgradeHint(err.capability, err.pluginComponent, "Alternatively, use mode:'single'."),
814
+ });
747
815
  }
748
816
  const result = await wp.requestEnveloped("/schema/module/dump-all");
749
817
  return {
@@ -1125,6 +1193,39 @@ registerPluginTool("diviops_meta_find_icon", {
1125
1193
  };
1126
1194
  });
1127
1195
  // ── Write Tools ──────────────────────────────────────────────────────
1196
+ registerPluginTool("diviops_seo_metadata_update", {
1197
+ description: "Update explicit TSF SEO metadata on one provider-supported post through the Free/core semantic contract. Explicit metadata only: changes is a strict one-or-two-item discriminated list for seo_title and meta_description; set requires a plain-text value and clear forbids one. Unknown properties, duplicate fields, HTML/markup, control or invalid UTF-8 bytes, serialized/non-scalar values, secret-like values, and unresolved Divi/global/provider/dynamic tokens are refused before mutation. Requires edit_post and expected_checksum; drift refuses before mutation with no force path. Uses TSF's public sanitize/write/clear lifecycle, exact stored readback, request-local rollback on error/mismatch, and reports before/after checksums, readback, lifecycle, cache, rollback, no-op, and write evidence. Effective output must be verified by a follow-up diviops_seo_metadata_get. No persistent snapshot, canonical override, robots, social, schema, redirect, bulk, cross-site, or automatic Divi extraction path exists." +
1198
+ DRY_RUN_DESC_SUFFIX,
1199
+ inputSchema: {
1200
+ post_id: z.number().int().positive().describe("WordPress post/page ID to update. Requires edit_post on this exact target."),
1201
+ provider: SEO_PROVIDER.optional().default("auto").describe("Provider selector. Use auto or tsf."),
1202
+ expected_checksum: z
1203
+ .string()
1204
+ .regex(/^sha256:[a-f0-9]{64}$/)
1205
+ .describe("Exact checksum returned by diviops_seo_metadata_get. Required; there is no force path."),
1206
+ changes: SEO_CHANGES.describe("Strict semantic set/clear operations. Each field may appear at most once."),
1207
+ dry_run: DRY_RUN_FIELD,
1208
+ },
1209
+ annotations: { idempotentHint: false },
1210
+ _meta: { idempotent: "conditional" },
1211
+ }, async ({ post_id, provider, expected_checksum, changes, dry_run }) => {
1212
+ const body = {
1213
+ provider: provider ?? "auto",
1214
+ expected_checksum,
1215
+ changes,
1216
+ };
1217
+ if (dry_run)
1218
+ body.dry_run = true;
1219
+ const result = await wp.requestEnveloped(`/seo/metadata/${post_id}`, {
1220
+ method: "POST",
1221
+ body,
1222
+ });
1223
+ return {
1224
+ content: [
1225
+ { type: "text", text: serializeEnvelope(result, "diviops_seo_metadata_update") },
1226
+ ],
1227
+ };
1228
+ });
1128
1229
  registerPluginTool("diviops_page_update_content", {
1129
1230
  description: "Update the content of a page with Divi block markup. The content should be valid WordPress block markup using divi/* blocks. IMPORTANT: This overwrites the entire page content. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; missing page_id returns 'not_found', edit-permission failures return 'forbidden' (HTTP 403), non-string content returns 'invalid_input' with `error.data = { field, received_type }`." +
1130
1231
  DRY_RUN_DESC_SUFFIX,
@@ -1240,7 +1341,10 @@ registerPluginTool("diviops_render_preview", {
1240
1341
  }
1241
1342
  catch (e) {
1242
1343
  if (e instanceof MissingCapabilityError) {
1243
- return missingCapabilityEnvelope(e, "diviops_render_preview", "Update the diviops-agent WP plugin to a version that supports page_id rendering, or provide inline content instead.");
1344
+ return missingCapabilityEnvelope(e, "diviops_render_preview", {
1345
+ serverVersion: SERVER_VERSION,
1346
+ hint: capabilityUpgradeHint(e.capability, e.pluginComponent, "Alternatively, provide inline content instead."),
1347
+ });
1244
1348
  }
1245
1349
  throw e;
1246
1350
  }
@@ -1277,7 +1381,10 @@ registerPluginTool("diviops_validate_blocks", {
1277
1381
  }
1278
1382
  catch (e) {
1279
1383
  if (e instanceof MissingCapabilityError) {
1280
- return missingCapabilityEnvelope(e, "diviops_validate_blocks", "Update the diviops-agent WP plugin to a version that supports page_id validation, or provide inline content instead.");
1384
+ return missingCapabilityEnvelope(e, "diviops_validate_blocks", {
1385
+ serverVersion: SERVER_VERSION,
1386
+ hint: capabilityUpgradeHint(e.capability, e.pluginComponent, "Alternatively, provide inline content instead."),
1387
+ });
1281
1388
  }
1282
1389
  throw e;
1283
1390
  }
@@ -4845,8 +4952,11 @@ function registerProTools() {
4845
4952
  if (global_update_file !== undefined &&
4846
4953
  handshakeState.kind === "ok" &&
4847
4954
  !handshakeState.capabilities["fluentcart_license_update_file_set"]) {
4848
- const err = new MissingCapabilityError("fluentcart_license_update_file_set", handshakeState.pluginVersion);
4849
- return missingCapabilityEnvelope(err, "diviops_fc_license_settings_update", "Update the diviops-agent-pro WP plugin to a version that supports authoring the global_update_file pointer, or omit global_update_file from this call.");
4955
+ const err = new MissingCapabilityError("fluentcart_license_update_file_set", handshakeState.proVersion, "pro");
4956
+ return missingCapabilityEnvelope(err, "diviops_fc_license_settings_update", {
4957
+ serverVersion: SERVER_VERSION,
4958
+ hint: capabilityUpgradeHint(err.capability, err.pluginComponent, "Alternatively, omit global_update_file from this call."),
4959
+ });
4850
4960
  }
4851
4961
  const body = {};
4852
4962
  if (enabled !== undefined)
@@ -5455,7 +5565,7 @@ async function main() {
5455
5565
  handshakeState = {
5456
5566
  kind: "ok",
5457
5567
  capabilities: hs.capabilities,
5458
- pluginVersion: hs.plugin_version,
5568
+ pluginVersion: observedVersion(hs.plugin_version),
5459
5569
  proVersion: hs.pro_version,
5460
5570
  proActive: hs.pro_active === true,
5461
5571
  availableTargets: hs.available_targets ?? {},
@@ -5469,9 +5579,9 @@ async function main() {
5469
5579
  const proInfo = handshakeState.proActive
5470
5580
  ? `Pro active (${hs.pro_version ?? "version unknown"})`
5471
5581
  : "Pro inactive";
5472
- console.error(`Handshake OK: plugin ${hs.plugin_version}, ${diviInfo}, ${proInfo}, ${capCount} capabilities`);
5582
+ console.error(`Handshake OK: plugin ${hs.plugin_version ?? "version unknown"}, ${diviInfo}, ${proInfo}, ${capCount} capabilities`);
5473
5583
  if (capCount === 0) {
5474
- console.error("Warning: plugin returned an empty capability map. Plugin-touching tools will fail with an upgrade hint. Update diviops-agent to ≥1.2.0.");
5584
+ console.error("Warning: plugin returned an empty capability map. Plugin-touching tools will refuse with capability-based upgrade guidance; install a compatible Free plugin component and reconnect the MCP session.");
5475
5585
  }
5476
5586
  }
5477
5587
  catch (error) {
@@ -8,13 +8,13 @@
8
8
  *
9
9
  * Before any network call the CLI rejects foreign CSS aliases in attrs, then
10
10
  * verifies the plugin handshake reports `storage_multipath_probe_v1` (the
11
- * storage-path capability contract, shipped in plugin 1.4.9).
11
+ * storage-path capability contract).
12
12
  *
13
13
  * `--dry-run` never reaches this module: it requires no credentials, no
14
14
  * handshake, and no network.
15
15
  */
16
16
  import { WPClient } from "../wp-client.js";
17
- import type { HandshakeResult } from "../compatibility.js";
17
+ import { type HandshakeResult } from "../compatibility.js";
18
18
  import type { DiviopsResponse } from "../envelope.js";
19
19
  import { type ForeignVarRef } from "../validate-attrs.js";
20
20
  import type { ButtonPresetEntry } from "./button-emitter.js";
@@ -39,8 +39,10 @@ export declare class CredentialsMissingError extends Error {
39
39
  }
40
40
  export declare class CapabilityMissingError extends Error {
41
41
  readonly capability: string;
42
- readonly pluginVersion: string;
43
- constructor(capability: string, pluginVersion: string);
42
+ readonly pluginVersion: string | null | undefined;
43
+ readonly serverVersion: string | null | undefined;
44
+ readonly tool: string;
45
+ constructor(capability: string, pluginVersion: string | null | undefined, serverVersion: string | null | undefined, tool?: string);
44
46
  }
45
47
  export declare class PresetIsolationError extends Error {
46
48
  readonly refs: ForeignVarRef[];
@@ -8,12 +8,13 @@
8
8
  *
9
9
  * Before any network call the CLI rejects foreign CSS aliases in attrs, then
10
10
  * verifies the plugin handshake reports `storage_multipath_probe_v1` (the
11
- * storage-path capability contract, shipped in plugin 1.4.9).
11
+ * storage-path capability contract).
12
12
  *
13
13
  * `--dry-run` never reaches this module: it requires no credentials, no
14
14
  * handshake, and no network.
15
15
  */
16
16
  import { WPClient } from "../wp-client.js";
17
+ import { capabilityMissingMessage, capabilityUpgradeHint, observedVersion, } from "../compatibility.js";
17
18
  import { formatIsolationError, scanAttrsForForeignVarRefs, } from "../validate-attrs.js";
18
19
  import { buildPresetCreateBody } from "./button-emitter.js";
19
20
  import { buildHeadingFontPresetCreateBody } from "./heading-font-emitter.js";
@@ -34,13 +35,27 @@ export class CredentialsMissingError extends Error {
34
35
  export class CapabilityMissingError extends Error {
35
36
  capability;
36
37
  pluginVersion;
37
- constructor(capability, pluginVersion) {
38
- super(`The active diviops-agent plugin (version ${pluginVersion}) does not report ` +
39
- `the "${capability}" capability required for storage-routed preset writes. ` +
40
- `Upgrade diviops-agent to a version that ships the "${capability}" capability ` +
41
- `(plugin 1.4.9 or later).`);
38
+ serverVersion;
39
+ tool;
40
+ constructor(capability, pluginVersion, serverVersion, tool = "diviops-preset --apply") {
41
+ const cleanPluginVersion = observedVersion(pluginVersion);
42
+ const cleanServerVersion = observedVersion(serverVersion);
43
+ const pluginEvidence = cleanPluginVersion
44
+ ? ` observed_free_plugin_version=${cleanPluginVersion};`
45
+ : "";
46
+ const serverEvidence = cleanServerVersion
47
+ ? ` mcp_server_version=${cleanServerVersion};`
48
+ : "";
49
+ super(capabilityMissingMessage(capability, pluginVersion) +
50
+ " " +
51
+ capabilityUpgradeHint(capability) +
52
+ ` Diagnostics: tool=${tool}; capability=${capability};` +
53
+ pluginEvidence +
54
+ serverEvidence);
42
55
  this.capability = capability;
43
56
  this.pluginVersion = pluginVersion;
57
+ this.serverVersion = serverVersion;
58
+ this.tool = tool;
44
59
  this.name = "CapabilityMissingError";
45
60
  }
46
61
  }
@@ -90,7 +105,7 @@ export function buildClientFromEnv(env = process.env) {
90
105
  export async function assertStorageCapability(client, serverVersion) {
91
106
  const hs = await client.handshake(serverVersion);
92
107
  if (!hs.capabilities || hs.capabilities[STORAGE_CAPABILITY] !== true) {
93
- throw new CapabilityMissingError(STORAGE_CAPABILITY, hs.plugin_version ?? "unknown");
108
+ throw new CapabilityMissingError(STORAGE_CAPABILITY, hs.plugin_version, serverVersion);
94
109
  }
95
110
  return hs;
96
111
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diviops/mcp-server",
3
- "version": "1.5.37",
3
+ "version": "1.5.38",
4
4
  "description": "MCP server exposing Divi 5 Visual Builder as tools for Claude",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",