@diviops/mcp-server 1.5.30 → 1.5.31

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
@@ -188,6 +188,13 @@ markup, export metadata, and best-effort attachment inventory from upload URLs
188
188
  and attachment IDs. It strips query strings, fragments, credentials, nonces,
189
189
  cookies, signed URL material, admin URLs, and local filesystem paths.
190
190
 
191
+ The MCP server also writes the same source payload to a bounded local artifact
192
+ under `.diviops-tmp/cross-env-source-payloads/` and returns
193
+ `data.source_payload_ref`. Use that reference for large real headers when
194
+ calling the Pro `diviops_cross_env_header_apply` tool; it avoids asking an LLM
195
+ to re-emit large markup byte-for-byte. The reference is a server-created handle
196
+ plus checksum, not an arbitrary filesystem path.
197
+
191
198
  To collect the target JSON from the target WordPress site, call the Free/core
192
199
  read-only MCP tool `diviops_cross_env_target_context_get` against the target
193
200
  server and save the returned `data` object as `target.json`. Optional
@@ -210,9 +217,11 @@ Workflow:
210
217
  3. Run `diviops-cross-env-preflight --source source.json --target target.json --dry-run`.
211
218
 
212
219
  `--apply` is intentionally refused. To mutate a target, use the separate
213
- Pro-gated `diviops_cross_env_header_apply` tool with the reviewed fingerprint.
214
- That MVP still refuses media upload/import, global color creation/import,
215
- off-canvas reconcile, and new target layout creation.
220
+ Pro-gated `diviops_cross_env_header_apply` tool with the reviewed fingerprint
221
+ and either inline `source_payload` for small/disposable tests or
222
+ `source_payload_ref` for large real headers. That MVP still refuses media
223
+ upload/import, global color creation/import, off-canvas reconcile, and new
224
+ target layout creation.
216
225
 
217
226
  ## Response contract
218
227
 
