@carrierllc/mcp 0.13.25 → 0.13.26

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/dist/index.js CHANGED
@@ -80,7 +80,7 @@ import {
80
80
  verifyStorefront,
81
81
  withOcsListSummary,
82
82
  withTemplateResellerId
83
- } from "./chunk-KFIIIQ4J.js";
83
+ } from "./chunk-HTIPSHMH.js";
84
84
  import "./chunk-SHKKVIIA.js";
85
85
 
86
86
  // src/index.ts
@@ -7518,6 +7518,9 @@ function registerStorefrontDeployTools(server2, props2) {
7518
7518
  dir: z10.string().min(1).describe("Path to the scaffolded storefront directory"),
7519
7519
  target: z10.enum(TARGET_IDS).optional().describe("Force a host instead of auto-detecting"),
7520
7520
  name: z10.string().optional().describe("Project/worker name (defaults from brand)"),
7521
+ force: z10.boolean().optional().describe(
7522
+ 'Acknowledge the scaffold-default-name risk: required when the resolved name is the scaffold default "storefront"'
7523
+ ),
7521
7524
  skip_build: z10.boolean().optional().describe("Deploy the existing build without rebuilding"),
7522
7525
  push_secrets: z10.boolean().optional().describe("Stage runtime secrets on the host before deploy (default true)"),
7523
7526
  verify: z10.boolean().optional().describe("Probe the deployed URL and report whether it actually serves (default true)"),
@@ -7525,7 +7528,7 @@ function registerStorefrontDeployTools(server2, props2) {
7525
7528
  },
7526
7529
  annotations: annotationsFor("deploy_storefront", "write")
7527
7530
  },
