@usethrottle/mcp 0.4.1 → 0.4.3

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/mcp.js CHANGED
@@ -194,6 +194,8 @@ add("Customers", "customers", ["read", "write"], { read: "View customers", write
194
194
  add("Customers", "customer_pii", ["read"], { read: "View customer PII" }, { sensitive: true });
195
195
  add("Customers", "customer_addresses", ["read", "write"], { read: "View addresses", write: "Manage addresses" });
196
196
  add("Customers", "customer_payment_methods", ["read", "write"], { read: "View stored cards", write: "Manage stored cards" }, { sensitive: true });
197
+ add("Customers", "customer_tokens", ["read"], { read: "Check shoppers' sign-in tokens" });
198
+ add("Customers", "customer_directory", ["read"], { read: "Find customers by name or email" }, { sensitive: true });
197
199
  add(
198
200
  "Customer accounts",
199
201
  "customer_accounts",
@@ -326,6 +328,7 @@ var EVENT_SCOPE_OVERRIDES = {
326
328
  "subscription.invoice_refunded": "payment_refunds:read",
327
329
  "payment.disputed": "payment_disputes:read",
328
330
  "payment.dispute_cleared": "payment_disputes:read",
331
+ "payment.dispute_lost": "payment_disputes:read",
329
332
  "fulfillment.digital.delivered": "fulfillment_digital:read"
330
333
  };
331
334
  var PREFIX_RULES = [
@@ -634,7 +637,7 @@ var ACTIONS = [
634
637
  {
635
638
  id: "search_customers",
636
639
  title: "Search customers",
637
- description: "Find customers by name, email or external id, or list them by creation date. Over an OAuth connection (ChatGPT, Claude) text search is not available \u2014 list by date instead \u2014 because every field it could match is withheld there.",
640
+ description: "Find customers by name, company, email or external id, or list them by creation date. Over an OAuth connection (ChatGPT, Claude) text search is not available \u2014 list by date instead \u2014 because every field it could match is withheld there.",
638
641
  kind: "read",
639
642
  scopes: ["customers:read"],
640
643
  input: [
@@ -1479,7 +1482,7 @@ var ACTIONS = [
1479
1482
  {
1480
1483
  id: "create_customer",
1481
1484
  title: "Create a customer",
1482
- description: "Create a customer record. Use search_customers first if the buyer may already exist \u2014 this does not de-duplicate by email.",
1485
+ 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.",
1483
1486
  kind: "write",
1484
1487
  scopes: ["customers:write"],
1485
1488
  input: [
@@ -1557,7 +1560,7 @@ var ACTIONS = [
1557
1560
  {
1558
1561
  id: "create_checkout_link",
1559
1562
  title: "Create a checkout link",
1560
- description: "Build a cart from line items and return a hosted checkout URL the buyer can pay at. Prices are in minor units (2500 = $25.00).",
1563
+ description: "Build a cart from line items and return a hosted checkout URL the buyer can pay at. Prices are integers in the minor units of the cart currency (2500 = 25.00 in a two-decimal currency).",
1561
1564
  kind: "write",
1562
1565
  scopes: ["carts:write", "cart_items:write", "checkout_sessions:write"],
1563
1566
  input: [
@@ -1711,6 +1714,29 @@ var ACTIONS = [
1711
1714
  channels: ["mcp", "zapier", "make", "n8n"],
1712
1715
  idempotent: true
1713
1716
  },
1717
+ {
1718
+ id: "set_subscription_payment_method",
1719
+ title: "Change a subscription's card",
1720
+ 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.",
1721
+ kind: "write",
1722
+ scopes: ["subscriptions:write"],
1723
+ input: [
1724
+ { name: "id", type: "string", required: true, description: "Subscription id." },
1725
+ {
1726
+ name: "paymentMethodId",
1727
+ type: "string",
1728
+ required: true,
1729
+ description: "One of the subscription customer's saved cards (GET /api/v1/customers/:id/payment-methods): active and in date."
1730
+ }
1731
+ ],
1732
+ requests: [{ method: "PATCH", path: "/api/v1/subscriptions/:id/payment-method" }],
1733
+ channels: ["mcp", "zapier", "make", "n8n"],
1734
+ idempotent: true,
1735
+ guardrails: [
1736
+ "Changes which card future renewals charge. Confirm the subscription and the card (brand, last four) with the user first.",
1737
+ "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."
1738
+ ]
1739
+ },
1714
1740
  {
1715
1741
  id: "cancel_subscription",
1716
1742
  title: "Cancel a subscription",
@@ -2422,6 +2448,14 @@ var HANDLERS = {
2422
2448
  idempotencyKey: `mcp-manage-subscription-${id}-${action}-${Date.now()}`
2423
2449
  });
2424
2450
  },
2451
+ set_subscription_payment_method: async (ctx, args) => {
2452
+ const id = String(args.id);
2453
+ return ctx.client.patch(`/api/v1/subscriptions/${id}/payment-method`, {
2454
+ // `id` is the path parameter; the body is `.strict()`.
2455
+ body: { paymentMethodId: args.paymentMethodId },
2456
+ idempotencyKey: `mcp-set-subscription-card-${id}-${String(args.paymentMethodId)}-${Date.now()}`
2457
+ });
2458
+ },
2425
2459
  create_quote: async (ctx, args) => {
2426
2460
  const items = Array.isArray(args.items) ? args.items : [];
2427
2461
  if (args.netN !== void 0 && items.some((item) => item && item.recurring)) {
@@ -2686,6 +2720,7 @@ var DISPLAY_QUALIFIERS = [
2686
2720
  "Payment processing",
2687
2721
  "Disputed",
2688
2722
  "Authorization expired",
2723
+ "Chargeback lost",
2689
2724
  "Returned",
2690
2725
  "Partially returned",
2691
2726
  "Delivered",
@@ -2763,6 +2798,8 @@ var PAYMENT = {
2763
2798
  cardBrand: S,
2764
2799
  disputed: S,
2765
2800
  disputeOpenedAt: S,
2801
+ disputeOutcome: S,
2802
+ disputeClosedAt: S,
2766
2803
  errorCode: S,
2767
2804
  netN: S,
2768
2805
  netNSource: S,
@@ -2825,6 +2862,10 @@ var SUBSCRIPTION = {
2825
2862
  pendingIntervalCount: S,
2826
2863
  scheduleTotal: S,
2827
2864
  nextPaymentAmount: S,
2865
+ // A physical subscription (0236): the method is an enum, and the ship-to is
2866
+ // kept to its country like every other address here.
2867
+ deliveryMethod: S,
2868
+ shippingAddress: ADDRESS,
2828
2869
  paymentSchedule: [{
2829
2870
  index: S,
2830
2871
  amount: S,
@@ -3201,7 +3242,7 @@ var OAUTH_PROJECTIONS = {
3201
3242
  };
3202
3243
 
3203
3244
  // src/server.ts
3204
- var VERSION = true ? "0.4.1" : "0.0.0-dev";
3245
+ var VERSION = true ? "0.4.3" : "0.0.0-dev";
3205
3246
  function registerableActions(policy) {
3206
3247
  const isProduction = policy.identity.environment.providerEnvironment === "production";
3207
3248
  return actionsForChannel("mcp").filter((action) => {
@@ -3230,7 +3271,7 @@ function buildInstructions(identity, actions, policy) {
3230
3271
  '- The application can vary per call: pass "applicationId" on a read or analytics tool to reach a different application in this workspace, and call list_applications to see which ones this connection can reach. Omitting applicationId uses the application this connection was authorized for.',
3231
3272
  "- Every analytics result covers exactly ONE application and names it in `application`. Say which application a figure describes. If the user asks about their business as a whole and this connection reaches more than one application, do not answer from the default alone \u2014 call list_applications, then query each and add them up, or ask which application they mean.",
3232
3273
  '- List tools return { data, pagination }. When pagination.hasMore is true, pass pagination.cursor back as "cursor" rather than raising "limit".',
3233
- "- Amounts are integer minor units (2500 = $25.00).",
3274
+ "- Amounts are integer minor units of the record's currency (2500 = 25.00 in a two-decimal currency; JPY has none, KWD has three).",
3234
3275
  "- Throttle rejects snake_case on public request bodies. Before writing integration code, confirm shapes with describe_endpoint and check bodies with validate_payload instead of guessing field names.",
3235
3276
  "- API errors come back as text with a stable code. On insufficient_scopes, tell the user which scope to add \u2014 do not retry.",
3236
3277
  "- Analytics results may mark a section `omitted`. That means UNKNOWN, never zero. When `grantable` is false the data cannot be read over this connection at all \u2014 say so rather than reporting an absence."