@@ -0,0 +1,20 @@
1
+ import { type SourceLayoutPayload } from "./header-preflight.js";
2
+ export interface SourcePayloadRef {
3
+ handle: string;
4
+ checksum: string;
5
+ algorithm: "sha256";
6
+ storage: "server_local_artifact";
7
+ expires_at?: string;
8
+ }
9
+ export interface SourcePayloadRefEnvelope {
10
+ type: "diviops.cross_env.source_payload_ref.v1";
11
+ created_at: string;
12
+ expires_at: string | null;
13
+ source_payload: SourceLayoutPayload;
14
+ checksum: {
15
+ algorithm: "sha256";
16
+ computed: string;
17
+ };
18
+ }
19
+ export declare function createSourcePayloadRef(payload: SourceLayoutPayload): SourcePayloadRef;
20
+ export declare function loadSourcePayloadRef(ref: unknown): SourceLayoutPayload;
@@ -0,0 +1,178 @@
1
+ import { createHash, randomUUID } from "node:crypto";
2
+ import { mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ const DEFAULT_TTL_SECONDS = 24 * 60 * 60;
5
+ const MAX_TTL_SECONDS = 10 * 365 * 24 * 60 * 60;
6
+ const HANDLE_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
7
+ function sha256(value) {
8
+ return createHash("sha256").update(value).digest("hex");
9
+ }
10
+ function payloadRoot() {
11
+ return (process.env.DIVIOPS_CROSS_ENV_PAYLOAD_REF_DIR ||
12
+ join(process.cwd(), ".diviops-tmp", "cross-env-source-payloads"));
13
+ }
14
+ function ttlSeconds() {
15
+ const raw = process.env.DIVIOPS_CROSS_ENV_PAYLOAD_REF_TTL_SECONDS;
16
+ if (!raw)
17
+ return DEFAULT_TTL_SECONDS;
18
+ const parsed = Number(raw);
19
+ if (!Number.isFinite(parsed) || parsed < 0 || parsed > MAX_TTL_SECONDS) {
20
+ return DEFAULT_TTL_SECONDS;
21
+ }
22
+ return Math.floor(parsed);
23
+ }
24
+ function normalizeChecksum(value) {
25
+ if (typeof value !== "string")
26
+ return "";
27
+ return value.trim().replace(/^sha256:/i, "").toLowerCase();
28
+ }
29
+ function assertHandle(handle) {
30
+ if (!HANDLE_PATTERN.test(handle) || handle.includes("..")) {
31
+ throw new Error("source_payload_ref.handle is invalid.");
32
+ }
33
+ }
34
+ function payloadPath(handle) {
35
+ assertHandle(handle);
36
+ return join(payloadRoot(), `${handle}.json`);
37
+ }
38
+ function assertSourcePayload(value) {
39
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
40
+ throw new Error("source payload artifact does not contain an object.");
41
+ }
42
+ const payload = value;
43
+ if (typeof payload.markup !== "string") {
44
+ throw new Error("source payload artifact is missing markup.");
45
+ }
46
+ if (typeof payload.origin !== "string" || payload.origin.trim() === "") {
47
+ throw new Error("source payload artifact is missing origin.");
48
+ }
49
+ if (typeof payload.object_kind !== "string" || payload.object_kind.trim() === "") {
50
+ throw new Error("source payload artifact is missing object_kind.");
51
+ }
52
+ if (payload.attachments !== undefined) {
53
+ if (!Array.isArray(payload.attachments)) {
54
+ throw new Error("source payload artifact attachments must be an array.");
55
+ }
56
+ for (const attachment of payload.attachments) {
57
+ if (!attachment || typeof attachment !== "object" || Array.isArray(attachment)) {
58
+ throw new Error("source payload artifact attachments must contain objects.");
59
+ }
60
+ }
61
+ }
62
+ return payload;
63
+ }
64
+ function checksumPayload(payload) {
65
+ return sha256(payload.markup);
66
+ }
67
+ function handleForPayload(payload) {
68
+ const id = payload.object_id === undefined ? "unknown" : String(payload.object_id);
69
+ const slug = id
70
+ .replace(/[^A-Za-z0-9._-]+/g, "-")
71
+ .replace(/^-+|-+$/g, "")
72
+ .slice(0, 64) || "source";
73
+ return `src-${slug}-${checksumPayload(payload).slice(0, 16)}-${randomUUID().slice(0, 8)}`;
74
+ }
75
+ export function createSourcePayloadRef(payload) {
76
+ const source = assertSourcePayload(payload);
77
+ const computed = checksumPayload(source);
78
+ const declared = normalizeChecksum(source.checksum);
79
+ if (declared && declared !== computed) {
80
+ throw new Error("source payload checksum does not match markup.");
81
+ }
82
+ const createdAt = new Date().toISOString();
83
+ const ttl = ttlSeconds();
84
+ const expiresAt = ttl > 0 ? new Date(Date.now() + ttl * 1000).toISOString() : null;
85
+ const handle = handleForPayload(source);
86
+ const envelope = {
87
+ type: "diviops.cross_env.source_payload_ref.v1",
88
+ created_at: createdAt,
89
+ expires_at: expiresAt,
90
+ source_payload: { ...source, checksum: computed },
91
+ checksum: {
92
+ algorithm: "sha256",
93
+ computed,
94
+ },
95
+ };
96
+ mkdirSync(payloadRoot(), { recursive: true });
97
+ writeFileSync(payloadPath(handle), `${JSON.stringify(envelope, null, 2)}\n`, {
98
+ encoding: "utf8",
99
+ mode: 0o600,
100
+ });
101
+ return {
102
+ handle,
103
+ checksum: computed,
104
+ algorithm: "sha256",
105
+ storage: "server_local_artifact",
106
+ ...(expiresAt ? { expires_at: expiresAt } : {}),
107
+ };
108
+ }
109
+ export function loadSourcePayloadRef(ref) {
110
+ if (!ref || typeof ref !== "object" || Array.isArray(ref)) {
111
+ throw new Error("source_payload_ref must be an object.");
112
+ }
113
+ const sourceRef = ref;
114
+ if (typeof sourceRef.handle !== "string") {
115
+ throw new Error("source_payload_ref.handle is required.");
116
+ }
117
+ assertHandle(sourceRef.handle);
118
+ const expected = normalizeChecksum(sourceRef.checksum);
119
+ if (!/^[a-f0-9]{64}$/.test(expected)) {
120
+ throw new Error("source_payload_ref.checksum must be a sha256 hex value.");
121
+ }
122
+ const file = payloadPath(sourceRef.handle);
123
+ let content;
124
+ try {
125
+ content = readFileSync(file, "utf8");
126
+ }
127
+ catch (err) {
128
+ const code = typeof err === "object" && err !== null && "code" in err
129
+ ? err.code
130
+ : undefined;
131
+ if (code === "ENOENT") {
132
+ throw new Error("source_payload_ref artifact was not found.");
133
+ }
134
+ throw new Error("source_payload_ref artifact could not be read.");
135
+ }
136
+ let parsed;
137
+ try {
138
+ parsed = JSON.parse(content);
139
+ }
140
+ catch {
141
+ throw new Error("source_payload_ref artifact is not valid JSON.");
142
+ }
143
+ const envelope = parsed;
144
+ const isEnvelope = envelope?.type === "diviops.cross_env.source_payload_ref.v1";
145
+ if (isEnvelope) {
146
+ if (envelope.expires_at) {
147
+ const expiresAt = Date.parse(envelope.expires_at);
148
+ if (!Number.isFinite(expiresAt) || Date.now() > expiresAt) {
149
+ throw new Error("source_payload_ref artifact is expired.");
150
+ }
151
+ }
152
+ }
153
+ else {
154
+ const ttl = ttlSeconds();
155
+ if (ttl > 0) {
156
+ let stats;
157
+ try {
158
+ stats = statSync(file);
159
+ }
160
+ catch {
161
+ throw new Error("source_payload_ref artifact could not be read.");
162
+ }
163
+ if (Date.now() - stats.mtimeMs > ttl * 1000) {
164
+ throw new Error("source_payload_ref artifact is expired.");
165
+ }
166
+ }
167
+ }
168
+ const payload = assertSourcePayload(isEnvelope ? envelope.source_payload : parsed);
169
+ const computed = checksumPayload(payload);
170
+ const declared = normalizeChecksum(payload.checksum);
171
+ if (declared && declared !== computed) {
172
+ throw new Error("source_payload_ref artifact checksum does not match markup.");
173
+ }
174
+ if (computed !== expected) {
175
+ throw new Error("source_payload_ref checksum does not match artifact markup.");
176
+ }
177
+ return { ...payload, checksum: computed };
178
+ }
package/dist/index.js CHANGED
@@ -15,6 +15,7 @@ import { WPClient } from "./wp-client.js";
15
15
  import { MissingCapabilityError, proToolGatesSatisfied } from "./compatibility.js";
