@markcolabs/mcp 0.2.0 → 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/LICENSE +21 -0
- package/LICENSE-API.md +111 -0
- package/README.md +128 -205
- package/dist/engines/data/irs2026.d.ts +110 -3
- package/dist/engines/data/irs2026.d.ts.map +1 -1
- package/dist/engines/data/irs2026.js +86 -3
- package/dist/engines/data/irs2026.js.map +1 -1
- package/dist/engines/data/rmd2026.d.ts +59 -0
- package/dist/engines/data/rmd2026.d.ts.map +1 -0
- package/dist/engines/data/rmd2026.js +75 -0
- package/dist/engines/data/rmd2026.js.map +1 -0
- package/dist/engines/data/stateTax2026.d.ts +114 -0
- package/dist/engines/data/stateTax2026.d.ts.map +1 -0
- package/dist/engines/data/stateTax2026.js +348 -0
- package/dist/engines/data/stateTax2026.js.map +1 -0
- package/dist/engines/hsa.d.ts +110 -0
- package/dist/engines/hsa.d.ts.map +1 -0
- package/dist/engines/hsa.js +83 -0
- package/dist/engines/hsa.js.map +1 -0
- package/dist/engines/ira.d.ts +115 -0
- package/dist/engines/ira.d.ts.map +1 -0
- package/dist/engines/ira.js +127 -0
- package/dist/engines/ira.js.map +1 -0
- package/dist/engines/paycheck.d.ts +51 -16
- package/dist/engines/paycheck.d.ts.map +1 -1
- package/dist/engines/paycheck.js +53 -24
- package/dist/engines/paycheck.js.map +1 -1
- package/dist/engines/rmd.d.ts +107 -0
- package/dist/engines/rmd.d.ts.map +1 -0
- package/dist/engines/rmd.js +109 -0
- package/dist/engines/rmd.js.map +1 -0
- package/dist/engines/rothConversion.d.ts +124 -0
- package/dist/engines/rothConversion.d.ts.map +1 -0
- package/dist/engines/rothConversion.js +145 -0
- package/dist/engines/rothConversion.js.map +1 -0
- package/dist/index.d.ts +16 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +104 -6
- package/dist/index.js.map +1 -1
- package/dist/shared/bounds.d.ts +50 -0
- package/dist/shared/bounds.d.ts.map +1 -1
- package/dist/shared/bounds.js +85 -0
- package/dist/shared/bounds.js.map +1 -1
- package/dist/tools/hsa.d.ts +58 -0
- package/dist/tools/hsa.d.ts.map +1 -0
- package/dist/tools/hsa.js +129 -0
- package/dist/tools/hsa.js.map +1 -0
- package/dist/tools/ira.d.ts +55 -0
- package/dist/tools/ira.d.ts.map +1 -0
- package/dist/tools/ira.js +117 -0
- package/dist/tools/ira.js.map +1 -0
- package/dist/tools/paycheck.d.ts +14 -7
- package/dist/tools/paycheck.d.ts.map +1 -1
- package/dist/tools/paycheck.js +24 -11
- package/dist/tools/paycheck.js.map +1 -1
- package/dist/tools/rmd.d.ts +60 -0
- package/dist/tools/rmd.d.ts.map +1 -0
- package/dist/tools/rmd.js +130 -0
- package/dist/tools/rmd.js.map +1 -0
- package/dist/tools/rothConversion.d.ts +66 -0
- package/dist/tools/rothConversion.d.ts.map +1 -0
- package/dist/tools/rothConversion.js +141 -0
- package/dist/tools/rothConversion.js.map +1 -0
- package/package.json +18 -4
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RMD (Required Minimum Distribution) engine — lifted from
|
|
3
|
+
* site/src/utils/rmd-engine.js (functions `calculateRMD`,
|
|
4
|
+
* `getDistributionPeriod`, `getRMDStartAge`).
|
|
5
|
+
*
|
|
6
|
+
* Per ADR-0039 § 5: pure synchronous function, ENGINE_VERSION constant,
|
|
7
|
+
* parity test against the site source as the gate.
|
|
8
|
+
*
|
|
9
|
+
* Scope (S141 Wave 1B Item #3): SINGLE-YEAR RMD distribution-amount
|
|
10
|
+
* calculation only. The site calculator's multi-year projection
|
|
11
|
+
* (`generateRMDProjection`) and pre-RMD age-projection path are OUT of
|
|
12
|
+
* scope for v1 — callers needing year-by-year projections should call the
|
|
13
|
+
* tool repeatedly with the projected balance for each year.
|
|
14
|
+
*
|
|
15
|
+
* Table coverage: ONLY the Uniform Lifetime Table (Pub. 590-B Table III,
|
|
16
|
+
* post-2022 version) is implemented, mirroring the site source which uses
|
|
17
|
+
* `UNIFORM_LIFETIME_TABLE` exclusively. The Joint Life Expectancy Table
|
|
18
|
+
* (Table II, applied when spouse is sole beneficiary AND 10+ years younger)
|
|
19
|
+
* is NOT in the site engine and is therefore NOT in this tool — adding it
|
|
20
|
+
* here would create a parity gap with the site calculator. The `tableUsed`
|
|
21
|
+
* field is always `"uniform-lifetime"` for v1; the union type leaves room
|
|
22
|
+
* for `"joint-life-expectancy"` in a future minor bump when the site adds it.
|
|
23
|
+
*
|
|
24
|
+
* Math reference (per IRC §401(a)(9) + Pub. 590-B):
|
|
25
|
+
* distributionPeriod = UNIFORM_LIFETIME_TABLE[ownerAge]
|
|
26
|
+
* rmdAmount = accountBalance / distributionPeriod
|
|
27
|
+
*
|
|
28
|
+
* Missed-RMD penalty (SECURE 2.0 §302, effective 2023+):
|
|
29
|
+
* penaltyIfMissed = rmdAmount × 0.25 (default 25% excise tax)
|
|
30
|
+
* reduced to 10% if corrected within IRS correction window (typically 2 years)
|
|
31
|
+
* (down from 50% pre-SECURE-2.0)
|
|
32
|
+
*
|
|
33
|
+
* Source: IRS Publication 590-B (Uniform Lifetime Table III, post-2022) +
|
|
34
|
+
* SECURE 2.0 Act §107 (RMD age tiers) + §302 (25% excise tax).
|
|
35
|
+
* Last verified: 2026-05-27.
|
|
36
|
+
*/
|
|
37
|
+
import { UNIFORM_LIFETIME_TABLE_2026, UNIFORM_LIFETIME_MIN_AGE, UNIFORM_LIFETIME_MAX_AGE, RMD_MISSED_EXCISE_RATE, RMD_TABLE_SOURCE, } from "./data/rmd2026.js";
|
|
38
|
+
/**
|
|
39
|
+
* SemVer of the RMD engine. Per ADR-0039 § 5 (reaffirmed in ADR-0041
|
|
40
|
+
* Position #4a): major bump = math change; minor = additive output; patch =
|
|
41
|
+
* numerical correction. NOT bumped for cosmetic refactors.
|
|
42
|
+
* - 1.0.0: initial v1 lift from rmd-engine.js (S141 Wave 1B).
|
|
43
|
+
*/
|
|
44
|
+
export const ENGINE_VERSION = "1.0.0";
|
|
45
|
+
/**
|
|
46
|
+
* Compute the required minimum distribution for the given inputs.
|
|
47
|
+
*
|
|
48
|
+
* 1-to-1 logic port of site/src/utils/rmd-engine.js `calculateRMD` +
|
|
49
|
+
* `getDistributionPeriod` (single-year path; multi-year projection out of
|
|
50
|
+
* scope). The site engine clamps lookups to [72, 120]; we additionally
|
|
51
|
+
* require ownerAge ≥ 73 (SECURE 2.0 floor for the 1951-1959 cohort, the
|
|
52
|
+
* common case in 2026) at the tool boundary via RMD_BOUNDS.
|
|
53
|
+
*
|
|
54
|
+
* Throws on undefined-period lookup — should be unreachable because bounds
|
|
55
|
+
* validation in the tool wrapper rejects out-of-range ages first.
|
|
56
|
+
*/
|
|
57
|
+
export function distributionAmount(input) {
|
|
58
|
+
const { accountBalance, ownerAge } = input;
|
|
59
|
+
// Edge: zero balance → zero RMD. Mirror the site's balance ≤ 0 short-circuit
|
|
60
|
+
// but still report the (clamped) distribution period for caller transparency.
|
|
61
|
+
if (accountBalance <= 0) {
|
|
62
|
+
const factor = lookupDistributionPeriod(ownerAge);
|
|
63
|
+
return {
|
|
64
|
+
rmdAmount: 0,
|
|
65
|
+
distributionPeriod: factor,
|
|
66
|
+
lifeExpectancyFactor: factor,
|
|
67
|
+
tableUsed: "uniform-lifetime",
|
|
68
|
+
penaltyIfMissed: 0,
|
|
69
|
+
meta: {
|
|
70
|
+
tableYear: 2026,
|
|
71
|
+
source: RMD_TABLE_SOURCE,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
const distributionPeriod = lookupDistributionPeriod(ownerAge);
|
|
76
|
+
// Site rounds to cents (Math.round * 100 / 100). Keep the same rounding for
|
|
77
|
+
// parity correctness in the test file.
|
|
78
|
+
const rmdRaw = accountBalance / distributionPeriod;
|
|
79
|
+
const rmdAmount = Math.round(rmdRaw * 100) / 100;
|
|
80
|
+
const penaltyIfMissed = Math.round(rmdAmount * RMD_MISSED_EXCISE_RATE * 100) / 100;
|
|
81
|
+
return {
|
|
82
|
+
rmdAmount,
|
|
83
|
+
distributionPeriod,
|
|
84
|
+
lifeExpectancyFactor: distributionPeriod,
|
|
85
|
+
tableUsed: "uniform-lifetime",
|
|
86
|
+
penaltyIfMissed,
|
|
87
|
+
meta: {
|
|
88
|
+
tableYear: 2026,
|
|
89
|
+
source: RMD_TABLE_SOURCE,
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Look up the distribution period from the Uniform Lifetime Table.
|
|
95
|
+
* Mirrors site `getDistributionPeriod`: clamps to [72, 120] and floors
|
|
96
|
+
* fractional ages.
|
|
97
|
+
*/
|
|
98
|
+
function lookupDistributionPeriod(age) {
|
|
99
|
+
const lookupAge = Math.min(Math.max(Math.floor(age), UNIFORM_LIFETIME_MIN_AGE), UNIFORM_LIFETIME_MAX_AGE);
|
|
100
|
+
const factor = UNIFORM_LIFETIME_TABLE_2026[lookupAge];
|
|
101
|
+
if (factor === undefined) {
|
|
102
|
+
// Defensive: bounds validation should prevent this. If we ever hit it,
|
|
103
|
+
// throwing surfaces it as INTERNAL via the tool wrapper rather than
|
|
104
|
+
// silently returning NaN.
|
|
105
|
+
throw new Error(`RMD: no distribution-period factor for age ${age} (lookupAge=${lookupAge})`);
|
|
106
|
+
}
|
|
107
|
+
return factor;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=rmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rmd.js","sourceRoot":"","sources":["../../src/engines/rmd.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAE3B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC;AAuDtC;;;;;;;;;;;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AAM,GAAG,2BAA2B,CAAC,SAAS,CAAC,CAAC;IACtD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,uEAAuE;QACvE,oEAAoE;QACpE,0BAA0B;QAC1B,MAAM,IAAI,KAAK,CACb,8CAA8C,GAAG,eAAe,SAAS,GAAG,CAC7E,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Roth Conversion tax-impact engine — lifted from
|
|
3
|
+
* site/src/pages/roth-conversion-calculator/roth-conversion-calculator.js
|
|
4
|
+
* (functions in tax-brackets.js + calculateBreakEvenYears) and
|
|
5
|
+
* site/src/utils/tax-brackets.js (calculateIncrementalTax, getMarginalRate).
|
|
6
|
+
*
|
|
7
|
+
* Per ADR-0039 § 5: pure synchronous function, ENGINE_VERSION constant,
|
|
8
|
+
* parity test against the source site engine.
|
|
9
|
+
*
|
|
10
|
+
* Scope (S141 Wave 1A Item #2, per S141 Risk #2): SINGLE-CONVERSION tax
|
|
11
|
+
* impact only. Multi-year scenario simulation / optimization is deferred to a
|
|
12
|
+
* future tool (`dc.calculator.rothConversion.multiYearOptimization`). This
|
|
13
|
+
* tool answers "if I convert $X today, what's my federal tax owed?" and
|
|
14
|
+
* "when do I break even on the upfront tax?"
|
|
15
|
+
*
|
|
16
|
+
* NOT MODELED (intentional scope limits):
|
|
17
|
+
* - State tax on the conversion (caller's responsibility; conversion is
|
|
18
|
+
* typically taxed by state at ordinary-income rates).
|
|
19
|
+
* - IRMAA tier impact (the site calculator surfaces this; out of scope for
|
|
20
|
+
* the MCP v0.3.0 tool).
|
|
21
|
+
* - 5-year rule timing for individual contributions (we report whether the
|
|
22
|
+
* 5-year rule applies based on age < 59.5, but don't model the per-
|
|
23
|
+
* conversion clock).
|
|
24
|
+
*
|
|
25
|
+
* Math reference:
|
|
26
|
+
* For taxable income I and conversion amount C:
|
|
27
|
+
* beforeTax = bracketTax(I, brackets[filingStatus])
|
|
28
|
+
* afterTax = bracketTax(I + C, brackets[filingStatus])
|
|
29
|
+
* taxOwed = afterTax − beforeTax (incremental)
|
|
30
|
+
* marginalRate = top bracket spanned by (I + C)
|
|
31
|
+
* effectiveRate = taxOwed / C
|
|
32
|
+
*
|
|
33
|
+
* Break-even years (when conversion tax savings recoup themselves, given
|
|
34
|
+
* the user's retirement marginal rate is lower than the conversion
|
|
35
|
+
* marginal rate and tax-free Roth growth at real return r):
|
|
36
|
+
* If retirementMarginalRate >= conversionMarginalRate → 0
|
|
37
|
+
* (already break-even because future bracket ≥ today's)
|
|
38
|
+
* Else:
|
|
39
|
+
* savingsPerYear ≈ futureBalance × (conversionMarginalRate −
|
|
40
|
+
* retirementMarginalRate)
|
|
41
|
+
* breakEvenYears = log((1 − totalConvRate) / (1 − totalFutureRate))
|
|
42
|
+
* / log(1 + r)
|
|
43
|
+
* (where totalConvRate ≈ effectiveRateOnConversion,
|
|
44
|
+
* totalFutureRate ≈ retirementMarginalRate)
|
|
45
|
+
*
|
|
46
|
+
* This is the same break-even math the site `calculateBreakEvenYears`
|
|
47
|
+
* function uses (we drop the explicit state-tax term; caller-side).
|
|
48
|
+
*
|
|
49
|
+
* Source: IRS Rev. Proc. 2025-32 (2026 federal tax brackets).
|
|
50
|
+
* Last verified: 2026-05-09.
|
|
51
|
+
*/
|
|
52
|
+
import { type FilingStatus } from "./data/federalTax.js";
|
|
53
|
+
/**
|
|
54
|
+
* SemVer of the Roth conversion engine. Per ADR-0039 § 5 (reaffirmed in
|
|
55
|
+
* ADR-0041 Position #4a): major bump = math change; minor = additive output;
|
|
56
|
+
* patch = numerical correction. NOT bumped for cosmetic refactors.
|
|
57
|
+
* - 1.0.0: initial v1 lift from roth-conversion-calculator.js + tax-brackets.js
|
|
58
|
+
* (S141 Wave 1A).
|
|
59
|
+
*/
|
|
60
|
+
export declare const ENGINE_VERSION = "1.0.0";
|
|
61
|
+
/** Inputs to the Roth conversion tax-impact engine. */
|
|
62
|
+
export interface RothConversionTaxImpactInput {
|
|
63
|
+
/** Conversion amount (USD). Must be > 0 to compute taxes. */
|
|
64
|
+
conversionAmount: number;
|
|
65
|
+
/** User's current age (used for 5-year rule flag). */
|
|
66
|
+
age: number;
|
|
67
|
+
/** Federal filing status. */
|
|
68
|
+
filingStatus: FilingStatus;
|
|
69
|
+
/** Current federal taxable income (before adding the conversion), USD. */
|
|
70
|
+
currentTaxableIncome: number;
|
|
71
|
+
/**
|
|
72
|
+
* Expected retirement marginal federal tax rate, whole-number percent
|
|
73
|
+
* (e.g., 12 for 12%). Optional — when omitted, `breakEvenYears` is `null`.
|
|
74
|
+
*/
|
|
75
|
+
retirementMarginalRatePercent?: number;
|
|
76
|
+
/**
|
|
77
|
+
* Expected real (inflation-adjusted) annual return on the converted Roth
|
|
78
|
+
* balance, whole-number percent. Defaults to 7 (a reasonable real-return
|
|
79
|
+
* assumption for a diversified portfolio). Used only for break-even math.
|
|
80
|
+
*/
|
|
81
|
+
expectedReturnPercent?: number;
|
|
82
|
+
}
|
|
83
|
+
/** Result payload returned by the engine. */
|
|
84
|
+
export interface RothConversionTaxImpactResult {
|
|
85
|
+
/** Incremental federal income tax on the conversion amount, USD. */
|
|
86
|
+
taxOwed: number;
|
|
87
|
+
/**
|
|
88
|
+
* Top marginal federal bracket the conversion pushes the user into,
|
|
89
|
+
* expressed as a decimal (e.g., 0.32 for 32%).
|
|
90
|
+
*/
|
|
91
|
+
marginalRateOnConversion: number;
|
|
92
|
+
/** taxOwed / conversionAmount, as a decimal. 0 if conversionAmount = 0. */
|
|
93
|
+
effectiveRateOnConversion: number;
|
|
94
|
+
/**
|
|
95
|
+
* Whether the Roth 5-year rule clock applies for this conversion:
|
|
96
|
+
* true if user is under age 59.5 at conversion. (Conversions made when
|
|
97
|
+
* the account holder is < 59.5 incur a separate 5-year clock for
|
|
98
|
+
* penalty-free withdrawal of converted principal.)
|
|
99
|
+
*/
|
|
100
|
+
fiveYearRuleApplies: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Years until tax-free Roth growth offsets the upfront conversion tax,
|
|
103
|
+
* assuming retirementMarginalRate < conversionMarginalRate. `null` if
|
|
104
|
+
* `retirementMarginalRatePercent` was not provided. `0` if retirement
|
|
105
|
+
* rate ≥ conversion rate (already break-even). May be `Infinity` if
|
|
106
|
+
* mathematically unreachable.
|
|
107
|
+
*/
|
|
108
|
+
breakEvenYears: number | null;
|
|
109
|
+
/** Provenance metadata. */
|
|
110
|
+
meta: {
|
|
111
|
+
/** IRS tax year these brackets apply to. */
|
|
112
|
+
tableYear: number;
|
|
113
|
+
/** Source authority. */
|
|
114
|
+
source: string;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Compute Roth conversion tax impact (single conversion).
|
|
119
|
+
*
|
|
120
|
+
* 1-to-1 port of the federal-tax + incremental-tax + marginal-rate +
|
|
121
|
+
* break-even logic the site uses, with state tax / IRMAA omitted per scope.
|
|
122
|
+
*/
|
|
123
|
+
export declare function taxImpact(input: RothConversionTaxImpactInput): RothConversionTaxImpactResult;
|
|
124
|
+
//# sourceMappingURL=rothConversion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rothConversion.d.ts","sourceRoot":"","sources":["../../src/engines/rothConversion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,OAAO,EAEL,KAAK,YAAY,EAElB,MAAM,sBAAsB,CAAC;AAE9B;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC,uDAAuD;AACvD,MAAM,WAAW,4BAA4B;IAC3C,6DAA6D;IAC7D,gBAAgB,EAAE,MAAM,CAAC;IACzB,sDAAsD;IACtD,GAAG,EAAE,MAAM,CAAC;IACZ,6BAA6B;IAC7B,YAAY,EAAE,YAAY,CAAC;IAC3B,0EAA0E;IAC1E,oBAAoB,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,6BAA6B,CAAC,EAAE,MAAM,CAAC;IACvC;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,6CAA6C;AAC7C,MAAM,WAAW,6BAA6B;IAC5C,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,wBAAwB,EAAE,MAAM,CAAC;IACjC,2EAA2E;IAC3E,yBAAyB,EAAE,MAAM,CAAC;IAClC;;;;;OAKG;IACH,mBAAmB,EAAE,OAAO,CAAC;IAC7B;;;;;;OAMG;IACH,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,2BAA2B;IAC3B,IAAI,EAAE;QACJ,4CAA4C;QAC5C,SAAS,EAAE,MAAM,CAAC;QAClB,wBAAwB;QACxB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AA4BD;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,4BAA4B,GAClC,6BAA6B,CAoE/B"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Roth Conversion tax-impact engine — lifted from
|
|
3
|
+
* site/src/pages/roth-conversion-calculator/roth-conversion-calculator.js
|
|
4
|
+
* (functions in tax-brackets.js + calculateBreakEvenYears) and
|
|
5
|
+
* site/src/utils/tax-brackets.js (calculateIncrementalTax, getMarginalRate).
|
|
6
|
+
*
|
|
7
|
+
* Per ADR-0039 § 5: pure synchronous function, ENGINE_VERSION constant,
|
|
8
|
+
* parity test against the source site engine.
|
|
9
|
+
*
|
|
10
|
+
* Scope (S141 Wave 1A Item #2, per S141 Risk #2): SINGLE-CONVERSION tax
|
|
11
|
+
* impact only. Multi-year scenario simulation / optimization is deferred to a
|
|
12
|
+
* future tool (`dc.calculator.rothConversion.multiYearOptimization`). This
|
|
13
|
+
* tool answers "if I convert $X today, what's my federal tax owed?" and
|
|
14
|
+
* "when do I break even on the upfront tax?"
|
|
15
|
+
*
|
|
16
|
+
* NOT MODELED (intentional scope limits):
|
|
17
|
+
* - State tax on the conversion (caller's responsibility; conversion is
|
|
18
|
+
* typically taxed by state at ordinary-income rates).
|
|
19
|
+
* - IRMAA tier impact (the site calculator surfaces this; out of scope for
|
|
20
|
+
* the MCP v0.3.0 tool).
|
|
21
|
+
* - 5-year rule timing for individual contributions (we report whether the
|
|
22
|
+
* 5-year rule applies based on age < 59.5, but don't model the per-
|
|
23
|
+
* conversion clock).
|
|
24
|
+
*
|
|
25
|
+
* Math reference:
|
|
26
|
+
* For taxable income I and conversion amount C:
|
|
27
|
+
* beforeTax = bracketTax(I, brackets[filingStatus])
|
|
28
|
+
* afterTax = bracketTax(I + C, brackets[filingStatus])
|
|
29
|
+
* taxOwed = afterTax − beforeTax (incremental)
|
|
30
|
+
* marginalRate = top bracket spanned by (I + C)
|
|
31
|
+
* effectiveRate = taxOwed / C
|
|
32
|
+
*
|
|
33
|
+
* Break-even years (when conversion tax savings recoup themselves, given
|
|
34
|
+
* the user's retirement marginal rate is lower than the conversion
|
|
35
|
+
* marginal rate and tax-free Roth growth at real return r):
|
|
36
|
+
* If retirementMarginalRate >= conversionMarginalRate → 0
|
|
37
|
+
* (already break-even because future bracket ≥ today's)
|
|
38
|
+
* Else:
|
|
39
|
+
* savingsPerYear ≈ futureBalance × (conversionMarginalRate −
|
|
40
|
+
* retirementMarginalRate)
|
|
41
|
+
* breakEvenYears = log((1 − totalConvRate) / (1 − totalFutureRate))
|
|
42
|
+
* / log(1 + r)
|
|
43
|
+
* (where totalConvRate ≈ effectiveRateOnConversion,
|
|
44
|
+
* totalFutureRate ≈ retirementMarginalRate)
|
|
45
|
+
*
|
|
46
|
+
* This is the same break-even math the site `calculateBreakEvenYears`
|
|
47
|
+
* function uses (we drop the explicit state-tax term; caller-side).
|
|
48
|
+
*
|
|
49
|
+
* Source: IRS Rev. Proc. 2025-32 (2026 federal tax brackets).
|
|
50
|
+
* Last verified: 2026-05-09.
|
|
51
|
+
*/
|
|
52
|
+
import { FEDERAL_TAX_BRACKETS_2026, } from "./data/federalTax.js";
|
|
53
|
+
/**
|
|
54
|
+
* SemVer of the Roth conversion engine. Per ADR-0039 § 5 (reaffirmed in
|
|
55
|
+
* ADR-0041 Position #4a): major bump = math change; minor = additive output;
|
|
56
|
+
* patch = numerical correction. NOT bumped for cosmetic refactors.
|
|
57
|
+
* - 1.0.0: initial v1 lift from roth-conversion-calculator.js + tax-brackets.js
|
|
58
|
+
* (S141 Wave 1A).
|
|
59
|
+
*/
|
|
60
|
+
export const ENGINE_VERSION = "1.0.0";
|
|
61
|
+
/**
|
|
62
|
+
* Progressive bracket lookup — verbatim port of site `calculateBracketTax`.
|
|
63
|
+
*/
|
|
64
|
+
function bracketTax(taxable, brackets) {
|
|
65
|
+
if (!brackets.length || taxable <= 0)
|
|
66
|
+
return 0;
|
|
67
|
+
for (let i = brackets.length - 1; i >= 0; i--) {
|
|
68
|
+
const b = brackets[i];
|
|
69
|
+
if (taxable > b.min) {
|
|
70
|
+
return b.baseTax + (taxable - b.min) * b.rate;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return 0;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Get the marginal (top) bracket rate for a given taxable income —
|
|
77
|
+
* verbatim port of site `getMarginalRate` (returns as decimal).
|
|
78
|
+
*/
|
|
79
|
+
function marginalRateFor(taxable, brackets) {
|
|
80
|
+
if (taxable <= 0)
|
|
81
|
+
return brackets[0]?.rate ?? 0;
|
|
82
|
+
for (let i = brackets.length - 1; i >= 0; i--) {
|
|
83
|
+
if (taxable > brackets[i].min)
|
|
84
|
+
return brackets[i].rate;
|
|
85
|
+
}
|
|
86
|
+
return brackets[0]?.rate ?? 0;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Compute Roth conversion tax impact (single conversion).
|
|
90
|
+
*
|
|
91
|
+
* 1-to-1 port of the federal-tax + incremental-tax + marginal-rate +
|
|
92
|
+
* break-even logic the site uses, with state tax / IRMAA omitted per scope.
|
|
93
|
+
*/
|
|
94
|
+
export function taxImpact(input) {
|
|
95
|
+
const { conversionAmount, age, filingStatus, currentTaxableIncome, retirementMarginalRatePercent, expectedReturnPercent = 7, } = input;
|
|
96
|
+
const brackets = FEDERAL_TAX_BRACKETS_2026[filingStatus];
|
|
97
|
+
// Incremental federal tax — bracket walk before + after the conversion.
|
|
98
|
+
const beforeTax = bracketTax(currentTaxableIncome, brackets);
|
|
99
|
+
const afterTax = bracketTax(currentTaxableIncome + conversionAmount, brackets);
|
|
100
|
+
const taxOwed = Math.max(0, afterTax - beforeTax);
|
|
101
|
+
// Marginal rate the conversion pushes us into (top spanned bracket).
|
|
102
|
+
const marginalRateOnConversion = marginalRateFor(currentTaxableIncome + conversionAmount, brackets);
|
|
103
|
+
// Effective rate (averaged across the brackets the conversion spans).
|
|
104
|
+
const effectiveRateOnConversion = conversionAmount > 0 ? taxOwed / conversionAmount : 0;
|
|
105
|
+
// 5-year rule applies for under-59.5 conversions.
|
|
106
|
+
const fiveYearRuleApplies = age < 59.5;
|
|
107
|
+
// Break-even years — only when retirementMarginalRatePercent is provided.
|
|
108
|
+
// We use the same log-ratio form as the site calculator's
|
|
109
|
+
// calculateBreakEvenYears (state tax omitted here per scope).
|
|
110
|
+
let breakEvenYears = null;
|
|
111
|
+
if (typeof retirementMarginalRatePercent === "number") {
|
|
112
|
+
const futureRate = retirementMarginalRatePercent / 100;
|
|
113
|
+
const conversionRate = effectiveRateOnConversion;
|
|
114
|
+
const r = expectedReturnPercent / 100;
|
|
115
|
+
if (futureRate >= conversionRate) {
|
|
116
|
+
// Future tax rate ≥ today's conversion rate → already break-even.
|
|
117
|
+
breakEvenYears = 0;
|
|
118
|
+
}
|
|
119
|
+
else if (conversionRate >= 1) {
|
|
120
|
+
breakEvenYears = Infinity;
|
|
121
|
+
}
|
|
122
|
+
else if (r <= 0) {
|
|
123
|
+
breakEvenYears = Infinity;
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
// log((1 - futureRate) / (1 - conversionRate)) / log(1 + r)
|
|
127
|
+
const numerator = Math.log((1 - futureRate) / (1 - conversionRate));
|
|
128
|
+
const denominator = Math.log(1 + r);
|
|
129
|
+
const raw = numerator / denominator;
|
|
130
|
+
breakEvenYears = raw < 0 ? 0 : raw;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
taxOwed,
|
|
135
|
+
marginalRateOnConversion,
|
|
136
|
+
effectiveRateOnConversion,
|
|
137
|
+
fiveYearRuleApplies,
|
|
138
|
+
breakEvenYears,
|
|
139
|
+
meta: {
|
|
140
|
+
tableYear: 2026,
|
|
141
|
+
source: "IRS Rev. Proc. 2025-32",
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=rothConversion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rothConversion.js","sourceRoot":"","sources":["../../src/engines/rothConversion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,OAAO,EACL,yBAAyB,GAG1B,MAAM,sBAAsB,CAAC;AAE9B;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC;AA4DtC;;GAEG;AACH,SAAS,UAAU,CAAC,OAAe,EAAE,QAAsB;IACzD,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAI,OAAO,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC;IAC/C,KAAK,IAAI,CAAC,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC9C,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,OAAO,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;YACpB,OAAO,CAAC,CAAC,OAAO,GAAG,CA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I;YACf,MAAM,EAAE,wBAAwB;SACjC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,29 +2,41 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @markcolabs/mcp — MCP server entrypoint.
|
|
4
4
|
*
|
|
5
|
-
* v0.
|
|
6
|
-
*
|
|
5
|
+
* v0.3.0 (per ADR-0039 + ADR-0041 reconciliation; S141 Wave 1A + 1B).
|
|
6
|
+
* Registers:
|
|
7
|
+
* - 9 tools:
|
|
7
8
|
* dc.calculator.mortgage.monthlyPayment (S135 Item 5)
|
|
8
9
|
* dc.calculator.compoundInterest.futureValue (S135 Item 5)
|
|
9
10
|
* dc.calculator.retirement401k.projection (S136 Item 3, renamed v0.2.0 per ADR-0041 D2)
|
|
10
11
|
* dc.calculator.socialSecurity.estimatedBenefit (S136 Item 3, renamed v0.2.0 per ADR-0041 D2)
|
|
11
12
|
* dc.calculator.paycheck.netPay (S136 Item 3)
|
|
13
|
+
* dc.calculator.ira.contributionLimit (S141 Wave 1A)
|
|
14
|
+
* dc.calculator.rothConversion.taxImpact (S141 Wave 1A)
|
|
15
|
+
* dc.calculator.rmd.distributionAmount (S141 Wave 1B — new)
|
|
16
|
+
* dc.calculator.hsa.contributionLimit (S141 Wave 1B — new)
|
|
12
17
|
* - 1 resource: dc://disclaimers/ymyl (canonical YMYL disclaimer)
|
|
13
18
|
*
|
|
14
19
|
* Transport: stdio (default for local MCP clients).
|
|
15
20
|
*
|
|
16
|
-
*
|
|
17
|
-
* (dc://methodologies/*) and the `plan-retirement` prompt template (O5-KR2).
|
|
21
|
+
* S141 Wave 1A took tool coverage 5 → 7; Wave 1B finalizes 7 → 9 (v0.3.0).
|
|
18
22
|
*/
|
|
19
23
|
export { execute as executeMortgageTool } from "./tools/mortgage.js";
|
|
20
24
|
export { execute as executeCompoundInterestTool } from "./tools/compoundInterest.js";
|
|
21
25
|
export { execute as executeRetirement401kTool } from "./tools/retirement401k.js";
|
|
22
26
|
export { execute as executeSocialSecurityTool } from "./tools/socialSecurity.js";
|
|
23
27
|
export { execute as executePaycheckTool } from "./tools/paycheck.js";
|
|
28
|
+
export { execute as executeIraTool } from "./tools/ira.js";
|
|
29
|
+
export { execute as executeRothConversionTool } from "./tools/rothConversion.js";
|
|
30
|
+
export { execute as executeRmdTool } from "./tools/rmd.js";
|
|
31
|
+
export { execute as executeHsaTool } from "./tools/hsa.js";
|
|
24
32
|
export * as mortgageEngine from "./engines/mortgage.js";
|
|
25
33
|
export * as compoundInterestEngine from "./engines/compoundInterest.js";
|
|
26
34
|
export * as retirement401kEngine from "./engines/retirement401k.js";
|
|
27
35
|
export * as socialSecurityEngine from "./engines/socialSecurity.js";
|
|
28
36
|
export * as paycheckEngine from "./engines/paycheck.js";
|
|
37
|
+
export * as iraEngine from "./engines/ira.js";
|
|
38
|
+
export * as rothConversionEngine from "./engines/rothConversion.js";
|
|
39
|
+
export * as rmdEngine from "./engines/rmd.js";
|
|
40
|
+
export * as hsaEngine from "./engines/hsa.js";
|
|
29
41
|
export * from "./envelope.js";
|
|
30
42
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;GAoBG;AA4BH,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,sBAAsB,MAAM,+BAA+B,CAAC;AACxE,OAAO,KAAK,oBAAoB,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,oBAAoB,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,oBAAoB,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAC;AAC9C,cAAc,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,19 +2,23 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @markcolabs/mcp — MCP server entrypoint.
|
|
4
4
|
*
|
|
5
|
-
* v0.
|
|
6
|
-
*
|
|
5
|
+
* v0.3.0 (per ADR-0039 + ADR-0041 reconciliation; S141 Wave 1A + 1B).
|
|
6
|
+
* Registers:
|
|
7
|
+
* - 9 tools:
|
|
7
8
|
* dc.calculator.mortgage.monthlyPayment (S135 Item 5)
|
|
8
9
|
* dc.calculator.compoundInterest.futureValue (S135 Item 5)
|
|
9
10
|
* dc.calculator.retirement401k.projection (S136 Item 3, renamed v0.2.0 per ADR-0041 D2)
|
|
10
11
|
* dc.calculator.socialSecurity.estimatedBenefit (S136 Item 3, renamed v0.2.0 per ADR-0041 D2)
|
|
11
12
|
* dc.calculator.paycheck.netPay (S136 Item 3)
|
|
13
|
+
* dc.calculator.ira.contributionLimit (S141 Wave 1A)
|
|
14
|
+
* dc.calculator.rothConversion.taxImpact (S141 Wave 1A)
|
|
15
|
+
* dc.calculator.rmd.distributionAmount (S141 Wave 1B — new)
|
|
16
|
+
* dc.calculator.hsa.contributionLimit (S141 Wave 1B — new)
|
|
12
17
|
* - 1 resource: dc://disclaimers/ymyl (canonical YMYL disclaimer)
|
|
13
18
|
*
|
|
14
19
|
* Transport: stdio (default for local MCP clients).
|
|
15
20
|
*
|
|
16
|
-
*
|
|
17
|
-
* (dc://methodologies/*) and the `plan-retirement` prompt template (O5-KR2).
|
|
21
|
+
* S141 Wave 1A took tool coverage 5 → 7; Wave 1B finalizes 7 → 9 (v0.3.0).
|
|
18
22
|
*/
|
|
19
23
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
20
24
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
@@ -25,6 +29,10 @@ import * as compoundInterestTool from "./tools/compoundInterest.js";
|
|
|
25
29
|
import * as retirement401kTool from "./tools/retirement401k.js";
|
|
26
30
|
import * as socialSecurityTool from "./tools/socialSecurity.js";
|
|
27
31
|
import * as paycheckTool from "./tools/paycheck.js";
|
|
32
|
+
import * as iraTool from "./tools/ira.js";
|
|
33
|
+
import * as rothConversionTool from "./tools/rothConversion.js";
|
|
34
|
+
import * as rmdTool from "./tools/rmd.js";
|
|
35
|
+
import * as hsaTool from "./tools/hsa.js";
|
|
28
36
|
import { YMYL_DISCLAIMER, YMYL_DISCLAIMER_URI, } from "./disclaimers/ymyl.js";
|
|
29
37
|
// Re-export the tool execute functions and engines so consumers (and parity
|
|
30
38
|
// tests) can import them directly without spinning up the MCP transport.
|
|
@@ -33,18 +41,26 @@ export { execute as executeCompoundInterestTool } from "./tools/compoundInterest
|
|
|
33
41
|
export { execute as executeRetirement401kTool } from "./tools/retirement401k.js";
|
|
34
42
|
export { execute as executeSocialSecurityTool } from "./tools/socialSecurity.js";
|
|
35
43
|
export { execute as executePaycheckTool } from "./tools/paycheck.js";
|
|
44
|
+
export { execute as executeIraTool } from "./tools/ira.js";
|
|
45
|
+
export { execute as executeRothConversionTool } from "./tools/rothConversion.js";
|
|
46
|
+
export { execute as executeRmdTool } from "./tools/rmd.js";
|
|
47
|
+
export { execute as executeHsaTool } from "./tools/hsa.js";
|
|
36
48
|
export * as mortgageEngine from "./engines/mortgage.js";
|
|
37
49
|
export * as compoundInterestEngine from "./engines/compoundInterest.js";
|
|
38
50
|
export * as retirement401kEngine from "./engines/retirement401k.js";
|
|
39
51
|
export * as socialSecurityEngine from "./engines/socialSecurity.js";
|
|
40
52
|
export * as paycheckEngine from "./engines/paycheck.js";
|
|
53
|
+
export * as iraEngine from "./engines/ira.js";
|
|
54
|
+
export * as rothConversionEngine from "./engines/rothConversion.js";
|
|
55
|
+
export * as rmdEngine from "./engines/rmd.js";
|
|
56
|
+
export * as hsaEngine from "./engines/hsa.js";
|
|
41
57
|
export * from "./envelope.js";
|
|
42
58
|
// ---------------------------------------------------------------------------
|
|
43
59
|
// Server setup
|
|
44
60
|
// ---------------------------------------------------------------------------
|
|
45
61
|
const server = new Server({
|
|
46
62
|
name: "@markcolabs/mcp",
|
|
47
|
-
version: "0.
|
|
63
|
+
version: "0.3.0",
|
|
48
64
|
}, {
|
|
49
65
|
capabilities: {
|
|
50
66
|
tools: {},
|
|
@@ -54,6 +70,20 @@ const server = new Server({
|
|
|
54
70
|
// ---------------------------------------------------------------------------
|
|
55
71
|
// tools/list
|
|
56
72
|
// ---------------------------------------------------------------------------
|
|
73
|
+
/**
|
|
74
|
+
* Tool annotations per Anthropic Claude Connectors Directory spec
|
|
75
|
+
* (MCP-AUDIT-023, S141 Item #5):
|
|
76
|
+
* - title: human-readable display name (sentence-case)
|
|
77
|
+
* - readOnlyHint: true — all our tools are pure functions, no mutation
|
|
78
|
+
* - destructiveHint: false — no tool modifies any state
|
|
79
|
+
*
|
|
80
|
+
* Applied uniformly across all 9 tools — the package is read-only by design
|
|
81
|
+
* (MCP-AUDIT-008 audit-bundle conclusion).
|
|
82
|
+
*/
|
|
83
|
+
const READ_ONLY_ANNOTATIONS = {
|
|
84
|
+
readOnlyHint: true,
|
|
85
|
+
destructiveHint: false,
|
|
86
|
+
};
|
|
57
87
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
58
88
|
return {
|
|
59
89
|
tools: [
|
|
@@ -61,26 +91,82 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
61
91
|
name: mortgageTool.TOOL_NAME,
|
|
62
92
|
description: mortgageTool.TOOL_DESCRIPTION,
|
|
63
93
|
inputSchema: zodToJsonSchema(mortgageTool.MortgageMonthlyPaymentInputSchema),
|
|
94
|
+
annotations: {
|
|
95
|
+
title: "Mortgage Monthly Payment",
|
|
96
|
+
...READ_ONLY_ANNOTATIONS,
|
|
97
|
+
},
|
|
64
98
|
},
|
|
65
99
|
{
|
|
66
100
|
name: compoundInterestTool.TOOL_NAME,
|
|
67
101
|
description: compoundInterestTool.TOOL_DESCRIPTION,
|
|
68
102
|
inputSchema: zodToJsonSchema(compoundInterestTool.CompoundInterestFutureValueInputSchema),
|
|
103
|
+
annotations: {
|
|
104
|
+
title: "Compound Interest Future Value",
|
|
105
|
+
...READ_ONLY_ANNOTATIONS,
|
|
106
|
+
},
|
|
69
107
|
},
|
|
70
108
|
{
|
|
71
109
|
name: retirement401kTool.TOOL_NAME,
|
|
72
110
|
description: retirement401kTool.TOOL_DESCRIPTION,
|
|
73
111
|
inputSchema: zodToJsonSchema(retirement401kTool.Retirement401kProjectionInputSchema),
|
|
112
|
+
annotations: {
|
|
113
|
+
title: "401(k) Retirement Projection",
|
|
114
|
+
...READ_ONLY_ANNOTATIONS,
|
|
115
|
+
},
|
|
74
116
|
},
|
|
75
117
|
{
|
|
76
118
|
name: socialSecurityTool.TOOL_NAME,
|
|
77
119
|
description: socialSecurityTool.TOOL_DESCRIPTION,
|
|
78
120
|
inputSchema: zodToJsonSchema(socialSecurityTool.SocialSecurityEstimateInputSchema),
|
|
121
|
+
annotations: {
|
|
122
|
+
title: "Social Security Estimated Benefit",
|
|
123
|
+
...READ_ONLY_ANNOTATIONS,
|
|
124
|
+
},
|
|
79
125
|
},
|
|
80
126
|
{
|
|
81
127
|
name: paycheckTool.TOOL_NAME,
|
|
82
128
|
description: paycheckTool.TOOL_DESCRIPTION,
|
|
83
129
|
inputSchema: zodToJsonSchema(paycheckTool.PaycheckNetPayInputSchema),
|
|
130
|
+
annotations: {
|
|
131
|
+
title: "Paycheck Net Pay",
|
|
132
|
+
...READ_ONLY_ANNOTATIONS,
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
name: iraTool.TOOL_NAME,
|
|
137
|
+
description: iraTool.TOOL_DESCRIPTION,
|
|
138
|
+
inputSchema: zodToJsonSchema(iraTool.IraContributionLimitInputSchema),
|
|
139
|
+
annotations: {
|
|
140
|
+
title: "IRA Contribution Limit",
|
|
141
|
+
...READ_ONLY_ANNOTATIONS,
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: rothConversionTool.TOOL_NAME,
|
|
146
|
+
description: rothConversionTool.TOOL_DESCRIPTION,
|
|
147
|
+
inputSchema: zodToJsonSchema(rothConversionTool.RothConversionTaxImpactInputSchema),
|
|
148
|
+
annotations: {
|
|
149
|
+
title: "Roth Conversion Tax Impact",
|
|
150
|
+
...READ_ONLY_ANNOTATIONS,
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: rmdTool.TOOL_NAME,
|
|
155
|
+
description: rmdTool.TOOL_DESCRIPTION,
|
|
156
|
+
inputSchema: zodToJsonSchema(rmdTool.RmdDistributionAmountInputSchema),
|
|
157
|
+
annotations: {
|
|
158
|
+
title: "RMD Distribution Amount",
|
|
159
|
+
...READ_ONLY_ANNOTATIONS,
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: hsaTool.TOOL_NAME,
|
|
164
|
+
description: hsaTool.TOOL_DESCRIPTION,
|
|
165
|
+
inputSchema: zodToJsonSchema(hsaTool.HsaContributionLimitInputSchema),
|
|
166
|
+
annotations: {
|
|
167
|
+
title: "HSA Contribution Limit",
|
|
168
|
+
...READ_ONLY_ANNOTATIONS,
|
|
169
|
+
},
|
|
84
170
|
},
|
|
85
171
|
],
|
|
86
172
|
};
|
|
@@ -107,6 +193,18 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
107
193
|
case paycheckTool.TOOL_NAME:
|
|
108
194
|
result = paycheckTool.execute(args);
|
|
109
195
|
break;
|
|
196
|
+
case iraTool.TOOL_NAME:
|
|
197
|
+
result = iraTool.execute(args);
|
|
198
|
+
break;
|
|
199
|
+
case rothConversionTool.TOOL_NAME:
|
|
200
|
+
result = rothConversionTool.execute(args);
|
|
201
|
+
break;
|
|
202
|
+
case rmdTool.TOOL_NAME:
|
|
203
|
+
result = rmdTool.execute(args);
|
|
204
|
+
break;
|
|
205
|
+
case hsaTool.TOOL_NAME:
|
|
206
|
+
result = hsaTool.execute(args);
|
|
207
|
+
break;
|
|
110
208
|
default:
|
|
111
209
|
return {
|
|
112
210
|
isError: true,
|
|
@@ -181,7 +279,7 @@ async function main() {
|
|
|
181
279
|
const transport = new StdioServerTransport();
|
|
182
280
|
await server.connect(transport);
|
|
183
281
|
// eslint-disable-next-line no-console
|
|
184
|
-
console.error("[@markcolabs/mcp] v0.
|
|
282
|
+
console.error("[@markcolabs/mcp] v0.3.0 ready (stdio) — 9 tools registered.");
|
|
185
283
|
}
|
|
186
284
|
// Run only when invoked as a binary, not when imported by parity tests.
|
|
187
285
|
const isDirect = import.meta.url === `file://${process.argv[1]}` ||
|