@diviops/mcp-server 1.5.40 → 1.5.42

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
@@ -19,6 +19,24 @@ DiviOps fits multiple WordPress workflows where AI-driven authoring + management
19
19
  - **WordPress site auditing** — preset audits, design-token usage scans, orphan detection (presets, variables, dangling references); broader site surveys via wp-cli (`wp option list`, `wp post list --format=json`, `wp post term list <id> <taxonomy> --format=json`, `wp user list`).
20
20
  - **Hybrid sites (Divi + custom PHP)** — Divi authors the marketing pages; custom PHP templates handle dynamic ones (CPT listings, single-post views, member portals); design tokens harmonized across both surfaces via CSS custom properties driven from the Divi variable system.
21
21
 
22
+ ## Authoring policy
23
+
24
+ Use native Divi modules first. Intentional custom HTML is supported when native
25
+ Divi cannot meet the agreed requirement; HTML shape is not a semantic refusal gate.
26
+ Permissions, schemas, sanitization, bounded parsing, dry-run, required backups and
27
+ readback still apply. Ordinary server startup and the seven full-content writes
28
+ do not require a browser, trust registration or receipt. Visual QA is separate.
29
+
30
+ With an unreleased browser-gate plugin snapshot, its refusals remain authoritative:
31
+ the migrated server removes private browser handoff data and does not retry or
32
+ bypass the refusal. An unreleased browser-gate server snapshot tolerates the
33
+ retired registration route on the migrated plugin, but retains its own
34
+ startup-attestation overhead. Existing capability checks and
35
+ authentication errors are unchanged. Published server 1.5.40 and Free 1.5.13
36
+ predate that experiment and did not require browser attestation or receipts.
37
+ Source behavior is not a claim that current npm, WordPress.org or manually
38
+ installed packages include the migration.
39
+
22
40
  ## Quick start
23
41
 
24
42
  The first three steps prove connectivity. Native Divi authoring additionally
@@ -141,7 +159,9 @@ The server exposes **94 always-on tools** across the categories below. Each cate
141
159
  | WP-CLI passthrough | Escape hatch for site ops | `meta_wp_cli` |
142
160
  | Cache + meta | Connection probe, identity, icons, cache flush | `meta_*` |
143
161
 
144
- Use `diviops_meta_info` as the S0 preflight before dogfooding or product work. It returns `server_version`, a numeric `tool_count`, a `tools` catalog summary (`registered_total`, always-on count, Pro possible/registered counts by target), `plugins` version records for `diviops-agent`, `diviops-agent-pro`, FluentCart, and FluentCart Pro when available, plus the existing handshake and slice state.
162
+ Use `diviops_meta_info` as the S0 preflight before dogfooding or product work. It returns `server_version`, a numeric `tool_count`, a `tools` catalog summary (`registered_total`, always-on count, Pro possible/registered counts by target), `plugins` version records for `diviops-agent`, `diviops-agent-pro`, FluentCart, and FluentCart Pro when available, plus the existing handshake and slice state. In regular npm/stdio sessions, successfully observed plugin, module, capability, and registered-tool fields are the immutable handshake snapshot that built the session catalog. The additive `startup_capture` record supplies its non-secret timestamp, exact covered evidence, independent-component compatibility rule, and deterministic reconnect guidance. A failed handshake instead reports `startup_unavailable`, a bounded `startup_handshake_failed` reason class, and no covered target evidence. After a supported plugin, theme, or target change, reconnect or restart MCP before treating `meta_info`, the registered tools, or capability gates as current. Live read tools such as `diviops_fc_status` remain separate current observations; they do not rewrite startup registry truth.
163
+
164
+ Launcher health mode keeps its stricter existing contract: `diviops_meta_ping` and `diviops_meta_info` re-observe model-visible target evidence on every call. The regular stdio `startup_capture` record does not alter launcher behavior, direct npm/stdio compatibility, or tool registration after initialization.
145
165
 
146
166
  Additional **conditionally-registered Pro tools** appear only on sites that have the Pro plugin (`diviops-agent-pro`) active alongside the target coverage plugin:
147
167
 
@@ -0,0 +1,16 @@
1
+ import type { DiviopsResponse } from "./envelope.js";
2
+ type Client = {
3
+ requestEnveloped(endpoint: string, options: {
4
+ method: string;
5
+ body: Record<string, unknown>;
6
+ }): Promise<DiviopsResponse<unknown>>;
7
+ };
8
+ export type AuthoringWriteSpec = {
9
+ endpoint: string;
10
+ method: string;
11
+ body: Record<string, unknown>;
12
+ operation: string;
13
+ dryRun: boolean;
14
+ };
15
+ export declare function requestAuthoringWrite(client: Client, spec: AuthoringWriteSpec): Promise<DiviopsResponse<unknown>>;
16
+ export {};
@@ -0,0 +1,19 @@
1
+ import { normalizeBody } from "./wp-client.js";
2
+ export async function requestAuthoringWrite(client, spec) {
3
+ const result = await client.requestEnveloped(spec.endpoint, {
4
+ method: spec.method,
5
+ body: normalizeBody(spec.body),
6
+ });
7
+ if (result.ok || result.error.code !== "authoring_shape.render_required")
8
+ return result;
9
+ // Older plugins still own their refusal. Never expose their private candidate
10
+ // handoff, manufacture a receipt, or replay a write to bypass that policy.
11
+ return {
12
+ ok: false,
13
+ error: {
14
+ code: result.error.code,
15
+ message: result.error.message,
16
+ ...(result.error.hint ? { hint: result.error.hint } : {}),
17
+ },
18
+ };
19
+ }
@@ -13,7 +13,7 @@ export declare const META_PING_CONFIG: {
13
13
  };
14
14
  };
