@usethrottle/mcp 0.2.2 → 0.3.0
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/contract-index.json +1 -1
- package/dist/docs-index.json +1 -1
- package/dist/lib.cjs +54 -19
- package/dist/lib.cjs.map +1 -1
- package/dist/lib.js +54 -19
- package/dist/lib.js.map +1 -1
- package/dist/mcp.js +54 -19
- package/dist/mcp.js.map +1 -1
- package/package.json +3 -3
package/dist/lib.js
CHANGED
|
@@ -1471,14 +1471,22 @@ var ACTIONS = [
|
|
|
1471
1471
|
scopes: ["quotes:write"],
|
|
1472
1472
|
input: [
|
|
1473
1473
|
{ name: "customerId", type: "string", required: true, description: "Customer the quote is for." },
|
|
1474
|
-
{
|
|
1474
|
+
{
|
|
1475
|
+
name: "items",
|
|
1476
|
+
type: "array",
|
|
1477
|
+
required: true,
|
|
1478
|
+
description: "Quote line items: { name, unitPrice, quantity }. Add `recurring: { plan, interval | intervalUnit + intervalCount, totalPayments?, trialDays? }` to make a line a subscription (one per line when the quote is paid, quantity = seats; at most 10). unitPrice is then the per-period price; a free-trial line is charged nothing at acceptance."
|
|
1479
|
+
},
|
|
1475
1480
|
{ name: "expiresAt", type: "string", required: false, description: "ISO 8601 expiry." },
|
|
1476
|
-
{ name: "netN", type: "number", required: false, description: "Payment terms in days. Omit for pay-in-full." },
|
|
1481
|
+
{ name: "netN", type: "number", required: false, description: "Payment terms in days. Omit for pay-in-full. Not allowed when any item is recurring." },
|
|
1477
1482
|
{ name: "notes", type: "string", required: false, description: "Buyer-visible notes." }
|
|
1478
1483
|
],
|
|
1479
1484
|
requests: [{ method: "POST", path: "/api/v1/quotes" }],
|
|
1480
1485
|
channels: ["mcp", "zapier", "make", "n8n"],
|
|
1481
|
-
idempotent: true
|
|
1486
|
+
idempotent: true,
|
|
1487
|
+
guardrails: [
|
|
1488
|
+
"A quote with a recurring item must be pay-in-full: issuing it with net terms or a deposit fails with 422 recurring_terms_unsupported."
|
|
1489
|
+
]
|
|
1482
1490
|
},
|
|
1483
1491
|
{
|
|
1484
1492
|
id: "send_quote",
|
|
@@ -1585,12 +1593,12 @@ var ACTIONS = [
|
|
|
1585
1593
|
{
|
|
1586
1594
|
id: "send_test_webhook",
|
|
1587
1595
|
title: "Send a test webhook",
|
|
1588
|
-
description: "Send a synthetic signed event to a webhook endpoint to verify signature handling and reachability.",
|
|
1596
|
+
description: "Send a synthetic signed event to a webhook endpoint to verify signature handling and reachability. The event type must be one the endpoint is subscribed to (an endpoint subscribed to all events accepts any); otherwise the call fails with 400 validation_error naming the allowed types.",
|
|
1589
1597
|
kind: "write",
|
|
1590
1598
|
scopes: ["webhooks:write"],
|
|
1591
1599
|
input: [
|
|
1592
1600
|
{ name: "id", type: "string", required: true, description: "Endpoint id." },
|
|
1593
|
-
{ name: "eventType", type: "string", required: false, description: "Event type to simulate." }
|
|
1601
|
+
{ name: "eventType", type: "string", required: false, description: "Event type to simulate. Must be in the endpoint's subscribed events unless it subscribes to all." }
|
|
1594
1602
|
],
|
|
1595
1603
|
requests: [{ method: "POST", path: "/api/v1/webhook-endpoints/:id/test" }],
|
|
1596
1604
|
channels: ["mcp", "n8n"],
|
|
@@ -2386,14 +2394,14 @@ var HANDLERS = {
|
|
|
2386
2394
|
idempotencyKey: `mcp-manage-subscription-${id}-${action}-${Date.now()}`
|
|
2387
2395
|
});
|
|
2388
2396
|
},
|
|
2389
|
-
create_quote: async (ctx, args) =>
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
ctx.client.post("/api/v1/quotes", {
|
|
2397
|
+
create_quote: async (ctx, args) => {
|
|
2398
|
+
const items = Array.isArray(args.items) ? args.items : [];
|
|
2399
|
+
if (args.netN !== void 0 && items.some((item) => item && item.recurring)) {
|
|
2400
|
+
throw new Error(
|
|
2401
|
+
"create_quote: items with `recurring` need pay-in-full terms \u2014 omit netN. Net terms cannot start a subscription."
|
|
2402
|
+
);
|
|
2403
|
+
}
|
|
2404
|
+
return ctx.client.post("/api/v1/quotes", {
|
|
2397
2405
|
body: {
|
|
2398
2406
|
customerId: args.customerId,
|
|
2399
2407
|
items: args.items,
|
|
@@ -2402,8 +2410,8 @@ var HANDLERS = {
|
|
|
2402
2410
|
buyerNote: args.notes
|
|
2403
2411
|
},
|
|
2404
2412
|
idempotencyKey: `mcp-create-quote-${String(args.customerId)}-${Date.now()}`
|
|
2405
|
-
})
|
|
2406
|
-
|
|
2413
|
+
});
|
|
2414
|
+
},
|
|
2407
2415
|
get_sales_timeseries: async (ctx, args) => ctx.client.get(
|
|
2408
2416
|
"/api/v1/analytics/orders-timeseries",
|
|
2409
2417
|
{
|
|
@@ -2660,6 +2668,14 @@ var ORDER_DISPLAY_STATUSES = new Set(
|
|
|
2660
2668
|
);
|
|
2661
2669
|
var DISPLAY_STATUS = oneOf(ORDER_DISPLAY_STATUSES);
|
|
2662
2670
|
var RANGE = { from: S, to: S, timezone: S, groupBy: S };
|
|
2671
|
+
var LINE_RECURRING = {
|
|
2672
|
+
plan: S,
|
|
2673
|
+
interval: S,
|
|
2674
|
+
intervalUnit: S,
|
|
2675
|
+
intervalCount: S,
|
|
2676
|
+
totalPayments: S,
|
|
2677
|
+
trialDays: S
|
|
2678
|
+
};
|
|
2663
2679
|
var LINE_ITEM = {
|
|
2664
2680
|
id: S,
|
|
2665
2681
|
type: S,
|
|
@@ -2669,7 +2685,9 @@ var LINE_ITEM = {
|
|
|
2669
2685
|
discountAmount: S,
|
|
2670
2686
|
taxAmount: S,
|
|
2671
2687
|
total: S,
|
|
2672
|
-
|
|
2688
|
+
// amount = renewal price on a trial line (whose unitPrice is 0); count = the old display mirror.
|
|
2689
|
+
recurring: { ...LINE_RECURRING, amount: S, count: S },
|
|
2690
|
+
subscriptionId: S
|
|
2673
2691
|
};
|
|
2674
2692
|
var ORDER = {
|
|
2675
2693
|
id: S,
|
|
@@ -2693,6 +2711,7 @@ var ORDER = {
|
|
|
2693
2711
|
customerId: S,
|
|
2694
2712
|
customer: CUSTOMER_REF,
|
|
2695
2713
|
subscriptionId: S,
|
|
2714
|
+
subscriptionIds: [S],
|
|
2696
2715
|
shippingAddress: ADDRESS,
|
|
2697
2716
|
billingAddress: ADDRESS,
|
|
2698
2717
|
fulfillmentSummary: { itemsFulfilled: S, itemsRemaining: S, itemsTotal: S },
|
|
@@ -2815,7 +2834,8 @@ var QUOTE = {
|
|
|
2815
2834
|
taxAmount: S,
|
|
2816
2835
|
total: S,
|
|
2817
2836
|
optional: S,
|
|
2818
|
-
optionalSelected: S
|
|
2837
|
+
optionalSelected: S,
|
|
2838
|
+
recurring: LINE_RECURRING
|
|
2819
2839
|
}]
|
|
2820
2840
|
}],
|
|
2821
2841
|
// Who commented and when, never what they wrote.
|
|
@@ -2981,7 +3001,22 @@ var OAUTH_PROJECTIONS = {
|
|
|
2981
3001
|
trialDays: S,
|
|
2982
3002
|
currency: S,
|
|
2983
3003
|
firstChargeAmountMinor: S
|
|
2984
|
-
}
|
|
3004
|
+
},
|
|
3005
|
+
hasSubscriptions: S,
|
|
3006
|
+
// One entry per subscription line. No `name`: it is the line's name.
|
|
3007
|
+
subscriptions: [{
|
|
3008
|
+
lineItemId: S,
|
|
3009
|
+
amount: S,
|
|
3010
|
+
quantity: S,
|
|
3011
|
+
interval: S,
|
|
3012
|
+
intervalUnit: S,
|
|
3013
|
+
intervalCount: S,
|
|
3014
|
+
totalPayments: S,
|
|
3015
|
+
trialDays: S,
|
|
3016
|
+
trialEndsAt: S,
|
|
3017
|
+
planChargedToday: S,
|
|
3018
|
+
taxApplies: S
|
|
3019
|
+
}]
|
|
2985
3020
|
},
|
|
2986
3021
|
cart: section({
|
|
2987
3022
|
id: S,
|
|
@@ -3122,7 +3157,7 @@ var OAUTH_PROJECTIONS = {
|
|
|
3122
3157
|
};
|
|
3123
3158
|
|
|
3124
3159
|
// src/server.ts
|
|
3125
|
-
var VERSION = true ? "0.
|
|
3160
|
+
var VERSION = true ? "0.3.0" : "0.0.0-dev";
|
|
3126
3161
|
function registerableActions(policy) {
|
|
3127
3162
|
const isProduction = policy.identity.environment.providerEnvironment === "production";
|
|
3128
3163
|
return actionsForChannel("mcp").filter((action) => {
|