16
16
  import { ErrorCodes, envelopeMap, recordIdempotent, serializeEnvelope, withCode, wrapResponse, } from "./envelope.js";
17
17
  import { preflightCrossEnvHeaderSync, } from "./cross-env-preflight/header-preflight.js";
18
+ import { createSourcePayloadRef, loadSourcePayloadRef, } from "./cross-env-preflight/source-payload-ref.js";
18
19
  import { optimizeSchema } from "./schema-optimizer.js";
19
20
  import { schemaModuleRoute } from "./schema-route.js";
20
21
  import { createWpCli } from "./wp-cli.js";
@@ -1942,7 +1943,7 @@ registerPluginTool("diviops_cross_env_target_context_get", {
1942
1943
  };
1943
1944
  });
1944
1945
  registerPluginTool("diviops_cross_env_source_export_get", {
1945
- description: "Export read-only, secret-free source-site payload for the offline cross-environment Theme Builder header preflight. Produces JSON suitable for `diviops-cross-env-preflight --source`: source origin, `tb_header_layout` metadata, sanitized markup, bare sha256 checksum of that exported markup, export timestamp, DiviOps plugin version, and best-effort attachment inventory from markup media URLs and attachment IDs. This Free/core tool does not write layouts, upload media, create global colors, reconcile references, expose cookies, nonces, app passwords, signed URLs, query strings, fragments, admin URLs, or local filesystem paths. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; unsupported source_kind returns invalid_input, and missing/non-header source layouts return not_found.",
1946
+ description: "Export read-only, secret-free source-site payload for the offline cross-environment Theme Builder header preflight. Produces JSON suitable for `diviops-cross-env-preflight --source`: source origin, `tb_header_layout` metadata, sanitized markup, bare sha256 checksum of that exported markup, export timestamp, DiviOps plugin version, and best-effort attachment inventory from markup media URLs and attachment IDs. The MCP server also writes the exported payload to a bounded local artifact under `.diviops-tmp/cross-env-source-payloads/` and returns `source_payload_ref` so large real headers can be applied later without inlining full markup through the model. This Free/core tool does not write WordPress layouts, upload media, create global colors, reconcile references, expose cookies, nonces, app passwords, signed URLs, query strings, fragments, admin URLs, or arbitrary local filesystem paths. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; unsupported source_kind returns invalid_input, and missing/non-header source layouts return not_found.",
1946
1947
  inputSchema: {
1947
1948
  source_id: z
1948
1949
  .number()
@@ -1963,19 +1964,32 @@ registerPluginTool("diviops_cross_env_source_export_get", {
1963
1964
  annotations: { idempotentHint: true },
1964
1965
  _meta: { idempotent: "true" },
1965
1966
  }, async ({ source_id, source_kind }) => {
1966
- const body = {
1967
- source_id,
1968
- source_kind: source_kind ?? "tb_header_layout",
1969
- };
1970
- const result = await wp.requestEnveloped("/cross-env/source-export", {
1971
- method: "POST",
1972
- body,
1967
+ const withRef = await wrapResponse(async () => {
1968
+ const body = {
1969
+ source_id,
1970
+ source_kind: source_kind ?? "tb_header_layout",
1971
+ };
1972
+ const result = await wp.requestEnveloped("/cross-env/source-export", {
1973
+ method: "POST",
1974
+ body,
1975
+ });
1976
+ return envelopeMap(result, (data) => ({
1977
+ ...data,
1978
+ source_payload_ref: createSourcePayloadRef(data),
1979
+ _meta: {
1980
+ ...(typeof data._meta === "object" &&
1981
+ data._meta !== null
1982
+ ? (data._meta ?? {})
1983
+ : {}),
1984
+ source_payload_ref: "server-local artifact handle for diviops_cross_env_header_apply; stores the same source payload under .diviops-tmp/cross-env-source-payloads and is bounded by handle + checksum + TTL",
1985
+ },
1986
+ }));
1973
1987
  });
1974
1988
  return {
1975
1989
  content: [
1976
1990
  {
1977
1991
  type: "text",
1978
- text: serializeEnvelope(result, "diviops_cross_env_source_export_get"),
1992
+ text: serializeEnvelope(withRef, "diviops_cross_env_source_export_get"),
1979
1993
  },
1980
1994
  ],
1981
1995
  };
@@ -3382,6 +3396,21 @@ const CrossEnvSourcePayloadSchema = z
3382
3396
  attachments: z.array(CrossEnvSourceAttachmentSchema).optional(),
3383
3397
  })
3384
3398
  .passthrough();
3399
+ const CrossEnvSourcePayloadRefSchema = z
3400
+ .object({
3401
+ handle: z
3402
+ .string()
3403
+ .regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/)
3404
+ .describe("Server-created source payload artifact handle returned by diviops_cross_env_source_export_get."),
3405
+ checksum: z
3406
+ .string()
3407
+ .regex(/^(sha256:)?[a-fA-F0-9]{64}$/)
3408
+ .describe("sha256 checksum of the referenced source payload markup."),
3409
+ algorithm: z.literal("sha256").optional(),
3410
+ storage: z.literal("server_local_artifact").optional(),
3411
+ expires_at: z.string().optional(),
3412
+ })
3413
+ .passthrough();
3385
3414
  function normalizeReviewedFingerprint(value) {
3386
3415
  return value.trim().replace(/^sha256:/i, "").toLowerCase();
3387
3416
  }
@@ -3405,9 +3434,10 @@ function sourceHintsFromPayload(source) {
3405
3434
  function registerProTools() {
3406
3435
  // diviops_cross_env_header_apply — guarded Pro apply for reviewed header preflight
3407
3436
  registerProTool("diviops_cross_env_header_apply", {
3408
- description: "Apply a reviewed cross-environment Theme Builder header payload into an existing target header layout (Pro tier; requires the cross_env Pro module). This first MVP is intentionally narrow: it requires `confirm_apply: true`, a source export payload with checksum, an existing target `destination_id`, and the reviewed `confirmation_binding.fingerprint` from `diviops-cross-env-preflight`. The server re-exports current target context, reruns the TypeScript preflight engine, refuses fingerprint mismatch, unsafe verdicts, destination checksum drift, missing/ambiguous attachment remaps, missing global-color value evidence, and off-canvas/canvas references, then calls the Pro route with the verified plan. The Pro route re-loads the destination post, verifies the current checksum again, builds content only from source-origin upload URL rewrites and proven attachment-ID remaps, writes with readback/rollback evidence, and runs Divi static-resource cleanup plus explicit _divi_dynamic_assets_cached_feature_used cleanup. No media upload/import, global-color creation/import, new layout creation, off-canvas reconcile, public/store/license change, or live-site smoke is performed by this tool. Returns the standardized envelope { ok, data?, error: { code, message, hint?, data? } }. Error codes include cross_env.confirmation_required, cross_env.fingerprint_mismatch, cross_env.preflight_not_safe, cross_env.destination_checksum_drift, cross_env.source_checksum_mismatch, cross_env.content_write_corruption, invalid_input, not_found, forbidden, and wp_error.",
3437
+ description: "Apply a reviewed cross-environment Theme Builder header payload into an existing target header layout (Pro tier; requires the cross_env Pro module). This first MVP is intentionally narrow: it requires `confirm_apply: true`, either an inline source export payload or a bounded `source_payload_ref` returned by diviops_cross_env_source_export_get, an existing target `destination_id`, and the reviewed `confirmation_binding.fingerprint` from `diviops-cross-env-preflight`. Large real headers should use `source_payload_ref`; inline `source_payload` remains supported for small/disposable tests. The server loads referenced payload bytes from its own `.diviops-tmp/cross-env-source-payloads/` artifact store, verifies checksum, re-exports current target context, reruns the TypeScript preflight engine, refuses fingerprint mismatch, unsafe verdicts, destination checksum drift, missing/ambiguous attachment remaps, missing global-color value evidence, and off-canvas/canvas references, then calls the Pro route with the verified plan. The Pro route re-loads the destination post, verifies the current checksum again, builds content only from source-origin upload URL rewrites and proven attachment-ID remaps, writes with readback/rollback evidence, and runs Divi static-resource cleanup plus explicit _divi_dynamic_assets_cached_feature_used cleanup. No media upload/import, global-color creation/import, new layout creation, off-canvas reconcile, public/store/license change, or live-site smoke is performed by this tool. Returns the standardized envelope { ok, data?, error: { code, message, hint?, data? } }. Error codes include cross_env.confirmation_required, cross_env.source_payload_ref_invalid, cross_env.fingerprint_mismatch, cross_env.preflight_not_safe, cross_env.destination_checksum_drift, cross_env.source_checksum_mismatch, cross_env.content_write_corruption, invalid_input, not_found, forbidden, and wp_error.",
3409
3438
  inputSchema: {
3410
- source_payload: CrossEnvSourcePayloadSchema.describe("The `data` object returned by diviops_cross_env_source_export_get on the source site."),
3439
+ source_payload: CrossEnvSourcePayloadSchema.optional().describe("The `data` object returned by diviops_cross_env_source_export_get on the source site. Use source_payload_ref instead for large real headers."),
3440
+ source_payload_ref: CrossEnvSourcePayloadRefSchema.optional().describe("Bounded server-local artifact reference returned as data.source_payload_ref by diviops_cross_env_source_export_get. Preferred for large real headers because it avoids inlining full markup through the model."),
3411
3441
  destination_id: z
3412
3442
  .number()
3413
3443
  .int()
@@ -3428,21 +3458,39 @@ function registerProTools() {
3428
3458
  },
3429
3459
  annotations: { idempotentHint: false },
3430
3460
  _meta: { idempotent: "conditional" },
3431
- }, async ({ source_payload, destination_id, destination_kind, reviewed_fingerprint, confirm_apply, }) => {
3461
+ }, async ({ source_payload, source_payload_ref, destination_id, destination_kind, reviewed_fingerprint, confirm_apply, }) => {
3432
3462
  const result = await wrapResponse(async () => {
3433
3463
  if (confirm_apply !== true) {
3434
3464
  withCode("cross_env.confirmation_required", "confirm_apply: true is required before a cross-env header apply can mutate content.", "Review the preflight report, then retry with confirm_apply: true.");
3435
3465
  }
3466
+ if (source_payload && source_payload_ref) {
3467
+ withCode("invalid_input", "Provide either source_payload or source_payload_ref, not both.", "Use source_payload_ref for large real headers and inline source_payload only for small/disposable tests.", { fields: ["source_payload", "source_payload_ref"] });
3468
+ }
3469
+ if (!source_payload && !source_payload_ref) {
3470
+ withCode("invalid_input", "Either source_payload or source_payload_ref is required.", "Run diviops_cross_env_source_export_get and pass its data.source_payload_ref for large real headers.", { fields: ["source_payload", "source_payload_ref"] });
3471
+ }
3472
+ let resolvedSourcePayload;
3473
+ if (source_payload) {
3474
+ resolvedSourcePayload = source_payload;
3475
+ }
3476
+ else {
3477
+ try {
3478
+ resolvedSourcePayload = loadSourcePayloadRef(source_payload_ref);
3479
+ }
3480
+ catch (err) {
3481
+ withCode("cross_env.source_payload_ref_invalid", err instanceof Error ? err.message : String(err), "Re-run diviops_cross_env_source_export_get and pass the fresh data.source_payload_ref.", { source_payload_ref });
3482
+ }
3483
+ }
3436
3484
  const targetBody = {
3437
3485
  destination_id,
3438
3486
  destination_kind: destination_kind ?? "tb_header_layout",
3439
- ...sourceHintsFromPayload(source_payload),
3487
+ ...sourceHintsFromPayload(resolvedSourcePayload),
3440
3488
  };
3441
3489
  const targetEnvelope = await wp.requestEnveloped("/cross-env/target-context", { method: "POST", body: targetBody });
3442
3490
  if (!targetEnvelope.ok)
3443
3491
  return targetEnvelope;
3444
3492
  const report = preflightCrossEnvHeaderSync({
3445
- source: source_payload,
3493
+ source: resolvedSourcePayload,
3446
3494
  target: targetEnvelope.data,
3447
3495
  });
3448
3496
  const reviewed = normalizeReviewedFingerprint(reviewed_fingerprint);
@@ -3466,8 +3514,8 @@ function registerProTools() {
3466
3514
  confirm_apply: true,
3467
3515
  destination_id,
3468
3516
  destination_kind: destination_kind ?? "tb_header_layout",
3469
- source_payload,
3470
- source_checksum: source_payload.checksum,
3517
+ source_payload: resolvedSourcePayload,
3518
+ source_checksum: resolvedSourcePayload.checksum,
3471
3519
  destination_checksum: report.target.destination_checksum,
3472
3520
  reviewed_fingerprint: reviewed,
3473
3521
  preflight_report: report,
@@ -4019,9 +4067,10 @@ function registerProTools() {
4019
4067
  //
4020
4068
  // Store-deployment helper surface. This intentionally complements
4021
4069
  // FluentCart's native MCP by focusing on DiviOps-specific launch
4022
- // readiness: metadata-only download rows, attaching an already-present
4023
- // server-side ZIP, and the FCP Pro updater changelog field. No binary
4024
- // upload and no signed buyer URLs.
4070
+ // readiness: metadata-only download rows, validating an already-present
4071
+ // server-side ZIP, copying it into FluentCart-managed download storage,
4072
+ // and the FCP Pro updater changelog field. No MCP-client binary upload and
4073
+ // no signed buyer URLs.
4025
4074
  // diviops_fc_download_list — POST /diviops/v1/pro/fluentcart/products/{id}/downloads
4026
4075
  registerProTool("diviops_fc_download_list", {
4027
4076
  description: "List FluentCart downloadable-file rows for a product (Pro tier; V3.4; requires FluentCart Pro installed + activated). Read-only metadata surface for store artifact deployment. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; success payload is { product_id, downloads: DownloadRow[] }. DownloadRow is { id, title, file_name, driver, file_size, type, variation_ids, is_update_file } — metadata only, never file_path, file_url, download_identifier, signed URLs, or buyer URLs. `is_update_file` is derived from the product's license_settings.global_update_file pointer when present. Use this before `diviops_fc_license_settings_update` so the updater pointer can be set to the plugin ZIP row, not the suite ZIP row. Error codes: invalid_input (400), not_found (404), fluentcart.module_inactive (412), fluentcart.query_failed (500). Idempotency: read-only.",
@@ -4047,7 +4096,7 @@ function registerProTools() {
4047
4096
  }, { target: "fluentcart", capabilityKey: "fluentcart_download_list" });
4048
4097
  // diviops_fc_download_attach — POST /diviops/v1/pro/fluentcart/products/{id}/downloads/attach
4049
4098
  registerProTool("diviops_fc_download_attach", {
4050
- description: "Attach an already-present server-side ZIP as a FluentCart downloadable-file row (Pro tier; V3.4; requires FluentCart Pro installed + activated). This is NOT a binary upload tool: `file_path` must resolve to a readable .zip on the WordPress server under ABSPATH or the uploads directory. The response never exposes file paths, file URLs, download identifiers, signed URLs, or buyer URLs. Required: product_id, file_path. Optional: file_name (defaults to basename(file_path), must end in .zip), title (defaults to filename without .zip), variation_ids (must belong to this product; empty means all variants), expected_sha1, expected_size, allow_duplicate (default false), dry_run. Duplicate detection rejects an existing row with the same file_name or title unless allow_duplicate:true is passed. Expected hash/size let operators verify the server-side file matches the locally built artifact before creating the row. Apply-mode success payload is { product_id, created: DownloadRow, downloads: DownloadRow[] } with DownloadRow metadata only. This tool only creates the download row and enables manage_downloadable; it does NOT set license_settings.global_update_file — follow with diviops_fc_license_settings_update using the created row ID. Error codes: invalid_input (400), not_found (404), fluentcart.download_duplicate (409), fluentcart.module_inactive (412), fluentcart.command_failed (500). Idempotency: false; repeat calls are rejected by duplicate detection unless allow_duplicate:true." +
4099
+ description: "Attach an already-present server-side ZIP as a FluentCart downloadable-file row (Pro tier; V3.4; requires FluentCart Pro installed + activated). This is NOT a binary upload tool: `file_path` must resolve to a readable .zip on the WordPress server under ABSPATH or the uploads directory. Apply mode copies the validated file into FluentCart's managed `wp-content/uploads/fluent-cart/*__fluent-cart__*.zip` storage before creating the row, because FluentCart's signed package endpoint serves that managed filename shape. The response never exposes file paths, file URLs, download identifiers, signed URLs, or buyer URLs. Required: product_id, file_path. Optional: file_name (defaults to basename(file_path), must end in .zip), title (defaults to filename without .zip), variation_ids (must belong to this product; empty means all variants), expected_sha1, expected_size, allow_duplicate (default false), dry_run. Duplicate detection rejects an existing row with the same file_name or title unless allow_duplicate:true is passed. Expected hash/size let operators verify the server-side file matches the locally built artifact before creating the row. Apply-mode success payload is { product_id, created: DownloadRow, downloads: DownloadRow[] } with DownloadRow metadata only. This tool only creates the download row and enables manage_downloadable; it does NOT set license_settings.global_update_file — follow with diviops_fc_license_settings_update using the created row ID. Error codes: invalid_input (400), not_found (404), fluentcart.download_duplicate (409), fluentcart.module_inactive (412), fluentcart.command_failed (500). Idempotency: false; repeat calls are rejected by duplicate detection unless allow_duplicate:true." +
4051
4100
  DRY_RUN_DESC_SUFFIX,
4052
4101
  inputSchema: {
4053
4102
  product_id: z
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diviops/mcp-server",
3
- "version": "1.5.30",
3
+ "version": "1.5.31",
4
4
  "description": "MCP server exposing Divi 5 Visual Builder as tools for Claude",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",