rightcard-mcp 0.1.8 → 0.1.10

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.
@@ -23,6 +23,15 @@ export const CONFIGURABLE_SPECS = [
23
23
  note: "5% on your top eligible category, up to $500 each billing cycle (1% after). Citi applies it to your highest-spend category automatically. Set the one you expect so RightCard recommends it.",
24
24
  matchNeedles: ["customcash"], multiCardMax: 3,
25
25
  },
26
+ {
27
+ // Citi Strata: 3x on ONE Self-Select category (streaming by default; also
28
+ // fitness clubs, live entertainment, cosmetic stores/salons, pet supply).
29
+ // Only streaming is a category here; the app also takes the store picks.
30
+ key: "citi_strata", displayName: "Citi Strata Card", bonusRate: 3, slots: 1,
31
+ eligible: ["streaming"],
32
+ note: "3x on the one category you picked at citi.com. Citi starts every card on streaming, and you can change it once a quarter. For gyms, salons, pet stores and live events, RightCard counts the big chains it knows. Other stores show 1x.",
33
+ matchNeedles: ["citirewardsplus", "citistratacard"], multiCardMax: 1,
34
+ },
26
35
  {
27
36
  key: "bofa_customized_cash", displayName: "Bank of America Customized Cash Rewards", bonusRate: 3, slots: 1,
28
37
  eligible: ["gas", "online", "dining", "travel", "drugstore"],
package/dist/engine.d.ts CHANGED
@@ -22,6 +22,9 @@ export interface Recommendation {
22
22
  subcategoryBreakdown: SubcategoryBest[];
23
23
  /** set by the caller from the directory (exclusionCaveat) */
24
24
  caveat?: string | null;
25
+ /** The winning rotating quarter's limit and who wins after it (app: CapInfo). */
26
+ capLimit?: string | null;
27
+ afterLimit?: string | null;
25
28
  }
26
29
  export interface RecommendInput {
27
30
  cards: CreditCard[];
@@ -35,7 +38,11 @@ export interface RecommendInput {
35
38
  strictMerchantMatch?: boolean;
36
39
  /** Register network lock (Costco = visa-only). null/undefined = no restriction. */
37
40
  acceptedNetworks?: Set<string> | null;
41
+ /** The directory row's merchant_type, so a store-type quarter can apply. */
42
+ merchantType?: string | null;
38
43
  }
44
+ /** Where the quarter is turned on. Mirrors MerchantYieldEngine.activationApp. */
45
+ export declare function activationApp(issuer: string): string;
39
46
  export declare function formatPercent(v: number): string;
40
47
  export declare function formatMultiplier(v: number): string;
41
48
  /** MerchantYieldEngine.recommend — base-rate mode (offers: []) */
package/dist/engine.js CHANGED
@@ -1,8 +1,12 @@
1
1
  // Mirrors MerchantYieldEngine (BASE-RATE mode only — offers live on the phone, never here).
2
- import { CATEGORY_DISPLAY, isPermanentMerchantBenefit, multiplier, overrideIsActive, } from "./model.js";
2
+ import { CATEGORY_DISPLAY, capCovers, isPermanentMerchantBenefit, multiplier, 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, valuesPointsAboveCash, withPooling, } from "./valuation.js";
6
+ /** Where the quarter is turned on. Mirrors MerchantYieldEngine.activationApp. */
7
+ export function activationApp(issuer) {
8
+ return issuer.toLowerCase().includes("discover") ? "Capital One or Discover" : issuer;
9
+ }
6
10
  // ── formatting (Swift twins) ──
7
11
  export function formatPercent(v) {
8
12
  return v === Math.round(v) ? `${Math.round(v)}%` : `${fmt1(v)}%`;
@@ -98,7 +102,8 @@ function portalNote(cards, recommended) {
98
102
  return null;
99
103
  return `Booking through ${best.pb.portal}? ${shortName(best.card.displayName)} earns up to ${formatMultiplier(best.pb.rate)} there.`;
100
104
  }
101
- function appliedRate(card, category, subKey, merchantQuery, overrides, cardConfigs, now, strict) {
105
+ const NO_CAPS = new Set();
106
+ function appliedRate(card, category, subKey, merchantQuery, overrides, cardConfigs, now, strict, merchantType = null, usedUp = NO_CAPS) {
102
107
  let rate = multiplier(card, category, subKey);
103
108
  let winningOverride = null;
104
109
  let winningConfig = null;
@@ -113,6 +118,13 @@ function appliedRate(card, category, subKey, merchantQuery, overrides, cardConfi
113
118
  ? merchantMatchesCoBrandBenefit(o.merchant, merchantQuery)
114
119
  : offerMatches(o.merchant, merchantQuery, strict);
115
120
  }
121
+ else if (storeTypes(o)) {
122
+ // A store-type quarter (Discover's entertainment): only a store the
123
+ // directory files under one of its types.
124
+ if (!merchantType || !storeTypes(o).includes(merchantType.toLowerCase()))
125
+ continue;
126
+ matches = true;
127
+ }
116
128
  else {
117
129
  matches = o.category.trim().toLowerCase() === category;
118
130
  }
@@ -128,11 +140,23 @@ function appliedRate(card, category, subKey, merchantQuery, overrides, cardConfi
128
140
  winningConfig = spec;
129
141
  winningOverride = null;
130
142
  }
143
+ // A standing cap marked used up pays its "after" rate (mirrors the app).
144
+ if (!winningOverride && usedUp.size > 0) {
145
+ for (const cap of standingCaps(card.id)) {
146
+ if (usedUp.has(`${card.id}|std|${cap.id}`) && capCovers(cap, category, !!winningConfig)) {
147
+ const after = cap.after ?? multiplier(card, "general", null);
148
+ if (rate > after) {
149
+ rate = after;
150
+ winningConfig = null;
151
+ }
152
+ }
153
+ }
154
+ }
131
155
  return { rate, override: winningOverride, configured: winningConfig };
132
156
  }
133
- function bestBaseCard(cards, category, subKey, merchantQuery, overrides, cardConfigs, v, now, strict) {
157
+ function bestBaseCard(cards, category, subKey, merchantQuery, overrides, cardConfigs, v, now, strict, merchantType = null, usedUp = NO_CAPS) {
134
158
  const candidates = cards.map((card) => {
135
- const a = appliedRate(card, category, subKey, merchantQuery, overrides, cardConfigs, now, strict);
159
+ const a = appliedRate(card, category, subKey, merchantQuery, overrides, cardConfigs, now, strict, merchantType, usedUp);
136
160
  return { card, earn: a.rate, value: a.rate * centsPerPoint(v, card), override: a.override, configured: a.configured };
137
161
  });
138
162
  if (candidates.length === 0)
@@ -153,7 +177,7 @@ function bestBaseCard(cards, category, subKey, merchantQuery, overrides, cardCon
153
177
  const note = tied.length >= 2 ? tieNote(w.card, tied[1].card, w.value, v) : null;
154
178
  return { card: w.card, earn: w.earn, valueCents: w.value, override: w.override, configured: w.configured, tieNote: note };
155
179
  }
156
- function rateContext(card, earn, valueCents, override, configured, v, category, now, chosenCategoryCount) {
180
+ function rateContext(card, earn, valueCents, override, configured, v, category, now, chosenCategoryCount, storeName = null) {
157
181
  const valueStr = formatPercent(valueCents);
158
182
  // "everyday purchases", not "general" — mirrors SpendCategory.inSentence
159
183
  // in the app (Oct 8 2026).
@@ -175,7 +199,9 @@ function rateContext(card, earn, valueCents, override, configured, v, category,
175
199
  lines.push(configured.note);
176
200
  }
177
201
  else if (override) {
178
- const scope = override.merchant ? `at ${override.merchant}` : cat;
202
+ // A store-type quarter reads like a merchant one: "at AMC Theatres".
203
+ const scope = override.merchant ? `at ${override.merchant}`
204
+ : (storeTypes(override) && storeName ? `at ${storeName}` : cat);
179
205
  if (isPermanentMerchantBenefit(override, now)) {
180
206
  reason = `${card.displayName} earns ${valueStr} ${scope}, the most in your wallet here.`;
181
207
  lines.push(`${valueStr} ${scope} · card benefit`);
@@ -188,10 +214,19 @@ function rateContext(card, earn, valueCents, override, configured, v, category,
188
214
  if (pointsAbove) {
189
215
  lines.push(`${formatMultiplier(override.bonusRate)} ${earnUnitLabel(v, card)} × ${fmt1(centsPerPoint(v, card))}¢ → ${valueStr} per $1`);
190
216
  }
217
+ // Discover's utilities quarter counts bills paid online or by phone only.
218
+ const types = storeTypes(override);
219
+ if (types && (types.includes("utility") || types.includes("telecom"))) {
220
+ // The app shows this in the note box under the answer, not in the reason.
221
+ lines.push("It counts bills paid online or by phone, not payments made in person.");
222
+ }
191
223
  if (override.requiresActivation) {
192
- const issuer = card.issuer ?? "issuer";
193
- reason += ` Activate it in your ${issuer} app to earn the bonus.`;
194
- lines.push(`⚠︎ Activate this quarter in your ${issuer} app`);
224
+ // Mirrors the Swift engine (Oct 9 2026 wording pass): no issuer on the
225
+ // card → "your bank's app", never the jargon "issuer". Discover accounts
226
+ // are moving to Capital One, so both apps are named (activationApp).
227
+ const owner = card.issuer != null ? activationApp(card.issuer) : "bank's";
228
+ reason += ` Activate it in your ${owner} app to earn the bonus.`;
229
+ lines.push(`⚠︎ Activate this quarter in your ${owner} app`);
195
230
  }
196
231
  }
197
232
  else if (pointsAbove) {
@@ -276,11 +311,51 @@ export function recommend(input) {
276
311
  const subKey = input.subKey ?? null;
277
312
  const merchantName = input.merchantName && input.merchantName.trim() !== "" ? input.merchantName : null;
278
313
  const query = merchantName ? merchantName.toLowerCase() : null;
279
- const w = bestBaseCard(cards, category, subKey, query, overrides, cardConfigs, v, now, strict);
314
+ const w = bestBaseCard(cards, category, subKey, query, overrides, cardConfigs, v, now, strict, merchantName ? (input.merchantType ?? null) : null);
280
315
  if (!w)
281
316
  return null;
282
- const ctx = rateContext(w.card, w.earn, w.valueCents, w.override, w.configured, v, category, now, cardConfigs[w.card.id]?.size ?? 0);
317
+ const ctx = rateContext(w.card, w.earn, w.valueCents, w.override, w.configured, v, category, now, cardConfigs[w.card.id]?.size ?? 0, merchantName);
283
318
  ctx.tieNote = w.tieNote;
319
+ // Rotating limit (mirrors MerchantYieldEngine.capInfo): re-answer without
320
+ // this card's capped quarter rows to name who wins after the limit.
321
+ const o = w.override;
322
+ const cap = rotatingCap(w.card.id);
323
+ if (o && cap && o.requiresActivation && !isPermanentMerchantBenefit(o, now)) {
324
+ const mt = merchantName ? (input.merchantType ?? null) : null;
325
+ const counts = (x) => x.cardId === w.card.id && x.requiresActivation && !isPermanentMerchantBenefit(x, now);
326
+ const without = overrides.filter((x) => !counts(x));
327
+ const own = appliedRate(w.card, category, subKey, query, without, cardConfigs, now, strict, mt).rate * centsPerPoint(v, w.card);
328
+ const next = bestBaseCard(cards, category, subKey, query, without, cardConfigs, v, now, strict, mt);
329
+ const amount = cap.amount.toLocaleString("en-US");
330
+ ctx.capLimit = cap.kind === "spendPerQuarter"
331
+ ? `${formatPercent(w.valueCents)} on your first $${amount} this quarter, then ${formatPercent(own)}.`
332
+ : `${formatPercent(w.valueCents)} until you've earned $${amount} back this year, then ${formatPercent(own)}.`;
333
+ ctx.afterLimit = next && next.card.id !== w.card.id
334
+ ? `After that: ${next.card.displayName}, ${formatPercent(next.valueCents)}.` : null;
335
+ }
336
+ // Standing category cap (mirrors MerchantYieldEngine.standingCapInfo).
337
+ if (!o) {
338
+ const chosen = !!w.configured;
339
+ const capRow = standingCaps(w.card.id).find((c) => capCovers(c, category, chosen));
340
+ const afterEarn = capRow ? (capRow.after ?? multiplier(w.card, "general", null)) : 0;
341
+ if (capRow && afterEarn < w.earn - 0.0001) {
342
+ const mt = merchantName ? (input.merchantType ?? null) : null;
343
+ const rate = formatPercent(w.valueCents);
344
+ const then = formatPercent(afterEarn * centsPerPoint(v, w.card));
345
+ const spend = capRow.limit.toLocaleString("en-US");
346
+ const names = [...capRow.categories].sort().map((c) => CATEGORY_DISPLAY[c].toLowerCase());
347
+ if (capRow.chosen && capRow.categories.length > 0)
348
+ names.unshift("your chosen category");
349
+ const list = names.length > 1 ? new Intl.ListFormat("en", { type: "conjunction" }).format(names) : null;
350
+ const per = capRow.period === "quarter" ? "each quarter" : capRow.period === "billingCycle" ? "each billing cycle" : "a year";
351
+ ctx.capLimit = list
352
+ ? `${rate} on your first $${spend} ${per} across ${list}, then ${then}.`
353
+ : `${rate} on your first $${spend} ${per}, then ${then}.`;
354
+ const next = bestBaseCard(cards, category, subKey, query, overrides, cardConfigs, v, now, strict, mt, new Set([`${w.card.id}|std|${capRow.id}`]));
355
+ ctx.afterLimit = next && next.card.id !== w.card.id
356
+ ? `After that: ${next.card.displayName}, ${formatPercent(next.valueCents)}.` : null;
357
+ }
358
+ }
284
359
  if (category === "travel")
285
360
  ctx.portalNote = portalNote(cards, w.card);
286
361
  if (input.merchantName == null && input.subKey == null) {
package/dist/matching.js CHANGED
@@ -17,14 +17,20 @@ const COBRAND_GENERIC = new Set(["incorporated", "corporation", "company"]);
17
17
  const TLD_RE = /\.(com|net|org|co|io|tv|shop|store|us)\b/g;
18
18
  const isAlnum = (ch) => /[\p{L}\p{N}]/u.test(ch);
19
19
  const cache = new Map();
20
+ /** Product line in front of the brand: "Polo Ralph Lauren" is Ralph Lauren.
21
+ * Mirrors MerchantYieldEngine.brandLineNames. */
22
+ const BRAND_LINE_NAMES = [["polo ralph lauren", "ralph lauren"]];
20
23
  function forms(s) {
21
24
  const hit = cache.get(s);
22
25
  if (hit)
23
26
  return hit;
24
- const lowered = s.toLowerCase()
27
+ let lowered = s.toLowerCase()
25
28
  .replace(/&/g, " and ")
26
29
  .replace(/(?<=[\p{L}\p{N}])\+(?=[\p{L}\p{N}])/gu, " and ")
27
30
  .replace(/(?<=\s)\+(?=\s)/g, " and ");
31
+ for (const [line, brand] of BRAND_LINE_NAMES)
32
+ if (lowered.includes(line))
33
+ lowered = lowered.split(line).join(brand);
28
34
  const stripped = lowered.replace(TLD_RE, " ");
29
35
  const parts = stripped.split(/[^\p{L}\p{N}]+/u).filter((p) => p.length > 0);
30
36
  const out = {
@@ -48,9 +54,9 @@ export function merchantMatches(offerMerchant, query) {
48
54
  const os = new Set(o), qs = new Set(q);
49
55
  if (eq(os, qs))
50
56
  return true;
51
- if (isStrictSubset(os, qs) && (isSubset(minus(qs, os), GENERIC_PLACE) || arrEq(q.slice(0, o.length), o)))
57
+ if (isStrictSubset(os, qs) && (isGenericRemainder(minus(qs, os)) || arrEq(q.slice(0, o.length), o)))
52
58
  return true;
53
- if (isStrictSubset(qs, os) && isSubset(minus(os, qs), GENERIC_PLACE))
59
+ if (isStrictSubset(qs, os) && isGenericRemainder(minus(os, qs)))
54
60
  return true;
55
61
  }
56
62
  const cm = forms(offerMerchant).compact, cq = forms(query).compact;
@@ -62,7 +68,21 @@ export function merchantMatches(offerMerchant, query) {
62
68
  if (!long.startsWith(short))
63
69
  return false;
64
70
  const rest = long.slice(short.length);
65
- return GENERIC_PLACE.has(rest) || MERCHANT_STOPWORDS.has(rest);
71
+ return GENERIC_PLACE.has(rest) || MERCHANT_STOPWORDS.has(rest) || OUTLET_SUFFIXES.has(rest);
72
+ }
73
+ /** "Factory Outlet" / "Factory Store" after a brand is that brand's outlet
74
+ * ("Express Factory Outlet" is Express); "factory" alone is not (J.Crew
75
+ * Factory is its own brand). Mirrors MerchantYieldEngine.isGenericRemainder. */
76
+ const OUTLET_SUFFIXES = new Set(["factoryoutlet", "factorystore", "factorystores", "factoryhouse"]);
77
+ function isGenericRemainder(rest) {
78
+ if (isSubset(rest, GENERIC_PLACE))
79
+ return true;
80
+ if (!rest.has("factory") || !["outlet", "store", "stores", "house"].some((w) => rest.has(w)))
81
+ return false;
82
+ const r = new Set(rest);
83
+ r.delete("factory");
84
+ r.delete("house");
85
+ return isSubset(r, GENERIC_PLACE);
66
86
  }
67
87
  const arrEq = (a, b) => a.length === b.length && a.every((x, i) => x === b[i]);
68
88
  /** MerchantYieldEngine.merchantMatchesStrict(offer:place:) */
@@ -72,7 +92,7 @@ export function merchantMatchesStrict(offerMerchant, place) {
72
92
  return false;
73
93
  if (eq(o, p))
74
94
  return true;
75
- if (isSubset(o, p) && isSubset(minus(p, o), GENERIC_PLACE))
95
+ if (isSubset(o, p) && isGenericRemainder(minus(p, o)))
76
96
  return true;
77
97
  return forms(offerMerchant).compact === forms(place).compact;
78
98
  }
package/dist/model.d.ts CHANGED
@@ -35,6 +35,34 @@ export interface Override {
35
35
  label: string | null;
36
36
  merchant: string | null;
37
37
  }
38
+ /** Quarter categories that are not spend categories, mapped to the directory
39
+ * merchant_type values they cover (Discover Q4 2026 entertainment/utilities).
40
+ * Mirrors SupabaseOverride.storeTypeCategories in the app. */
41
+ export declare const STORE_TYPE_CATEGORIES: Record<string, string[]>;
42
+ /** The store types a row applies to, or null for a category/merchant row. */
43
+ export declare function storeTypes(o: Override): string[] | null;
44
+ /** A card's rotating limit (mirrors RotatingCap in the app): Chase and Discover
45
+ * $1,500 of combined spend a quarter; Citi Dividend $300 back a year. */
46
+ export type RotatingCap = {
47
+ kind: "spendPerQuarter" | "cashBackPerYear";
48
+ amount: number;
49
+ };
50
+ export declare function rotatingCap(cardId: string): RotatingCap | null;
51
+ /** A STANDING category cap (mirrors StandingCap in the app, Oct 14 2026):
52
+ * the bonus stops after a spend amount and comes back next period. Quoted
53
+ * from each issuer page; see the Swift table for the quotes. */
54
+ export type CapPeriod = "quarter" | "calendarYear" | "cardYear" | "billingCycle";
55
+ export type StandingCap = {
56
+ id: string;
57
+ categories: SpendCategory[];
58
+ everything?: boolean;
59
+ chosen?: boolean;
60
+ limit: number;
61
+ period: CapPeriod;
62
+ after?: number;
63
+ };
64
+ export declare function standingCaps(cardId: string): StandingCap[];
65
+ export declare function capCovers(cap: StandingCap, category: SpendCategory, chosen: boolean): boolean;
38
66
  export declare function overrideFromRow(r: any): Override;
39
67
  /** Compare yyyy-MM-dd strings as UTC days.
40
68
  *
package/dist/model.js CHANGED
@@ -79,6 +79,82 @@ export function multiplier(card, category, subKey) {
79
79
  export function hasAnyReward(card) {
80
80
  return Object.values(card.multipliers).some((f) => typeof f === "number" ? f > 1.0 : f.default > 1.0 || Object.values(f.values).some((v) => v > 1.0));
81
81
  }
82
+ /** Quarter categories that are not spend categories, mapped to the directory
83
+ * merchant_type values they cover (Discover Q4 2026 entertainment/utilities).
84
+ * Mirrors SupabaseOverride.storeTypeCategories in the app. */
85
+ export const STORE_TYPE_CATEGORIES = {
86
+ entertainment: ["entertainment"],
87
+ utilities: ["telecom", "utility"],
88
+ };
89
+ /** The store types a row applies to, or null for a category/merchant row. */
90
+ export function storeTypes(o) {
91
+ if (o.merchant && o.merchant !== "")
92
+ return null;
93
+ return STORE_TYPE_CATEGORIES[o.category.trim().toLowerCase()] ?? null;
94
+ }
95
+ export function rotatingCap(cardId) {
96
+ switch (cardId.toLowerCase()) {
97
+ case "chase_freedom":
98
+ case "chase_freedom_flex":
99
+ case "discover_it":
100
+ case "discover_discover_it_student_cash_back":
101
+ case "discover_nhl_credit_card":
102
+ return { kind: "spendPerQuarter", amount: 1500 };
103
+ case "citi_dividend":
104
+ return { kind: "cashBackPerYear", amount: 300 };
105
+ default:
106
+ return null;
107
+ }
108
+ }
109
+ export function standingCaps(cardId) {
110
+ switch (cardId.toLowerCase()) {
111
+ case "amex_gold":
112
+ return [{ id: "dining", categories: ["dining"], limit: 50000, period: "calendarYear", after: 1 },
113
+ { id: "grocery", categories: ["grocery"], limit: 25000, period: "calendarYear", after: 1 }];
114
+ case "amex_blue_cash_everyday":
115
+ return [{ id: "grocery", categories: ["grocery"], limit: 6000, period: "calendarYear", after: 1 },
116
+ { id: "online", categories: ["online"], limit: 6000, period: "calendarYear", after: 1 },
117
+ { id: "gas", categories: ["gas"], limit: 6000, period: "calendarYear", after: 1 }];
118
+ case "amex_blue_cash_preferred":
119
+ return [{ id: "grocery", categories: ["grocery"], limit: 6000, period: "calendarYear", after: 1 }];
120
+ case "american_express_blue_business_cash_card_from_american_express":
121
+ return [{ id: "all", categories: [], everything: true, limit: 50000, period: "calendarYear", after: 1 }];
122
+ case "sams_club_mastercard":
123
+ return [{ id: "gas", categories: ["gas"], limit: 6000, period: "calendarYear", after: 1 }];
124
+ case "citi_costco_anywhere":
125
+ return [{ id: "gas", categories: ["gas"], limit: 7000, period: "calendarYear", after: 1 }];
126
+ case "marriott_boundless":
127
+ return [{ id: "combined", categories: ["grocery", "gas", "dining"], limit: 6000, period: "cardYear", after: 2 }];
128
+ case "southwest_plus":
129
+ return [{ id: "combined", categories: ["gas", "grocery"], limit: 5000, period: "cardYear", after: 1 }];
130
+ case "chase_southwest_premier":
131
+ return [{ id: "combined", categories: ["grocery", "dining"], limit: 8000, period: "cardYear", after: 1 }];
132
+ case "chase_ink_business_preferred_credit_card":
133
+ return [{ id: "combined", categories: ["travel", "transit"], limit: 150000, period: "cardYear", after: 1 }];
134
+ case "chase_ink_business_cash_credit_card":
135
+ return [{ id: "combined", categories: ["gas", "dining"], limit: 25000, period: "cardYear", after: 1 }];
136
+ case "discover_discover_it_chrome":
137
+ case "discover_discover_it_student_chrome":
138
+ return [{ id: "combined", categories: ["gas", "dining"], limit: 1000, period: "quarter", after: 1 }];
139
+ case "u_s_bank_altitude_go_visa_signature_credit_card":
140
+ case "u_s_bank_altitude_go_secured_visa_credit_card":
141
+ return [{ id: "dining", categories: ["dining"], limit: 2000, period: "quarter", after: 1 }];
142
+ case "u_s_bank_altitude_connect_visa_signature_credit_card":
143
+ case "usbank_altitude_connect":
144
+ return [{ id: "gas", categories: ["gas"], limit: 1000, period: "quarter", after: 1 }];
145
+ case "bofa_customized_cash":
146
+ return [{ id: "combined", categories: ["grocery"], chosen: true, limit: 2500, period: "quarter", after: 1 }];
147
+ case "bank_of_america_bank_of_america_business_advantage_customized_cash_rewards":
148
+ return [{ id: "combined", categories: ["dining"], chosen: true, limit: 50000, period: "calendarYear", after: 1 }];
149
+ case "citi_custom_cash":
150
+ return [{ id: "chosen", categories: [], chosen: true, limit: 500, period: "billingCycle", after: 1 }];
151
+ default:
152
+ return [];
153
+ }
154
+ }
155
+ export function capCovers(cap, category, chosen) {
156
+ return !!cap.everything || cap.categories.includes(category) || (!!cap.chosen && chosen);
157
+ }
82
158
  export function overrideFromRow(r) {
83
159
  return {
84
160
  id: String(r.id), cardId: r.card_id, category: r.category, bonusRate: Number(r.bonus_rate),
package/dist/tools.js CHANGED
@@ -45,6 +45,8 @@ function shapeAnswer(r, merchant, mode, unverified) {
45
45
  if (cv)
46
46
  caveats.push(cv);
47
47
  }
48
+ if (r.capLimit)
49
+ caveats.push(r.capLimit + (r.afterLimit ? ` ${r.afterLimit}` : ""));
48
50
  if (r.tieNote)
49
51
  caveats.push(r.tieNote);
50
52
  if (r.portalNote)
@@ -97,7 +99,8 @@ export function buildServer(getCatalog) {
97
99
  const now = on ? new Date(on + "T00:00:00Z") : new Date();
98
100
  const r = recommend({ cards, category: cat, subKey, merchantName: merchant ?? null, overrides: catalog.overrides,
99
101
  valuation: makeValuation(mode), cardConfigs: configs, now,
100
- acceptedNetworks: dir ? acceptedNetworksAtRegister(dir) : null });
102
+ acceptedNetworks: dir ? acceptedNetworksAtRegister(dir) : null,
103
+ merchantType: dir?.merchantType ?? null });
101
104
  if (!r)
102
105
  return err("No recommendation could be computed.");
103
106
  const answer = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rightcard-mcp",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
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",