@diviops/mcp-server 1.5.28 → 1.5.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +163 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3665,6 +3665,169 @@ function registerProTools() {
3665
3665
  target: "fluentcart",
3666
3666
  capabilityKey: "fluentcart_license_settings_update",
3667
3667
  });
3668
+ // ── V3.4 — downloadable artifact metadata + license changelog ──────
3669
+ //
3670
+ // Store-deployment helper surface. This intentionally complements
3671
+ // FluentCart's native MCP by focusing on DiviOps-specific launch
3672
+ // readiness: metadata-only download rows, attaching an already-present
3673
+ // server-side ZIP, and the FCP Pro updater changelog field. No binary
3674
+ // upload and no signed buyer URLs.
3675
+ // diviops_fc_download_list — POST /diviops/v1/pro/fluentcart/products/{id}/downloads
3676
+ registerProTool("diviops_fc_download_list", {
3677
+ 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.",
3678
+ inputSchema: {
3679
+ product_id: z
3680
+ .number()
3681
+ .int()
3682
+ .positive()
3683
+ .describe("FluentCart product ID (the post ID of the fluent_products CPT entry)."),
3684
+ },
3685
+ annotations: { idempotentHint: true },
3686
+ _meta: { idempotent: "true" },
3687
+ }, async ({ product_id }) => {
3688
+ const result = await wp.requestEnveloped(`/pro/fluentcart/products/${product_id}/downloads`, { method: "POST" });
3689
+ return {
3690
+ content: [
3691
+ {
3692
+ type: "text",
3693
+ text: serializeEnvelope(result, "diviops_fc_download_list"),
3694
+ },
3695
+ ],
3696
+ };
3697
+ }, { target: "fluentcart", capabilityKey: "fluentcart_download_list" });
3698
+ // diviops_fc_download_attach — POST /diviops/v1/pro/fluentcart/products/{id}/downloads/attach
3699
+ registerProTool("diviops_fc_download_attach", {
3700
+ 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." +
3701
+ DRY_RUN_DESC_SUFFIX,
3702
+ inputSchema: {
3703
+ product_id: z
3704
+ .number()
3705
+ .int()
3706
+ .positive()
3707
+ .describe("FluentCart product ID (the post ID of the fluent_products CPT entry)."),
3708
+ file_path: z
3709
+ .string()
3710
+ .min(1)
3711
+ .describe("Server-side .zip path under ABSPATH or wp_upload_dir().basedir. Relative paths resolve under ABSPATH. No local-client upload occurs."),
3712
+ file_name: z
3713
+ .string()
3714
+ .min(1)
3715
+ .optional()
3716
+ .describe("Download filename shown to buyers/admins. Defaults to basename(file_path). Must end in .zip."),
3717
+ title: z
3718
+ .string()
3719
+ .min(1)
3720
+ .optional()
3721
+ .describe("FluentCart download title. Defaults to file_name without the .zip suffix."),
3722
+ variation_ids: z
3723
+ .array(z.number().int().positive())
3724
+ .optional()
3725
+ .describe("Optional product variation IDs this download applies to. Omit or pass [] for all variants."),
3726
+ expected_sha1: z
3727
+ .string()
3728
+ .regex(/^[a-fA-F0-9]{40}$/)
3729
+ .optional()
3730
+ .describe("Optional SHA1 of the expected server-side file. Mismatch aborts before mutation."),
3731
+ expected_size: z
3732
+ .number()
3733
+ .int()
3734
+ .min(0)
3735
+ .optional()
3736
+ .describe("Optional byte size of the expected server-side file. Mismatch aborts before mutation."),
3737
+ allow_duplicate: z
3738
+ .boolean()
3739
+ .optional()
3740
+ .describe("Default false. When false, an existing row with the same file_name or title returns fluentcart.download_duplicate."),
3741
+ dry_run: DRY_RUN_FIELD,
3742
+ },
3743
+ annotations: { idempotentHint: false },
3744
+ _meta: { idempotent: "false" },
3745
+ }, async ({ product_id, file_path, file_name, title, variation_ids, expected_sha1, expected_size, allow_duplicate, dry_run, }) => {
3746
+ const body = { file_path };
3747
+ if (file_name !== undefined)
3748
+ body.file_name = file_name;
3749
+ if (title !== undefined)
3750
+ body.title = title;
3751
+ if (variation_ids !== undefined)
3752
+ body.variation_ids = variation_ids;
3753
+ if (expected_sha1 !== undefined)
3754
+ body.expected_sha1 = expected_sha1;
3755
+ if (expected_size !== undefined)
3756
+ body.expected_size = expected_size;
3757
+ if (allow_duplicate !== undefined)
3758
+ body.allow_duplicate = allow_duplicate;
3759
+ if (dry_run !== undefined)
3760
+ body.dry_run = dry_run;
3761
+ const result = await wp.requestEnveloped(`/pro/fluentcart/products/${product_id}/downloads/attach`, { method: "POST", body });
3762
+ return {
3763
+ content: [
3764
+ {
3765
+ type: "text",
3766
+ text: serializeEnvelope(result, "diviops_fc_download_attach"),
3767
+ },
3768
+ ],
3769
+ };
3770
+ }, { target: "fluentcart", capabilityKey: "fluentcart_download_attach" });
3771
+ // diviops_fc_license_changelog_get — POST /diviops/v1/pro/fluentcart/products/{id}/license-changelog
3772
+ registerProTool("diviops_fc_license_changelog_get", {
3773
+ description: "Read the FluentCart Pro software-license changelog HTML for a product (Pro tier; V3.4; requires FluentCart Pro installed + activated). This reads ProductMeta meta_key='_fluent_sl_changelog', the field FluentCart Pro shows in Product → License Settings → Changelog Description. Read-only. Returns the standardized envelope { ok, data?, error }; success payload is { product_id, changelog_html, is_empty, storage_meta_key }. Error codes: invalid_input (400), not_found (404), fluentcart.module_inactive (412), fluentcart.query_failed (500). Idempotency: read-only.",
3774
+ inputSchema: {
3775
+ product_id: z
3776
+ .number()
3777
+ .int()
3778
+ .positive()
3779
+ .describe("FluentCart product ID (the post ID of the fluent_products CPT entry)."),
3780
+ },
3781
+ annotations: { idempotentHint: true },
3782
+ _meta: { idempotent: "true" },
3783
+ }, async ({ product_id }) => {
3784
+ const result = await wp.requestEnveloped(`/pro/fluentcart/products/${product_id}/license-changelog`, { method: "POST" });
3785
+ return {
3786
+ content: [
3787
+ {
3788
+ type: "text",
3789
+ text: serializeEnvelope(result, "diviops_fc_license_changelog_get"),
3790
+ },
3791
+ ],
3792
+ };
3793
+ }, {
3794
+ target: "fluentcart",
3795
+ capabilityKey: "fluentcart_license_changelog_get",
3796
+ });
3797
+ // diviops_fc_license_changelog_update — POST /diviops/v1/pro/fluentcart/products/{id}/license-changelog/update
3798
+ registerProTool("diviops_fc_license_changelog_update", {
3799
+ description: "Write the FluentCart Pro software-license changelog HTML for a product (Pro tier; V3.4; requires FluentCart Pro installed + activated). This writes ProductMeta meta_key='_fluent_sl_changelog', the field FluentCart Pro shows in Product → License Settings → Changelog Description. Input is sanitized by WordPress wp_kses_post on the plugin side. Supports dry_run and no-op detection. Success payload is { product_id, changed, changelog_html } or { noop:true, dry_run, product_id, changelog_html }. Error codes: invalid_input (400), not_found (404), fluentcart.module_inactive (412), fluentcart.command_failed (500). Idempotency: conditional — identical repeat is a no-op." +
3800
+ DRY_RUN_DESC_SUFFIX,
3801
+ inputSchema: {
3802
+ product_id: z
3803
+ .number()
3804
+ .int()
3805
+ .positive()
3806
+ .describe("FluentCart product ID (the post ID of the fluent_products CPT entry)."),
3807
+ changelog_html: z
3808
+ .string()
3809
+ .describe("Buyer/update-facing changelog HTML. Sanitized with wp_kses_post before storage."),
3810
+ dry_run: DRY_RUN_FIELD,
3811
+ },
3812
+ annotations: { idempotentHint: false },
3813
+ _meta: { idempotent: "conditional" },
3814
+ }, async ({ product_id, changelog_html, dry_run, }) => {
3815
+ const body = { changelog_html };
3816
+ if (dry_run !== undefined)
3817
+ body.dry_run = dry_run;
3818
+ const result = await wp.requestEnveloped(`/pro/fluentcart/products/${product_id}/license-changelog/update`, { method: "POST", body });
3819
+ return {
3820
+ content: [
3821
+ {
3822
+ type: "text",
3823
+ text: serializeEnvelope(result, "diviops_fc_license_changelog_update"),
3824
+ },
3825
+ ],
3826
+ };
3827
+ }, {
3828
+ target: "fluentcart",
3829
+ capabilityKey: "fluentcart_license_changelog_update",
3830
+ });
3668
3831
  // ── V3.1 — order/license/activation read + guarded mark-paid ───────
3669
3832
  //
3670
3833
  // FluentCart commerce-artifact readback surface plus a single
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diviops/mcp-server",
3
- "version": "1.5.28",
3
+ "version": "1.5.29",
4
4
  "description": "MCP server exposing Divi 5 Visual Builder as tools for Claude",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",