rightcard-mcp 0.1.17 → 0.1.20

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/engine.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // Mirrors MerchantYieldEngine (BASE-RATE mode only — offers live on the phone, never here).
2
- import { CATEGORY_DISPLAY, capCovers, categoryStoreTypes, isPermanentMerchantBenefit, multiplier, overrideIsActive, rotatingCap, standingCaps, storeTypes, } from "./model.js";
2
+ import { ALL_CATEGORIES, CATEGORY_DISPLAY, capCovers, categoryStoreTypes, isPermanentMerchantBenefit, multiplier, requiresApplePay, overrideIsActive, rotatingCap, standingCaps, storeTypes, } from "./model.js";
3
3
  import { merchantMatchesCoBrandBenefit, offerMatches } from "./matching.js";
4
4
  import { specFor } from "./configurable.js";
5
5
  import { basisLabel, cashOutCPP, centsPerPoint, earnUnitLabel, effectiveProgram, fmt1, fmtRate, valuesPointsAboveCash, withPooling, } from "./valuation.js";
@@ -56,13 +56,39 @@ function optionalityRank(card, v) {
56
56
  }
57
57
  const PREMIUM_NEEDLES = [
58
58
  "sapphire reserve", "sapphire preferred", "venture x", "platinum card",
59
- "gold card", "amex gold", "strata premier", "citi premier", "prestige",
59
+ "gold card", "amex gold", "strata premier", "strata elite", "citi premier", "prestige",
60
60
  "ritz-carlton", "aspire", "altitude reserve", "brilliant",
61
61
  ];
62
+ /** Mirrors MerchantYieldEngine.benefitCategoryFits (Nov 10 2026): a store
63
+ * benefit stored under a category other than "general" pays only on that
64
+ * category there (Costco Anywhere Visa's 5% on gas at Costco). */
65
+ /** Mirrors MerchantYieldEngine.sharesCategoryCap: a category-scoped store
66
+ * benefit shares that category's standing cap (Costco Visa 5% + 4% gas). */
67
+ function sharesCategoryCap(o, now) {
68
+ if (!o)
69
+ return true;
70
+ const key = o.category.trim().toLowerCase();
71
+ return isPermanentMerchantBenefit(o, now) && key !== "general" && ALL_CATEGORIES.includes(key);
72
+ }
73
+ function benefitCategoryFits(o, category) {
74
+ const key = o.category.trim().toLowerCase();
75
+ if (key === "general" || !ALL_CATEGORIES.includes(key))
76
+ return true;
77
+ return key === category;
78
+ }
62
79
  function premiumRank(card) {
63
80
  const n = card.displayName.toLowerCase();
64
81
  return PREMIUM_NEEDLES.some((x) => n.includes(x)) ? 1 : 0;
65
82
  }