15
15
  export declare const META_INFO_CONFIG: {
16
- readonly description: "Returns DiviOps MCP server identity, server_version, license type, numeric tool_count, registered tool catalog summary, active plugin version summary, WP-CLI allowlist, and plugin handshake/slice state including Pro and FluentCart target readiness. Use as the S0 preflight before dogfooding or product work. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }.";
16
+ readonly description: "Returns DiviOps MCP server identity, server_version, license type, numeric tool_count, registered tool catalog summary, active plugin version summary, WP-CLI allowlist, and plugin handshake/slice state including Pro and FluentCart target readiness. In regular stdio mode, a successful plugin, module, capability, and registered-tool observation is the immutable startup snapshot; failed startup observation is explicitly unavailable and claims no target coverage. Reconnect or restart MCP after supported target changes. Launcher health mode continues to observe target evidence per call. Use as the S0 preflight before dogfooding or product work. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }.";
17
17
  readonly annotations: {
18
18
  readonly readOnlyHint: true;
19
19
  readonly idempotentHint: true;
@@ -9,7 +9,7 @@ export const META_PING_CONFIG = {
9
9
  _meta: { idempotent: "true" },
10
10
  };
11
11
  export const META_INFO_CONFIG = {
12
- description: "Returns DiviOps MCP server identity, server_version, license type, numeric tool_count, registered tool catalog summary, active plugin version summary, WP-CLI allowlist, and plugin handshake/slice state including Pro and FluentCart target readiness. Use as the S0 preflight before dogfooding or product work. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }.",
12
+ description: "Returns DiviOps MCP server identity, server_version, license type, numeric tool_count, registered tool catalog summary, active plugin version summary, WP-CLI allowlist, and plugin handshake/slice state including Pro and FluentCart target readiness. In regular stdio mode, a successful plugin, module, capability, and registered-tool observation is the immutable startup snapshot; failed startup observation is explicitly unavailable and claims no target coverage. Reconnect or restart MCP after supported target changes. Launcher health mode continues to observe target evidence per call. Use as the S0 preflight before dogfooding or product work. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }.",
13
13
  annotations: { readOnlyHint: true, idempotentHint: true },
14
14
  _meta: { idempotent: "true" },
15
15
  };
package/dist/index.d.ts CHANGED
@@ -33,4 +33,4 @@ export type HandshakeState = {
33
33
  * fixture deliberately share this seam so the v2 proof materializes the real
34
34
  * Free/Pro-gated catalog instead of maintaining a second set of definitions.
35
35
  */
36
- export declare function finalizeProductionRegistryForHandshake(state: HandshakeState): CanonicalToolRegistry;
36
+ export declare function finalizeProductionRegistryForHandshake(state: HandshakeState, observedAt?: string | Date | null): CanonicalToolRegistry;
package/dist/index.js CHANGED
@@ -12,6 +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 { requestAuthoringWrite } from "./authoring-shape-integration.js";
15
16
  import { capabilityUpgradeHint, MissingCapabilityError, observedVersion, proToolGatesSatisfied, } from "./compatibility.js";
16
17
  import { missingCapabilityEnvelope, } from "./capability-envelope.js";
17
18
  import { ErrorCodes, envelopeMap, recordIdempotent, serializeEnvelope, withCode, wrapResponse, } from "./envelope.js";
@@ -24,6 +25,7 @@ import { optimizeSchema } from "./schema-optimizer.js";
24
25
  import { schemaModuleRoute } from "./schema-route.js";
25
26
  import { createWpCli } from "./wp-cli.js";
26
27
  import { META_INFO_CONFIG, META_PING_CONFIG, requestAbortSignal, } from "./health-tools.js";
28
+ import { createStartupCaptureEvidence, } from "./startup-capture.js";
27
29
  import { CanonicalToolRegistry } from "./canonical-tool-registry.js";
28
30
  import { isolationFailure, scanValueForForeignVarRefs, writerIsolationErrorResult, } from "./validate-attrs.js";
29
31
  import { readFileSync, readdirSync, realpathSync } from "fs";
@@ -52,6 +54,7 @@ const wp = new WPClient({
52
54
  username: WP_USER,
53
55
  applicationPassword: WP_APP_PASSWORD,
54
56
  });
57
+ const authoringWrite = (endpoint, method, body, operation, dryRun) => requestAuthoringWrite(wp, { endpoint, method, body, operation, dryRun });
55
58
  // WP-CLI (optional — Local by Flywheel via WP_PATH, or custom wrapper via WP_CLI_CMD)
56
59
  const WP_PATH = process.env.WP_PATH ?? "";
57
60
  const WP_CLI_CMD = process.env.WP_CLI_CMD?.trim() ?? "";
@@ -93,6 +96,7 @@ const SERVER_VERSION = (() => {
93
96
  // ── MCP Server ───────────────────────────────────────────────────────
94
97
  const registry = new CanonicalToolRegistry();
95
98
  let handshakeState = { kind: "pending" };
99
+ let startupCaptureEvidence = createStartupCaptureEvidence(handshakeState, null);
96
100
  const toolCatalog = [];
97
101
  function recordToolCatalog(entry) {
98
102
  const existing = toolCatalog.find((item) => item.name === entry.name && item.kind === entry.kind);
@@ -246,6 +250,7 @@ function buildMetaInfo() {
246
250
  capabilities,
247
251
  tool_count: tools.registered_total,
248
252
  tools,
253
+ startup_capture: startupCaptureEvidence,
249
254
  plugins: buildPluginVersionSummary(),
250
255
  handshake: handshakeState.kind === "ok"
251
256
  ? {
@@ -1253,10 +1258,7 @@ registerPluginTool("diviops_page_update_content", {
1253
1258
  body.dry_run = true;
1254
1259
  if (backup)
1255
1260
  body.backup = true;
1256
- const result = await wp.requestEnveloped(`/page/update-content/${page_id}`, {
1257
- method: "POST",
1258
- body,
1259
- });
1261
+ const result = await authoringWrite(`/page/update-content/${page_id}`, "POST", body, "page_update_content", dry_run === true);
1260
1262
  return {
1261
1263
  content: [
1262
1264
  { type: "text", text: serializeEnvelope(result, "diviops_page_update_content") },
@@ -1866,10 +1868,7 @@ registerPluginTool("diviops_page_create", {
1866
1868
  const body = { title, content: content ?? "", status: status ?? "draft" };
1867
1869
  if (dry_run)
1868
1870
  body.dry_run = true;
1869
- const result = await wp.requestEnveloped("/page/create", {
1870
- method: "POST",
1871
- body,
1872
- });
1871
+ const result = await authoringWrite("/page/create", "POST", body, "page_create", dry_run === true);
1873
1872
  return {
1874
1873
  content: [
1875
1874
  { type: "text", text: serializeEnvelope(result, "diviops_page_create") },
@@ -2453,10 +2452,7 @@ registerPluginTool("diviops_library_save", {
2453
2452
  const body = { title, content, layout_type, scope };
2454
2453
  if (dry_run)
2455
2454
  body.dry_run = true;
2456
- const result = await wp.requestEnveloped("/library/save", {
2457
- method: "POST",
2458
- body,
2459
- });
2455
+ const result = await authoringWrite("/library/save", "POST", body, "library_save", dry_run === true);
2460
2456
  return {
2461
2457
  content: [
2462
2458
  { type: "text", text: serializeEnvelope(result, "diviops_library_save") },
@@ -2652,10 +2648,7 @@ registerPluginTool("diviops_tb_layout_update", {
2652
2648
  body.dry_run = true;
2653
2649
  if (backup)
2654
2650
  body.backup = true;
2655
- const result = await wp.requestEnveloped(`/theme-builder/layout/update/${layout_id}`, {
2656
- method: "PUT",
2657
- body,
2658
- });
2651
+ const result = await authoringWrite(`/theme-builder/layout/update/${layout_id}`, "PUT", body, "tb_layout_update", dry_run === true);
2659
2652
  return {
2660
2653
  content: [
2661
2654
  { type: "text", text: serializeEnvelope(result, "diviops_tb_layout_update") },
@@ -2744,10 +2737,7 @@ registerPluginTool("diviops_tb_template_create", {
2744
2737
  const body = { title, condition, header_content, footer_content };
2745
2738
  if (dry_run)
2746
2739
  body.dry_run = true;
2747
- const result = await wp.requestEnveloped("/theme-builder/template/create", {
2748
- method: "POST",
2749
- body,
2750
- });
2740
+ const result = await authoringWrite("/theme-builder/template/create", "POST", body, "tb_template_create", dry_run === true);
2751
2741
  return {
2752
2742
  content: [
2753
2743
  { type: "text", text: serializeEnvelope(result, "diviops_tb_template_create") },
@@ -2834,7 +2824,7 @@ registerPluginTool("diviops_canvas_create", {
2834
2824
  body.z_index = z_index;
2835
2825
  if (dry_run)
2836
2826
  body.dry_run = true;
2837
- const result = await wp.requestEnveloped("/canvas/create", { method: "POST", body });
2827
+ const result = await authoringWrite("/canvas/create", "POST", body, "canvas_create", dry_run === true);
2838
2828
  return {
2839
2829
  content: [
2840
2830
  { type: "text", text: serializeEnvelope(result, "diviops_canvas_create") },
@@ -2979,10 +2969,7 @@ registerPluginTool("diviops_canvas_update", {
2979
2969
  body.z_index = z_index;
2980
2970
  if (dry_run)
2981
2971
  body.dry_run = true;
2982
- const result = await wp.requestEnveloped(`/canvas/update/${canvas_post_id}`, {
2983
- method: "POST",
2984
- body,
2985
- });
2972
+ const result = await authoringWrite(`/canvas/update/${canvas_post_id}`, "POST", body, "canvas_update", dry_run === true);
2986
2973
  return {
2987
2974
  content: [
2988
2975
  { type: "text", text: serializeEnvelope(result, "diviops_canvas_update") },
@@ -4519,7 +4506,7 @@ function registerProTools() {
4519
4506
  }, { target: "fluentcart", capabilityKey: "fluentcart_product_list" });
4520
4507
  // diviops_fc_product_get — bridges /diviops/v1/pro/fluentcart/products/{id}
4521
4508
  registerProTool("diviops_fc_product_get", {
4522
- description: "Fetch a single FluentCart Pro product by ID, including the ProductDetail row, the default-variation read-back fields, and a list of variation IDs (Pro tier; requires FluentCart Pro installed + activated). Read-only. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; the success payload is { product: { id, title, slug, status, created_at, modified_at, variation_type, variants_count, min_price, max_price, stock_availability, excerpt, content, author_id, view_url, edit_url }, detail: { fulfillment_type, variation_type, min_price, max_price, manage_stock, manage_downloadable, stock_availability, default_variation_id, ... } | null, default_variation: { id, sku, item_price, compare_price } | null, variation_ids: number[], variations_count }. The default_variation block closes the read-after-write loop for the V2 simple-product write tools — sku and compare_price round-trip cleanly without a FluentCart admin fallback. Unit asymmetry: product_create / product_update accept price and compare_price in currency units (e.g. 29.99); product_get returns min_price, max_price, default_variation.item_price, and default_variation.compare_price in stored cents (e.g. 2999). default_variation.sku is null when the stored SKU is SQL NULL; clearing a SKU with sku: \"\" on update reads back as null. default_variation itself is null when the product has no default variation row. Use the variation_ids list to follow up with a (future) diviops_fc_variation_list call. Error codes: invalid_input (HTTP 400) when id is not a positive integer; not_found (HTTP 404) when no product matches the ID (or it's filtered out by the FluentCart auto-draft global scope); fluentcart.module_inactive (HTTP 412) when FluentCart is uninstalled or the module toggle is off; fluentcart.query_failed (HTTP 500) when the FluentCart model query raises an exception.",
4509
+ description: "Fetch a single FluentCart Pro product by ID, including the ProductDetail row, default-variation read-back fields, a compact value-free shape-readiness verdict, buyer-safe storefront links, and a list of variation IDs (Pro tier; requires FluentCart Pro installed + activated). Read-only. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; the success payload is { product: { id, title, slug, status, created_at, modified_at, variation_type, variants_count, min_price, max_price, stock_availability, excerpt, content, author_id, view_url, edit_url }, detail: { fulfillment_type, variation_type, min_price, max_price, manage_stock, manage_downloadable, stock_availability, default_variation_id, ... } | null, default_variation: { id, sku, item_price, compare_price } | null, storefront_links: { view_url: string|null, checkout_url: string|null, checkout_variation_id: number|null, ready: boolean, problems: string[], draft_preview_available: false }, shape_readiness: { profile: \"simple_onetime\"|\"simple_annual_subscription\"|\"unsupported\", ready: boolean, problems: string[] }, variation_ids: number[], variations_count }. storefront_links is ready only for a published, shape-ready product whose exact default variation passes FluentCart's native canPurchase(1) check. Its checkout_url comes from FluentCart's native getPurchaseUrl() query-string route; DiviOps does not invent add-to-cart URLs. Draft, pending, and private products return both buyer URLs as null. storefront_links.problems uses finite codes: product_not_published, product_shape_not_ready, default_variation_missing, variation_not_purchasable, checkout_url_unavailable. product.view_url remains unchanged for backward-compatible administrative readback and is not a buyer-safety verdict. shape_readiness never returns raw other_info; problems contains only finite codes: detail_missing, variation_type_unsupported, variation_count_not_one, default_variation_pointer_missing, default_variation_pointer_dangling, detail_defaults_drift, payment_profile_unsupported, payment_type_drift, variation_defaults_drift. An intentionally independent variation_title is supported and does not affect readiness. The default_variation block closes the read-after-write loop for the V2 simple-product write tools — sku and compare_price round-trip cleanly without a FluentCart admin fallback. Unit asymmetry: product_create / product_update accept price and compare_price in currency units (e.g. 29.99); product_get returns min_price, max_price, default_variation.item_price, and default_variation.compare_price in stored cents (e.g. 2999). default_variation.sku is null when the stored SKU is SQL NULL; clearing a SKU with sku: \"\" on update reads back as null. default_variation itself is null when the product has no default variation row. Apply/no-op product_create and product_update responses include the same storefront_links projection. Use the variation_ids list to follow up with diviops_fc_variation_list. Error codes: invalid_input (HTTP 400) when id is not a positive integer; not_found (HTTP 404) when no product matches the ID (or it's filtered out by the FluentCart auto-draft global scope); fluentcart.module_inactive (HTTP 412) when FluentCart is uninstalled or the module toggle is off; fluentcart.query_failed (HTTP 500) when the FluentCart model query raises an exception.",
4523
4510
  inputSchema: {
4524
4511
  id: z
4525
4512
  .number()
@@ -4549,7 +4536,7 @@ function registerProTools() {
4549
4536
  // surface can own multi-variant complexity cleanly.
4550
4537
  // diviops_fc_product_create — POST /diviops/v1/pro/fluentcart/products/create
4551
4538
  registerProTool("diviops_fc_product_create", {
4552
- description: "Create a simple FluentCart Pro product (Pro tier; requires FluentCart Pro installed + activated). V2 scope: simple onetime products only — one default variant, `detail.variation_type=\"simple\"`, `payment_type=\"onetime\"`, `fulfillment_type=\"digital\"|\"physical\"`. Multi-variation, subscriptions, downloadables, gallery, taxonomies, activation_limit, and license-flow fields ship in later verticals and are refused here. Required: `title` (1-200 chars). Optional: `status` (`draft`|`publish`|`pending`|`private`; default `draft`), `content`, `excerpt`, `fulfillment_type` (default `digital`), `price` (≥0; default 0), `compare_price` (≥0; must be ≥ `price` when provided), `sku` (optional; must be unique across FluentCart variations and at most 30 characters because FluentCart stores `fct_product_variations.sku` as `VARCHAR(30)` — overlong values are rejected before mutation rather than silently truncated). Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; apply-mode success payload is { product, detail, default_variation: { id, sku, item_price, compare_price } | null, variation_ids, variations_count, product_id, detail_id, default_variation_id } (HTTP 201). The default_variation block mirrors the diviops_fc_product_get read-back shape so callers don't need a follow-up read to confirm sku / compare_price / item_price after a write. Unit asymmetry: write inputs (price, compare_price) are in currency units (e.g. 29.99); the default_variation block returns item_price + compare_price in stored cents (e.g. 2999), matching detail.min_price / max_price. default_variation.compare_price is null when no compare price is stored (FCP persists \"no compare\" as 0, normalized to null on read); default_variation.sku is null when the SKU column is SQL NULL or an empty string (the create path stores omitted SKU as NULL). Error codes: invalid_input (400) when any input violates the constraints above (including SKU > 30 chars — error.data carries { field: \"sku\", max_length: 30, actual_length }); fluentcart.sku_conflict (409) when the provided SKU is already in use; fluentcart.module_inactive (412); fluentcart.command_failed (500) when wp_insert_post/ProductDetail/ProductVariation creation raises. Idempotency: NOT idempotent — repeat calls create distinct products." +
4539
+ description: "Create a simple FluentCart Pro product (Pro tier; requires FluentCart Pro installed + activated). V2 scope: simple onetime products only — one exact default variant, `detail.variation_type=\"simple\"`, `payment_type=\"onetime\"`, `fulfillment_type=\"digital\"|\"physical\"`. Creation writes FluentCart's current finite simple-product detail/variation other_info defaults and persists an exact nonzero pointer to the sole variant. Multi-variation, subscriptions, downloadables, gallery, taxonomies, activation_limit, and license-flow fields ship in later verticals and are refused here. Required: `title` (1-200 chars). Optional: `status` (`draft`|`publish`|`pending`|`private`; default `draft`), `content`, `excerpt`, `fulfillment_type` (default `digital`), `price` (≥0; default 0), `compare_price` (≥0; must be ≥ `price` when provided), `sku` (optional; must be unique across FluentCart variations and at most 30 characters because FluentCart stores `fct_product_variations.sku` as `VARCHAR(30)` — overlong values are rejected before mutation rather than silently truncated). Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; apply-mode success payload is { product, detail, default_variation: { id, sku, item_price, compare_price } | null, storefront_links: { view_url, checkout_url, checkout_variation_id, ready, problems, draft_preview_available }, shape_readiness: { profile, ready, problems }, variation_ids, variations_count, product_id, detail_id, default_variation_id } (HTTP 201). The default_variation block mirrors the diviops_fc_product_get read-back shape so callers don't need a follow-up read to confirm sku / compare_price / item_price after a write; storefront_links and shape_readiness mirror its buyer-safety and value-free readiness projections. Unit asymmetry: write inputs (price, compare_price) are in currency units (e.g. 29.99); the default_variation block returns item_price + compare_price in stored cents (e.g. 2999), matching detail.min_price / max_price. default_variation.compare_price is null when no compare price is stored (FCP persists \"no compare\" as 0, normalized to null on read); default_variation.sku is null when the SKU column is SQL NULL or an empty string (the create path stores omitted SKU as NULL). Error codes: invalid_input (400) when any input violates the constraints above (including SKU > 30 chars — error.data carries { field: \"sku\", max_length: 30, actual_length }); fluentcart.sku_conflict (409) when the provided SKU is already in use; fluentcart.module_inactive (412); fluentcart.command_failed (500) when wp_insert_post/ProductDetail/ProductVariation creation raises. Idempotency: NOT idempotent — repeat calls create distinct products." +
4553
4540
  DRY_RUN_DESC_SUFFIX,
4554
4541
  inputSchema: {
4555
4542
  title: z
@@ -4621,7 +4608,7 @@ function registerProTools() {
4621
4608
  }, { target: "fluentcart", capabilityKey: "fluentcart_product_create" });
4622
4609
  // diviops_fc_product_update — POST /diviops/v1/pro/fluentcart/products/{id}/update
4623
4610
  registerProTool("diviops_fc_product_update", {
4624
- description: "Update a simple FluentCart Pro product (Pro tier; requires FluentCart Pro installed + activated). V2 scope: simple onetime products only — accepts partial updates on title, status, content, excerpt, fulfillment_type, price, compare_price, sku. SKU constraint: must be unique across FluentCart variations and at most 30 characters (FluentCart stores `fct_product_variations.sku` as `VARCHAR(30)`); `sku: \"\"` clears the SKU and reads back as `null`. Overlong SKUs are rejected before mutation rather than silently truncated. Refuses non-simple products (variation_type other than 'simple', or default variant with payment_type other than 'onetime') with `fluentcart.unsupported_product_shape` (HTTP 422) — multi-variation + subscription writes ship in V3+. Required: `id` (positive integer; the post ID of the fluent_products CPT entry). All other fields optional; only changed fields are applied. When no field actually changes, returns `ok:true` with `data.noop: true` (apply mode) or an empty-plan dry-run summary. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; apply-mode success payload is { product, detail, default_variation: { id, sku, item_price, compare_price } | null, variation_ids, variations_count, changed_fields[] } (or { noop: true, product, detail, default_variation, ... } on a no-op). The default_variation block reflects the post-update state (or current state on noop) and mirrors the diviops_fc_product_get shape — sku, item_price, and compare_price round-trip without a follow-up read. Unit asymmetry: write inputs (price, compare_price) are in currency units (e.g. 29.99); default_variation returns item_price + compare_price in stored cents (e.g. 2999). default_variation.sku is null after `sku: \"\"` clears it (the empty string is stored as SQL NULL so the variations table's UNIQUE constraint allows multiple cleared SKUs); default_variation.compare_price is null when no compare price is stored (FCP persists \"no compare\" as 0, normalized to null on read). Error codes: invalid_input (400) when any field violates the constraints (including SKU > 30 chars — error.data carries { field: \"sku\", max_length: 30, actual_length }); not_found (404) when the product ID does not exist; fluentcart.unsupported_product_shape (422) when the product is not simple/onetime; fluentcart.sku_conflict (409) when a new SKU collides with another variation; fluentcart.module_inactive (412); fluentcart.command_failed (500). Idempotency: conditional — repeating an identical update is a no-op." +
4611
+ description: "Update a simple FluentCart Pro product (Pro tier; requires FluentCart Pro installed + activated). Product-level title, status, content, and excerpt updates are supported for both onetime and subscription products; changing title also keeps the default variation's variation_title coherent. On simple onetime products, fulfillment_type, price, compare_price, and sku remain supported. On subscription products those variation-level fields are refused with `fluentcart.unsupported_product_shape` (HTTP 422): pricing and SKU must use diviops_fc_variation_update, while subscription fulfillment changes remain out of scope. This ensures subscription pricing never flows through the V2 product path. Multi-variation products remain refused. Supported updates preserve initialized detail/variation defaults and unrelated existing other_info keys; they report but do not auto-repair legacy drift. SKU constraint on onetime products: unique across FluentCart variations and at most 30 characters; `sku: \"\"` clears it and reads back as `null`. Required: `id` (positive integer; the post ID of the fluent_products CPT entry). All other fields optional; only changed fields are applied. When no field actually changes, returns `ok:true` with `data.noop: true` (apply mode) or an empty-plan dry-run summary. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; apply-mode success payload is { product, detail, default_variation: { id, sku, item_price, compare_price } | null, storefront_links: { view_url, checkout_url, checkout_variation_id, ready, problems, draft_preview_available }, shape_readiness: { profile, ready, problems }, variation_ids, variations_count, changed_fields[] } (or { noop: true, product, detail, default_variation, storefront_links, shape_readiness, ... } on a no-op). The default_variation, storefront_links, and value-free shape_readiness blocks reflect the post-update state. Unit asymmetry for onetime pricing: write inputs are currency units; readback prices are stored cents. Error codes: invalid_input (400); not_found (404); fluentcart.unsupported_product_shape (422) for non-simple products, unsupported payment types, or subscription variation fields; fluentcart.sku_conflict (409); fluentcart.module_inactive (412); fluentcart.command_failed (500). Idempotency: conditional — repeating an identical update is a no-op." +
4625
4612
  DRY_RUN_DESC_SUFFIX,
4626
4613
  inputSchema: {
4627
4614
  id: z
@@ -4634,7 +4621,7 @@ function registerProTools() {
4634
4621
  .min(1)
4635
4622
  .max(200)
4636
4623
  .optional()
4637
- .describe("New product title. 1-200 chars."),
4624
+ .describe("New product title. 1-200 chars. Also updates the default variation title for both onetime and subscription products."),
4638
4625
  status: z
4639
4626
  .enum(["draft", "publish", "pending", "private"])
4640
4627
  .optional()
@@ -4644,21 +4631,21 @@ function registerProTools() {
4644
4631
  fulfillment_type: z
4645
4632
  .enum(["digital", "physical"])
4646
4633
  .optional()
4647
- .describe("New fulfillment shape."),
4634
+ .describe("New fulfillment shape. Simple onetime products only."),
4648
4635
  price: z
4649
4636
  .number()
4650
4637
  .min(0)
4651
4638
  .optional()
4652
- .describe("New default-variation item_price (currency units). Non-negative."),
4639
+ .describe("New default-variation item_price (currency units). Non-negative. Simple onetime products only; use diviops_fc_variation_update for subscriptions."),
4653
4640
  compare_price: z
4654
4641
  .number()
4655
4642
  .min(0)
4656
4643
  .optional()
4657
- .describe("New compare-at price. Must be ≥ `price` when both provided."),
4644
+ .describe("New compare-at price. Must be ≥ `price` when both provided. Simple onetime products only."),
4658
4645
  sku: z
4659
4646
  .string()
4660
4647
  .optional()
4661
- .describe("New SKU for the default variation. Optional. Must be unique across all FluentCart variations and at most 30 characters (FluentCart stores fct_product_variations.sku as VARCHAR(30)). Empty string clears the SKU (reads back as null)."),
4648
+ .describe("New SKU for the default variation. Simple onetime products only. Must be unique across all FluentCart variations and at most 30 characters. Empty string clears the SKU (reads back as null)."),
4662
4649
  dry_run: DRY_RUN_FIELD,
4663
4650
  },
4664
4651
  annotations: { idempotentHint: false },
@@ -4758,7 +4745,7 @@ function registerProTools() {
4758
4745
  }, { target: "fluentcart", capabilityKey: "fluentcart_variation_list" });
4759
4746
  // diviops_fc_variation_update — POST /diviops/v1/pro/fluentcart/products/{product_id}/variations/{variation_id}/update
4760
4747
  registerProTool("diviops_fc_variation_update", {
4761
- description: "Update the default variation of a simple FluentCart Pro product (Pro tier; V3; requires FluentCart Pro installed + activated). V3 scope: writes the product's default variation only; refuses non-simple products and non-default variations with `fluentcart.unsupported_product_shape` (HTTP 422). Multi-variation create/delete remains out of scope. Accepts partial updates on price, compare_price, sku, payment_type, and the subscription shape (repeat_interval, times, trial_days, manage_setup_fee). Switching `payment_type: \"subscription\"` requires `repeat_interval` (yearly/half_yearly/quarterly/monthly/weekly/daily) — either supplied in the same call or already stored. Switching to `onetime` strips the subscription-only keys from other_info, matching ProductVariationRequest::beforeValidation. `manage_setup_fee: \"yes\"` requires signup_fee + signup_fee_name which are out of scope for V3 (use FluentCart admin UI for setup fees); only `manage_setup_fee: \"no\"` is accepted. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; apply-mode success payload is { product_id, variation_id, changed_fields[], variation: VariationRow, product_price_range: { min_price, max_price } | null } (or { noop: true, product_id, variation_id, variation } when nothing changes). VariationRow mirrors the diviops_fc_variation_list shape — sku, item_price, compare_price, payment_type, other_info, license round-trip without a follow-up read. Unit asymmetry: write inputs (price, compare_price) are currency units (e.g. 19.00); VariationRow returns item_price + compare_price in stored cents. Error codes: invalid_input (400); not_found (404); fluentcart.unsupported_product_shape (422); fluentcart.sku_conflict (409); fluentcart.module_inactive (412); fluentcart.command_failed (500). Idempotency: conditional — identical repeat is a no-op." +
4748
+ description: "Update the default variation of a simple FluentCart Pro product (Pro tier; V3; requires FluentCart Pro installed + activated). V3 scope: writes the product's default variation only; refuses non-simple products and non-default variations with `fluentcart.unsupported_product_shape` (HTTP 422). Multi-variation create/delete remains out of scope. Accepts partial updates on variation_title (non-empty, 1-200 chars), price, compare_price, sku, payment_type, and the subscription shape (repeat_interval, times, trial_days, manage_setup_fee). variation_title changes only the default variation label; use diviops_fc_product_update.title when the product title and default variation label should stay aligned. Switching `payment_type: \"subscription\"` requires `repeat_interval` (yearly/half_yearly/quarterly/monthly/weekly/daily) — either supplied in the same call or already stored. Switching to `onetime` restores FluentCart's initialized one-time values for the finite subscription-related keys while preserving unrelated other_info. `manage_setup_fee: \"yes\"` remains out of scope. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; apply-mode success payload is { product_id, variation_id, changed_fields[], variation: VariationRow, product_price_range: { min_price, max_price } | null } (or { noop: true, product_id, variation_id, variation } when nothing changes). VariationRow provides direct readback including variation_title. Error codes: invalid_input (400); not_found (404); fluentcart.unsupported_product_shape (422); fluentcart.sku_conflict (409); fluentcart.module_inactive (412); fluentcart.command_failed (500). Idempotency: conditional — identical repeat is a no-op." +
4762
4749
  DRY_RUN_DESC_SUFFIX,
4763
4750
  inputSchema: {
4764
4751
  product_id: z
@@ -4771,6 +4758,12 @@ function registerProTools() {
4771
4758
  .int()
4772
4759
  .positive()
4773
4760
  .describe("FluentCart variation ID. Must be the product's default variation (V3 constraint)."),
4761
+ variation_title: z
4762
+ .string()
4763
+ .min(1)
4764
+ .max(200)
4765
+ .optional()
4766
+ .describe("Default variation label. 1-200 chars. This does not change the product title."),
4774
4767
  price: z
4775
4768
  .number()
4776
4769
  .min(0)
@@ -4788,7 +4781,7 @@ function registerProTools() {
4788
4781
  payment_type: z
4789
4782
  .enum(["onetime", "subscription"])
4790
4783
  .optional()
4791
- .describe("Variation payment_type. Switching to 'subscription' requires repeat_interval. Switching to 'onetime' strips subscription-only fields from other_info."),
4784
+ .describe("Variation payment_type. Switching to 'subscription' requires repeat_interval. Switching to 'onetime' restores initialized one-time values for the finite subscription-related keys and preserves unrelated other_info."),
4792
4785
  repeat_interval: z
4793
4786
  .enum([
4794
4787
  "yearly",
@@ -4821,8 +4814,10 @@ function registerProTools() {
4821
4814
  },
4822
4815
  annotations: { idempotentHint: false },
4823
4816
  _meta: { idempotent: "conditional" },
4824
- }, async ({ product_id, variation_id, price, compare_price, sku, payment_type, repeat_interval, times, trial_days, manage_setup_fee, dry_run, }) => {
4817
+ }, async ({ product_id, variation_id, variation_title, price, compare_price, sku, payment_type, repeat_interval, times, trial_days, manage_setup_fee, dry_run, }) => {
4825
4818
  const body = {};
4819
+ if (variation_title !== undefined)
4820
+ body.variation_title = variation_title;
4826
4821
  if (price !== undefined)
4827
4822
  body.price = price;
4828
4823
  if (compare_price !== undefined)
@@ -5552,11 +5547,12 @@ let productionRegistryFinalized = false;
5552
5547
  * fixture deliberately share this seam so the v2 proof materializes the real
5553
5548
  * Free/Pro-gated catalog instead of maintaining a second set of definitions.
5554
5549
  */
5555
- export function finalizeProductionRegistryForHandshake(state) {
5550
+ export function finalizeProductionRegistryForHandshake(state, observedAt = new Date()) {
5556
5551
  if (productionRegistryFinalized) {
5557
5552
  throw new Error("Production MCP registry has already been finalized");
5558
5553
  }
5559
5554
  handshakeState = state;
5555
+ startupCaptureEvidence = createStartupCaptureEvidence(state, observedAt);
5560
5556
  registerCrossEnvEvidenceTools();
5561
5557
  registerProTools();
5562
5558
  productionRegistryFinalized = true;
@@ -0,0 +1,33 @@
1
+ export declare const STARTUP_CAPTURE_RECONNECT_GUIDANCE = "Plugin, theme, or target changes require reconnecting or restarting the MCP session before diviops_meta_info, the registered tool catalog, and capability gates can be treated as current.";
2
+ export declare const STARTUP_CAPTURE_MIXED_VERSION_GUIDANCE = "DiviOps MCP server and WordPress component versions are independent. Compatibility is determined by the per-capability startup handshake, not by matching version numbers.";
3
+ export declare const STARTUP_CAPTURE_LIVE_READ_GUIDANCE = "Live read tools such as diviops_fc_status are separate current target observations and do not refresh this startup snapshot or the registered tool catalog.";
4
+ export declare function createStartupCaptureEvidence(observation: {
5
+ kind: "ok" | "failed" | "pending";
6
+ }, observedAt?: string | Date | null): {
7
+ mode: "startup_captured" | "startup_unavailable";
8
+ captured_at: string | null;
9
+ attempted_at: string | null;
10
+ timestamp_status: "recorded" | "unavailable_legacy" | "observation_failed";
11
+ observation: {
12
+ state: "ok" | "failed" | "pending";
13
+ reason_class: "startup_handshake_failed" | "startup_handshake_pending" | null;
14
+ };
15
+ immutable_for_session: boolean;
16
+ covers: ("capabilities" | "plugin_versions" | "module_activation" | "registered_tool_catalog")[];
17
+ freshness: {
18
+ status: "startup_snapshot" | "unavailable";
19
+ invalidated_by: ("plugin_change" | "theme_change" | "target_change")[];
20
+ action: "reconnect_or_restart_mcp";
21
+ guidance: string;
22
+ };
23
+ compatibility: {
24
+ component_versions: "independent";
25
+ authority: "per_capability_startup_handshake";
26
+ guidance: string;
27
+ };
28
+ live_observations: {
29
+ separate: boolean;
30
+ guidance: string;
31
+ };
32
+ };
33
+ export type StartupCaptureEvidence = ReturnType<typeof createStartupCaptureEvidence>;
@@ -0,0 +1,69 @@
1
+ export const STARTUP_CAPTURE_RECONNECT_GUIDANCE = "Plugin, theme, or target changes require reconnecting or restarting the MCP session before diviops_meta_info, the registered tool catalog, and capability gates can be treated as current.";
2
+ export const STARTUP_CAPTURE_MIXED_VERSION_GUIDANCE = "DiviOps MCP server and WordPress component versions are independent. Compatibility is determined by the per-capability startup handshake, not by matching version numbers.";
3
+ export const STARTUP_CAPTURE_LIVE_READ_GUIDANCE = "Live read tools such as diviops_fc_status are separate current target observations and do not refresh this startup snapshot or the registered tool catalog.";
4
+ const STARTUP_CAPTURE_COVERS = [
5
+ "plugin_versions",
6
+ "module_activation",
7
+ "capabilities",
8
+ "registered_tool_catalog",
9
+ ];
10
+ const STARTUP_CAPTURE_INVALIDATED_BY = [
11
+ "plugin_change",
12
+ "theme_change",
13
+ "target_change",
14
+ ];
15
+ function captureTimestamp(value) {
16
+ if (value instanceof Date) {
17
+ return Number.isNaN(value.getTime()) ? null : value.toISOString();
18
+ }
19
+ if (typeof value !== "string" || value.trim() === "")
20
+ return null;
21
+ const parsed = new Date(value);
22
+ return Number.isNaN(parsed.getTime()) ? null : parsed.toISOString();
23
+ }
24
+ export function createStartupCaptureEvidence(observation, observedAt) {
25
+ const observationState = observation.kind;
26
+ const timestamp = captureTimestamp(observedAt);
27
+ const captured = observationState === "ok";
28
+ return {
29
+ mode: captured
30
+ ? "startup_captured"
31
+ : "startup_unavailable",
32
+ captured_at: captured ? timestamp : null,
33
+ attempted_at: captured ? null : timestamp,
34
+ timestamp_status: captured
35
+ ? timestamp
36
+ ? "recorded"
37
+ : "unavailable_legacy"
38
+ : timestamp
39
+ ? "observation_failed"
40
+ : "unavailable_legacy",
41
+ observation: {
42
+ state: observationState,
43
+ reason_class: observationState === "failed"
44
+ ? "startup_handshake_failed"
45
+ : observationState === "pending"
46
+ ? "startup_handshake_pending"
47
+ : null,
48
+ },
49
+ immutable_for_session: true,
50
+ covers: captured ? [...STARTUP_CAPTURE_COVERS] : [],
51
+ freshness: {
52
+ status: captured
53
+ ? "startup_snapshot"
54
+ : "unavailable",
55
+ invalidated_by: [...STARTUP_CAPTURE_INVALIDATED_BY],
56
+ action: "reconnect_or_restart_mcp",
57
+ guidance: STARTUP_CAPTURE_RECONNECT_GUIDANCE,
58
+ },
59
+ compatibility: {
60
+ component_versions: "independent",
61
+ authority: "per_capability_startup_handshake",
62
+ guidance: STARTUP_CAPTURE_MIXED_VERSION_GUIDANCE,
63
+ },
64
+ live_observations: {
65
+ separate: true,
66
+ guidance: STARTUP_CAPTURE_LIVE_READ_GUIDANCE,
67
+ },
68
+ };
69
+ }
@@ -6,6 +6,7 @@
6
6
  */
7
7
  import { type HandshakeResult } from './compatibility.js';
8
8
  import { type DiviopsResponse } from './envelope.js';
9
+ export declare function normalizeBody(value: unknown, withinBlockTree?: boolean): unknown;
9
10
  export interface WPClientConfig {
10
11
  siteUrl: string;
11
12
  username: string;
package/dist/wp-client.js CHANGED
@@ -99,7 +99,7 @@ const NON_BLOCK_STORAGE_PREFIXES = [
99
99
  function endpointSkipsNormalization(endpoint) {
100
100
  return NON_BLOCK_STORAGE_PREFIXES.some((prefix) => endpoint.startsWith(prefix));
101
101
  }
102
- function normalizeBody(value, withinBlockTree = false) {
102
+ export function normalizeBody(value, withinBlockTree = false) {
103
103
  if (typeof value === 'string') {
104
104
  return withinBlockTree ? normalizeQuoteEscapes(value) : value;
105
105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diviops/mcp-server",
3
- "version": "1.5.40",
3
+ "version": "1.5.42",
4
4
  "description": "MCP server exposing Divi 5 Visual Builder as tools for Claude",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -16,6 +16,14 @@
16
16
  "!dist/launcher-bootstrap.d.ts",
17
17
  "!dist/launcher-sidecar.js",
18
18
  "!dist/launcher-sidecar.d.ts",
19
+ "!dist/authoring-browser-contract.js",
20
+ "!dist/authoring-browser-contract.d.ts",
21
+ "!dist/authoring-browser-coordinator.js",
22
+ "!dist/authoring-browser-coordinator.d.ts",
23
+ "!dist/authoring-browser-runtime.js",
24
+ "!dist/authoring-browser-runtime.d.ts",
25
+ "!dist/authoring-browser-worker.js",
26
+ "!dist/authoring-browser-worker.d.ts",
19
27
  "templates",
20
28
  "data/verified-attrs.json",
21
29
  "data/verified-attrs-backlog.json",
@@ -25,9 +33,10 @@
25
33
  "build": "tsc",
26
34
  "start": "node dist/index.js",
27
35
  "dev": "tsc --watch",
28
- "test": "npm run build && node --test dist/__tests__/*.test.js dist/preset-cli/__tests__/*.test.js dist/cross-env-preflight/__tests__/*.test.js && node scripts/check-release-boundary.mjs",
36
+ "test": "npm run build && node --test dist/__tests__/*.test.js dist/preset-cli/__tests__/*.test.js dist/cross-env-preflight/__tests__/*.test.js scripts/authoring-release-boundary.test.mjs && node scripts/check-release-boundary.mjs",
29
37
  "prepublishOnly": "npm run build",
30
- "regen:skill": "node scripts/regen-module-formats.mjs"
38
+ "regen:skill": "node scripts/regen-module-formats.mjs",
39
+ "check:authoring-shape-budget": "node scripts/check-page-sized-html-fallback-production-budget.mjs"
31
40
  },
32
41
  "keywords": [
33
42
  "mcp",
@@ -64,6 +73,7 @@
64
73
  "@modelcontextprotocol/core": "2.0.0",
65
74
  "@modelcontextprotocol/server": "2.0.0",
66
75
  "@types/node": "^22.0.0",
76
+ "playwright-core": "1.62.1",
67
77
  "typescript": "^5.7.0"
68
78
  }
69
79
  }