@usethrottle/mcp 0.4.1 → 0.4.2

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/lib.cjs CHANGED
@@ -94,6 +94,8 @@ add("Customers", "customers", ["read", "write"], { read: "View customers", write
94
94
  add("Customers", "customer_pii", ["read"], { read: "View customer PII" }, { sensitive: true });
95
95
  add("Customers", "customer_addresses", ["read", "write"], { read: "View addresses", write: "Manage addresses" });
96
96
  add("Customers", "customer_payment_methods", ["read", "write"], { read: "View stored cards", write: "Manage stored cards" }, { sensitive: true });
97
+ add("Customers", "customer_tokens", ["read"], { read: "Check shoppers' sign-in tokens" });
98
+ add("Customers", "customer_directory", ["read"], { read: "Find customers by name or email" }, { sensitive: true });
97
99
  add(
98
100
  "Customer accounts",
99
101
  "customer_accounts",
@@ -226,6 +228,7 @@ var EVENT_SCOPE_OVERRIDES = {
226
228
  "subscription.invoice_refunded": "payment_refunds:read",
227
229
  "payment.disputed": "payment_disputes:read",
228
230
  "payment.dispute_cleared": "payment_disputes:read",
231
+ "payment.dispute_lost": "payment_disputes:read",
229
232
  "fulfillment.digital.delivered": "fulfillment_digital:read"
230
233
  };
231
234
  var PREFIX_RULES = [
@@ -1379,7 +1382,7 @@ var ACTIONS = [
1379
1382
  {
1380
1383
  id: "create_customer",
1381
1384
  title: "Create a customer",
1382
- description: "Create a customer record. Use search_customers first if the buyer may already exist \u2014 this does not de-duplicate by email.",
1385
+ description: "Create a customer record. Email and externalId are each unique per application: a value that already belongs to a customer fails with 409 customer_already_exists rather than returning the existing record, so use search_customers first if the buyer may already exist.",
1383
1386
  kind: "write",
1384
1387
  scopes: ["customers:write"],
1385
1388
  input: [
@@ -1611,6 +1614,29 @@ var ACTIONS = [
1611
1614
  channels: ["mcp", "zapier", "make", "n8n"],
1612
1615
  idempotent: true
1613
1616
  },
1617
+ {
1618
+ id: "set_subscription_payment_method",
1619
+ title: "Change a subscription's card",
1620
+ description: "Set the saved card one subscription renews on. Only that subscription moves; the customer's default card and their other subscriptions stay as they are. Nothing is charged now.",
1621
+ kind: "write",
1622
+ scopes: ["subscriptions:write"],
1623
+ input: [
1624
+ { name: "id", type: "string", required: true, description: "Subscription id." },
1625
+ {
1626
+ name: "paymentMethodId",
1627
+ type: "string",
1628
+ required: true,
1629
+ description: "One of the subscription customer's saved cards (GET /api/v1/customers/:id/payment-methods): active and in date."
1630
+ }
1631
+ ],
1632
+ requests: [{ method: "PATCH", path: "/api/v1/subscriptions/:id/payment-method" }],
1633
+ channels: ["mcp", "zapier", "make", "n8n"],
1634
+ idempotent: true,
1635
+ guardrails: [
1636
+ "Changes which card future renewals charge. Confirm the subscription and the card (brand, last four) with the user first.",
1637
+ "409 payment_method_unusable: the card is not this customer's active, in-date saved card. 409 invalid_state: the subscription is cancelled or completed."
1638
+ ]
1639
+ },
1614
1640
  {
1615
1641
  id: "cancel_subscription",
1616
1642
  title: "Cancel a subscription",
@@ -2449,6 +2475,14 @@ var HANDLERS = {
2449
2475
  idempotencyKey: `mcp-manage-subscription-${id}-${action}-${Date.now()}`
2450
2476
  });
2451
2477
  },
2478
+ set_subscription_payment_method: async (ctx, args) => {
2479
+ const id = String(args.id);
2480
+ return ctx.client.patch(`/api/v1/subscriptions/${id}/payment-method`, {
2481
+ // `id` is the path parameter; the body is `.strict()`.
2482
+ body: { paymentMethodId: args.paymentMethodId },
2483
+ idempotencyKey: `mcp-set-subscription-card-${id}-${String(args.paymentMethodId)}-${Date.now()}`
2484
+ });
2485
+ },
2452
2486
  create_quote: async (ctx, args) => {
2453
2487
  const items = Array.isArray(args.items) ? args.items : [];
2454
2488
  if (args.netN !== void 0 && items.some((item) => item && item.recurring)) {
@@ -2713,6 +2747,7 @@ var DISPLAY_QUALIFIERS = [
2713
2747
  "Payment processing",
2714
2748
  "Disputed",
2715
2749
  "Authorization expired",
2750
+ "Chargeback lost",
2716
2751
  "Returned",
2717
2752
  "Partially returned",
2718
2753
  "Delivered",
@@ -2790,6 +2825,8 @@ var PAYMENT = {
2790
2825
  cardBrand: S,
2791
2826
  disputed: S,
2792
2827
  disputeOpenedAt: S,
2828
+ disputeOutcome: S,
2829
+ disputeClosedAt: S,
2793
2830
  errorCode: S,
2794
2831
  netN: S,
2795
2832
  netNSource: S,
@@ -2852,6 +2889,10 @@ var SUBSCRIPTION = {
2852
2889
  pendingIntervalCount: S,
2853
2890
  scheduleTotal: S,
2854
2891
  nextPaymentAmount: S,
2892
+ // A physical subscription (0236): the method is an enum, and the ship-to is
2893
+ // kept to its country like every other address here.
2894
+ deliveryMethod: S,
2895
+ shippingAddress: ADDRESS,
2855
2896
  paymentSchedule: [{
2856
2897
  index: S,
2857
2898
  amount: S,
@@ -3228,7 +3269,7 @@ var OAUTH_PROJECTIONS = {
3228
3269
  };
3229
3270
 
3230
3271
  // src/server.ts
3231
- var VERSION = true ? "0.4.1" : "0.0.0-dev";
3272
+ var VERSION = true ? "0.4.2" : "0.0.0-dev";
3232
3273
  function registerableActions(policy) {
3233
3274
  const isProduction = policy.identity.environment.providerEnvironment === "production";
3234
3275
  return actionsForChannel("mcp").filter((action) => {