83
+ /** Mirrors MerchantYieldEngine.premiumFeeOrder (Nov 10 2026): between two
84
+ * premium cards, the higher annual fee wins; an unverified fee counts lowest;
85
+ * null = this rule doesn't decide. */
86
+ function premiumFeeOrder(a, b) {
87
+ if (premiumRank(a) !== 1 || premiumRank(b) !== 1)
88
+ return null;
89
+ const fa = a.annualFee ?? -1, fb = b.annualFee ?? -1;
90
+ return fa === fb ? null : fa > fb;
91
+ }
66
92
  function tieNote(winner, runnerUp, value, v) {
67
93
  const rate = formatPercent(value);
68
94
  const other = shortName(runnerUp.displayName);
@@ -86,6 +112,9 @@ function tieNote(winner, runnerUp, value, v) {
86
112
  if (premiumRank(winner) > premiumRank(runnerUp)) {
87
113
  return `${other} also earns ${rate} here. We picked ${win} for its purchase protection.`;
88
114
  }
115
+ if (premiumFeeOrder(winner, runnerUp) === true) {
116
+ return `${other} also earns ${rate} here. We picked ${win} because its higher annual fee comes with more benefits.`;
117
+ }
89
118
  return `${other} also earns ${rate} here. Either one works.`;
90
119
  }
91
120
  const PORTAL_BONUSES = [
@@ -94,6 +123,8 @@ const PORTAL_BONUSES = [
94
123
  { needles: ["freedom flex", "freedom unlimited"], rate: 5, portal: "Chase Travel", premium: false },
95
124
  { needles: ["venture x"], rate: 10, portal: "Capital One Travel", premium: true },
96
125
  { needles: ["venture"], rate: 5, portal: "Capital One Travel", premium: false },
126
+ // Strata Elite: 12x hotels, cars, attractions on cititravel.com (mirrors Swift, Nov 11 2026).
127
+ { needles: ["strata elite"], rate: 12, portal: "Citi Travel", premium: true },
97
128
  { needles: ["strata premier", "citi premier"], rate: 10, portal: "Citi Travel", premium: true },
98
129
  { needles: ["platinum card", "amex platinum", "american express platinum"], rate: 5, portal: "Amex Travel", premium: true },
99
130
  ];
@@ -137,7 +168,7 @@ function appliedRate(card, category, subKey, merchantQuery, overrides, cardConfi
137
168
  if (!merchantQuery || merchantQuery === "")
138
169
  continue;
139
170
  matches = isPermanentMerchantBenefit(o, now)
140
- ? merchantMatchesCoBrandBenefit(o.merchant, merchantQuery)
171
+ ? merchantMatchesCoBrandBenefit(o.merchant, merchantQuery) && benefitCategoryFits(o, category)
141
172
  : offerMatches(o.merchant, merchantQuery, strict);
142
173
  }
143
174
  else if (storeTypes(o)) {
@@ -180,13 +211,14 @@ function appliedRate(card, category, subKey, merchantQuery, overrides, cardConfi
180
211
  winningOverride = null;
181
212
  }
182
213
  // A standing cap marked used up pays its "after" rate (mirrors the app).
183
- if (!winningOverride && usedUp.size > 0) {
214
+ if (sharesCategoryCap(winningOverride, now) && usedUp.size > 0) {
184
215
  for (const cap of standingCaps(card.id)) {
185
216
  if (usedUp.has(`${card.id}|std|${cap.id}`) && capCovers(cap, category, !!winningConfig)) {
186
217
  const after = cap.after ?? multiplier(card, "general", null);
187
218
  if (rate > after) {
188
219
  rate = after;
189
220
  winningConfig = null;
221
+ winningOverride = null;
190
222
  }
191
223
  }
192
224
  }
@@ -218,7 +250,7 @@ function bestBaseCard(cards, category, subKey, merchantQuery, overrides, cardCon
218
250
  // A card with NO spending limit on this rate beats one that stops paying it
219
251
  // after $X (mirrors MerchantYieldEngine.rateIsCapped, Oct 22 2026).
220
252
  const capped = (c) => {
221
- if (c.override) {
253
+ if (c.override && !sharesCategoryCap(c.override, now)) {
222
254
  return c.override.requiresActivation && !isPermanentMerchantBenefit(c.override, now) && rotatingCap(c.card.id) !== null;
223
255
  }
224
256
  const cap = standingCaps(c.card.id).find((x) => capCovers(x, category, !!c.configured));
@@ -237,6 +269,9 @@ function bestBaseCard(cards, category, subKey, merchantQuery, overrides, cardCon
237
269
  const pa = premiumRank(a.card), pb = premiumRank(b.card);
238
270
  if (pa !== pb)
239
271
  return pb - pa;
272
+ const fee = premiumFeeOrder(a.card, b.card);
273
+ if (fee !== null)
274
+ return fee ? -1 : 1;
240
275
  return a.card.displayName.localeCompare(b.card.displayName, "en", { sensitivity: "accent" });
241
276
  });
242
277
  const w = tied[0];
@@ -252,9 +287,12 @@ function rateContext(card, earn, valueCents, override, configured, v, category,
252
287
  const valueStr = formatPercent(valueCents);
253
288
  // "everyday purchases", not "general" — mirrors SpendCategory.inSentence
254
289
  // in the app (Oct 8 2026).
255
- const cat = category === "general" ? "everyday purchases" : CATEGORY_DISPLAY[category].toLowerCase();
290
+ // "online shopping" too: "Rate on online: 2%" read as a typo (Oct 31 2026).
291
+ const cat = category === "general" ? "everyday purchases"
292
+ : category === "online" ? "online shopping" : CATEGORY_DISPLAY[category].toLowerCase();
256
293
  const disp = CATEGORY_DISPLAY[category];
257
294
  let reason;
295
+ let applePayCaveat = null;
258
296
  const lines = [];
259
297
  const pointsAbove = valuesPointsAboveCash(v, card) && card.rewardCurrency !== null;
260
298
  if (configured) {
@@ -273,7 +311,15 @@ function rateContext(card, earn, valueCents, override, configured, v, category,
273
311
  // A store-type quarter reads like a merchant one: "at AMC Theatres".
274
312
  const scope = override.merchant ? `at ${override.merchant}`
275
313
  : (storeTypes(override) && storeName ? `at ${storeName}` : cat);
276
- if (isPermanentMerchantBenefit(override, now)) {
314
+ if (isPermanentMerchantBenefit(override, now) && override.merchant && requiresApplePay(override)) {
315
+ // Mirrors the Swift engine (Nov 10 2026): Apple Card's 3% at Uber pays
316
+ // only through Apple Pay, so the reason, the line and the caveat say so.
317
+ const plain = formatPercent(multiplier(card, category) * centsPerPoint(v, card));
318
+ reason = `${card.displayName} earns ${valueStr} ${scope} when you pay with Apple Pay, the most in your wallet here.`;
319
+ lines.push(`${valueStr} ${scope} with Apple Pay · card benefit`);
320
+ applePayCaveat = `Pay with Apple Pay to get ${valueStr}. Paid any other way, ${card.displayName} earns ${plain} here.`;
321
+ }
322
+ else if (isPermanentMerchantBenefit(override, now)) {
277
323
  reason = `${card.displayName} earns ${valueStr} ${scope}, the most in your wallet here.`;
278
324
  lines.push(`${valueStr} ${scope} · card benefit`);
279
325
  }
@@ -338,6 +384,7 @@ function rateContext(card, earn, valueCents, override, configured, v, category,
338
384
  cardId: card.id, cardName: card.displayName, rateDisplay: valueStr, valueCaption: caption, reason,
339
385
  breakdownLines: lines, loggableRate: valueCents, valueMath, valueMathShort,
340
386
  valuationBasis: basisLabel(v, card), valuationMode: v.mode, tieNote: null, portalNote: null, subcategoryBreakdown: [],
387
+ ...(applePayCaveat ? { caveat: applePayCaveat } : {}),
341
388
  };
342
389
  }
343
390
  function subcategoryBreakdown(cards, category, overrides, cardConfigs, v, now) {
@@ -436,7 +483,7 @@ export function recommend(input) {
436
483
  ? `After that: ${next.card.displayName}, ${formatPercent(next.valueCents)}.` : null;
437
484
  }
438
485
  // Standing category cap (mirrors MerchantYieldEngine.standingCapInfo).
439
- if (!o) {
486
+ if (sharesCategoryCap(o, now)) {
440
487
  const chosen = !!w.configured;
441
488
  const capRow = standingCaps(w.card.id).find((c) => capCovers(c, category, chosen));
442
489
  const afterEarn = capRow ? (capRow.after ?? multiplier(w.card, "general", null)) : 0;
package/dist/model.d.ts CHANGED
@@ -77,6 +77,9 @@ export declare function overrideFromRow(r: any): Override;
77
77
  * golden fixture is exported at noon UTC so parity is unaffected. */
78
78
  export declare function utcDay(now: Date): string;
79
79
  export declare function overrideIsActive(o: Override, now: Date): boolean;
80
+ /** SupabaseOverride.requiresApplePay: a store benefit that pays only through
81
+ * Apple Pay (Apple Card at Uber; Nov 10 2026). The label says so. */
82
+ export declare function requiresApplePay(o: Override): boolean;
80
83
  /** SupabaseOverride.isPermanentMerchantBenefit: merchant-scoped, no activation, ends > 2 years out. */
81
84
  export declare function isPermanentMerchantBenefit(o: Override, now: Date): boolean;
82
85
  export interface Merchant {
package/dist/model.js CHANGED
@@ -192,6 +192,11 @@ export function overrideIsActive(o, now) {
192
192
  const today = utcDay(now);
193
193
  return today >= o.startDate && today <= o.endDate;
194
194
  }
195
+ /** SupabaseOverride.requiresApplePay: a store benefit that pays only through
196
+ * Apple Pay (Apple Card at Uber; Nov 10 2026). The label says so. */
197
+ export function requiresApplePay(o) {
198
+ return /apple pay/i.test(o.label ?? "");
199
+ }
195
200
  /** SupabaseOverride.isPermanentMerchantBenefit: merchant-scoped, no activation, ends > 2 years out. */
196
201
  export function isPermanentMerchantBenefit(o, now) {
197
202
  if (!o.merchant || o.merchant === "" || o.requiresActivation)
@@ -229,6 +234,10 @@ export function exclusionCaveat(m) {
229
234
  // warehouse's Visa-only registers; their own MCC stays honest (no
230
235
  // "bonuses don't post" clause). Mirrors the Swift engine (Sep 2026).
231
236
  if (acceptedNetworksAtRegister(m) !== null) {
237
+ // At the pump, mirrors the Swift engine (Nov 10 2026).
238
+ if (m.category === "gas" || m.merchantType === "gas") {
239
+ return "Costco gas stations take Visa only. This is your best card that works at the pump.";
240
+ }
232
241
  return "Costco takes Visa only at the register. This is your best card that works in-store. Other networks work on Costco.com.";
233
242
  }
234
243
  return null;
package/dist/tools.js CHANGED
@@ -42,11 +42,12 @@ function shapeAnswer(r, merchant, mode, unverified) {
42
42
  const caveats = [];
43
43
  if (r.walletRefusedAtRegister && r.caveat)
44
44
  caveats.push(r.caveat);
45
- else if (merchant) {
46
- const cv = exclusionCaveat(merchant);
47
- if (cv)
48
- caveats.push(cv);
49
- }
45
+ else if (merchant && exclusionCaveat(merchant))
46
+ caveats.push(exclusionCaveat(merchant));
47
+ // The engine's own note (Apple Pay-only store benefits), as in the app:
48
+ // the directory's caveat first, else the engine's.
49
+ else if (r.caveat)
50
+ caveats.push(r.caveat);
50
51
  if (r.capLimit)
51
52
  caveats.push(r.capLimit + (r.afterLimit ? ` ${r.afterLimit}` : ""));
52
53
  if (r.tieNote)
@@ -1,6 +1,6 @@
1
1
  import type { CreditCard } from "./model.js";
2
2
  export type ValuationMode = "cash" | "smart";
3
- export type RewardProgram = "cash" | "amexMR" | "chaseUR" | "capOneMiles" | "citiTYP" | "wellsFargo" | "bilt" | "tdRewards" | "scenePlus" | "rbcAvion" | "bmoRewards" | "hyatt" | "marriott" | "ihg" | "choice" | "hilton" | "delta" | "united" | "american" | "southwest" | "jetBlue" | "alaska" | "avios" | "aeroplan" | "fixedValue" | "genericPoints" | "genericMiles";
3
+ export type RewardProgram = "cash" | "amexMR" | "chaseUR" | "capOneMiles" | "citiTYP" | "wellsFargo" | "bilt" | "tdRewards" | "scenePlus" | "rbcAvion" | "bmoRewards" | "hyatt" | "marriott" | "ihg" | "choice" | "wyndham" | "hilton" | "delta" | "united" | "american" | "southwest" | "jetBlue" | "alaska" | "avios" | "aeroplan" | "fixedValue" | "genericPoints" | "genericMiles";
4
4
  export declare const PROGRAM_DISPLAY: Record<RewardProgram, string>;
5
5
  export declare const TRAVEL_CPP: Record<RewardProgram, number>;
6
6
  /** RewardProgram.cashOutCPP */
package/dist/valuation.js CHANGED
@@ -2,7 +2,7 @@ export const PROGRAM_DISPLAY = {
2
2
  cash: "Cash back", amexMR: "Amex Membership Rewards", chaseUR: "Chase Ultimate Rewards",
3
3
  capOneMiles: "Capital One miles", citiTYP: "Citi ThankYou Points", wellsFargo: "Wells Fargo Rewards",
4
4
  bilt: "Bilt Rewards", tdRewards: "TD Rewards", scenePlus: "Scene+", rbcAvion: "RBC Avion points",
5
- bmoRewards: "BMO Rewards", hyatt: "World of Hyatt", marriott: "Marriott Bonvoy", ihg: "IHG One Rewards", choice: "Choice Privileges",
5
+ bmoRewards: "BMO Rewards", hyatt: "World of Hyatt", marriott: "Marriott Bonvoy", ihg: "IHG One Rewards", choice: "Choice Privileges", wyndham: "Wyndham Rewards",
6
6
  hilton: "Hilton Honors", delta: "Delta SkyMiles", united: "United MileagePlus",
7
7
  american: "American AAdvantage", southwest: "Southwest Rapid Rewards", jetBlue: "JetBlue TrueBlue",
8
8
  alaska: "Atmos Rewards", avios: "British Airways Avios", aeroplan: "Air Canada Aeroplan",
@@ -13,7 +13,7 @@ export const TRAVEL_CPP = {
13
13
  // down, never above (mirrors Swift RewardProgram.travelCPP).
14
14
  cash: 1.0, amexMR: 1.8, chaseUR: 1.8, capOneMiles: 1.7, citiTYP: 1.6, wellsFargo: 1.5, bilt: 1.8,
15
15
  tdRewards: 0.5, scenePlus: 1.0, rbcAvion: 1.8, bmoRewards: 0.6, // Oct 2026 CA medians (the MCP serves US cards only)
16
- hyatt: 1.4, marriott: 0.7, ihg: 0.5, choice: 0.6, hilton: 0.4,
16
+ hyatt: 1.4, marriott: 0.7, ihg: 0.5, choice: 0.6, wyndham: 0.5, hilton: 0.4, // wyndham: Nov 11 2026 median 0.585
17
17
  delta: 1.1, united: 1.2, american: 1.4, southwest: 1.2, jetBlue: 1.3, alaska: 1.4, avios: 1.2, aeroplan: 1.3,
18
18
  fixedValue: 1.0, genericPoints: 2.0, genericMiles: 1.5,
19
19
  };
@@ -49,6 +49,10 @@ export function inferProgram(issuer, id, currency) {
49
49
  // which valued these hotel points at 1.5¢ (mirrors Swift, Sep 24 2026).
50
50
  if (has("choice"))
51
51
  return "choice";
52
+ // Wyndham Rewards (Barclays): no needle matched, so it fell to the generic
53
+ // 2¢ and the Earner Plus 4x read "8%" (mirrors Swift, Nov 11 2026).
54
+ if (has("wyndham"))
55
+ return "wyndham";
52
56
  if (has("delta", "skymiles"))
53
57
  return "delta";
54
58
  if (has("united", "mileageplus"))
@@ -131,7 +135,9 @@ export function pooledPrograms(wallet) {
131
135
  const isTYPUnlock = (c) => {
132
136
  const s = hay(c);
133
137
  const citi = s.includes("citi") || s.includes("thankyou") || s.includes("strata");
134
- return citi && (s.includes("premier") || s.includes("prestige"));
138
+ // Strata Elite transfers ThankYou points too (mirrors Swift, Nov 11 2026).
139
+ return citi && (s.includes("premier") || s.includes("prestige")
140
+ || s.includes("strata elite") || s.includes("strata_elite"));
135
141
  };
136
142
  if (wallet.some(isTYPUnlock)) {
137
143
  for (const c of wallet) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rightcard-mcp",
3
- "version": "0.1.17",
3
+ "version": "0.1.20",
4
4
  "mcpName": "ai.rightcard/mcp",
5
5
  "description": "RightCard MCP — the card-selection oracle for agents. Which of your credit cards to use at any store, from verified data. No bank login.",
6
6
  "type": "module",