7528
- async ({ dir, target, name, skip_build, push_secrets, verify, domain }) => {
7531
+ async ({ dir, target, name, force, skip_build, push_secrets, verify, domain }) => {
7529
7532
  const denied = denyUnlessScoped(props2, "deploy_storefront", STOREFRONT_DEPLOY_TOOL_SCOPES);
7530
7533
  if (denied) return denied;
7531
7534
  try {
@@ -7541,7 +7544,13 @@ function registerStorefrontDeployTools(server2, props2) {
7541
7544
  const result2 = await deploySite(dir, brand, {
7542
7545
  preferred,
7543
7546
  pushSecrets: push_secrets !== false,
7544
- customDomain: domain === true
7547
+ customDomain: domain === true,
7548
+ // Same identity the CLI wires in: an explicit name wins over the
7549
+ // wrangler config (CAR-313), and force acknowledges the
7550
+ // scaffold-default risk. Without these, untouched scaffolds were
7551
+ // refused outright and an explicit name was silently swallowed.
7552
+ explicitName: name,
7553
+ force: force === true
7545
7554
  });
7546
7555
  if (!result2.ok) {
7547
7556
  return err4(result2.reason ?? "Deploy failed.");
@@ -7635,8 +7644,11 @@ import { z as z11 } from "zod";
7635
7644
 
7636
7645
  // src/lib/storefront-plan-update.ts
7637
7646
  function storefrontPlanUpdate(input) {
7638
- if (input.priceCents === void 0 && input.active === void 0 && input.sortOrder === void 0) {
7639
- return { ok: false, message: "Send a price, whether the plan is for sale, or a sort order." };
7647
+ if (input.accountId !== void 0 && (!Number.isSafeInteger(input.accountId) || input.accountId <= 0)) {
7648
+ return { ok: false, message: "OCS account id must be a positive integer." };
7649
+ }
7650
+ if (input.priceCents === void 0 && input.active === void 0 && input.sortOrder === void 0 && input.accountId === void 0) {
7651
+ return { ok: false, message: "Send a price, whether the plan is for sale, a sort order, or an OCS account id." };
7640
7652
  }
7641
7653
  if (input.priceCents !== void 0 && (!Number.isSafeInteger(input.priceCents) || input.priceCents <= 0)) {
7642
7654
  return { ok: false, message: "Price must be a positive number of minor units." };
@@ -7645,6 +7657,7 @@ function storefrontPlanUpdate(input) {
7645
7657
  return { ok: false, message: "sort_order must be a non-negative integer." };
7646
7658
  }
7647
7659
  const body2 = {};
7660
+ if (input.accountId !== void 0) body2.ocs_account_id = input.accountId;
7648
7661
  if (input.priceCents !== void 0) body2.price_cents = input.priceCents;
7649
7662
  if (input.active !== void 0) body2.active = input.active;
7650
7663
  if (input.sortOrder !== void 0) body2.sort_order = input.sortOrder;
@@ -7653,7 +7666,9 @@ function storefrontPlanUpdate(input) {
7653
7666
 
7654
7667
  // src/tools-storefront-plan.ts
7655
7668
  var STOREFRONT_PLAN_TOOL_SCOPES = {
7656
- update_storefront_plan: "write"
7669
+ update_storefront_plan: "write",
7670
+ list_storefronts: "read",
7671
+ get_storefront: "read"
7657
7672
  };
7658
7673
  var ok4 = (text) => ({ content: [{ type: "text", text }] });
7659
7674
  var err5 = (text) => ({ isError: true, content: [{ type: "text", text }] });
@@ -7690,16 +7705,40 @@ async function patchStorefrontPlan(storefrontId, slug, body2) {
7690
7705
  }
7691
7706
  return { ok: res.ok, status: res.status, body: parsed };
7692
7707
  }
7708
+ async function getStorefronts(id) {
7709
+ const key = apiKey2();
7710
+ if (!key) return { ok: false, status: 401, body: { error: "not_signed_in" } };
7711
+ const res = await fetch(`${apiOrigin()}/v1/storefronts${id === void 0 ? "" : `/${encodeURIComponent(id)}`}`, { headers: { Authorization: `Bearer ${key}`, Accept: "application/json" } });
7712
+ return { ok: res.ok, status: res.status, body: await res.json() };
7713
+ }
7693
7714
  function registerStorefrontPlanTools(server2, props2, call = (path, body2) => {
7694
7715
  const [storefrontId, slug] = path.split("/");
7695
7716
  return patchStorefrontPlan(storefrontId ?? "", slug ?? "", body2);
7696
- }) {
7717
+ }, read = getStorefronts) {
7718
+ for (const name of ["list_storefronts", "get_storefront"]) {
7719
+ server2.registerTool(name, {
7720
+ title: name === "list_storefronts" ? "List Storefronts" : "Get Storefront",
7721
+ description: "Read hosted storefront plans including stored OCS account ids and account_status.",
7722
+ inputSchema: name === "get_storefront" ? { storefront_id: z11.string().min(1) } : {},
7723
+ annotations: annotationsFor(name, "read")
7724
+ }, async (args) => {
7725
+ const denied = denyUnlessScoped(props2, name, STOREFRONT_PLAN_TOOL_SCOPES);
7726
+ if (denied) return denied;
7727
+ try {
7728
+ const result2 = await read("storefront_id" in args ? String(args.storefront_id) : void 0);
7729
+ return result2.ok ? ok4(JSON.stringify(result2.body)) : err5(JSON.stringify(result2.body));
7730
+ } catch (e) {
7731
+ return err5(e instanceof Error ? e.message : "storefront read failed");
7732
+ }
7733
+ });
7734
+ }
7697
7735
  server2.registerTool(
7698
7736
  "update_storefront_plan",
7699
7737
  {
7700
7738
  title: "Update Storefront Plan",
7701
- description: "Change the retail price, whether a plan is for sale, or its display order on the caller's own hosted storefront. The plan must already exist. A price of zero or less is refused. A plan on another storefront is not found and is left unchanged. This writes the shop's own price. It does not create or change a Stripe price.",
7739
+ description: "Change the retail price, whether a plan is for sale, its OCS account, or its display order on the caller's own hosted storefront. The plan must already exist. A price of zero or less is refused. A plan on another storefront is not found and is left unchanged. This writes the shop's own price. It does not create or change a Stripe price.",
7702
7740
  inputSchema: {
7741
+ ocs_account_id: z11.number().int().positive().optional().describe("Owned OCS account override. Omit for automatic resolution."),
7703
7742
  storefront_id: z11.string().min(1).describe("Id of the hosted storefront"),
7704
7743
  slug: z11.string().min(1).describe("Plan slug, such as eu-1gb"),
7705
7744
  price_cents: z11.number().int().positive().optional().describe("Retail price in minor units. Must be greater than zero. Omit to leave the price."),
@@ -7708,10 +7747,10 @@ function registerStorefrontPlanTools(server2, props2, call = (path, body2) => {
7708
7747
  },
7709
7748
  annotations: annotationsFor("update_storefront_plan", "write")
7710
7749
  },
7711
- async ({ storefront_id, slug, price_cents, active, sort_order }) => {
7750
+ async ({ storefront_id, slug, price_cents, active, sort_order, ocs_account_id }) => {
7712
7751
  const denied = denyUnlessScoped(props2, "update_storefront_plan", STOREFRONT_PLAN_TOOL_SCOPES);
7713
7752
  if (denied) return denied;
7714
- const update = storefrontPlanUpdate({ priceCents: price_cents, active, sortOrder: sort_order });
7753
+ const update = storefrontPlanUpdate({ priceCents: price_cents, active, sortOrder: sort_order, accountId: ocs_account_id });
7715
7754
  if (!update.ok) return err5(update.message);
7716
7755
  try {
7717
7756
  const result2 = await call(`${storefront_id}/${slug}`, update.body);