projectionlab-mcp 1.2.2 → 1.3.1

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.
Files changed (119) hide show
  1. package/HOW-IT-WORKS.md +5 -4
  2. package/MANUAL-SETUP.md +8 -4
  3. package/README.md +1 -1
  4. package/REFERENCE.md +25 -9
  5. package/SETUP-FOR-AGENTS.md +4 -4
  6. package/dist/bootstrap.js +15 -3
  7. package/dist/bootstrap.js.map +1 -1
  8. package/dist/bridge.d.ts +29 -6
  9. package/dist/config.d.ts +0 -1
  10. package/dist/config.js +0 -2
  11. package/dist/config.js.map +1 -1
  12. package/dist/currentFinances.d.ts +60 -0
  13. package/dist/currentFinances.js +117 -2
  14. package/dist/currentFinances.js.map +1 -1
  15. package/dist/dataModel.d.ts +37 -8
  16. package/dist/dataModel.js +1138 -15
  17. package/dist/dataModel.js.map +1 -1
  18. package/dist/diff.d.ts +26 -10
  19. package/dist/diff.js +163 -23
  20. package/dist/diff.js.map +1 -1
  21. package/dist/editAccess.d.ts +15 -0
  22. package/dist/editAccess.js +29 -0
  23. package/dist/editAccess.js.map +1 -0
  24. package/dist/errors.d.ts +1 -1
  25. package/dist/errors.js.map +1 -1
  26. package/dist/extensionBridge.d.ts +44 -8
  27. package/dist/extensionBridge.js +179 -30
  28. package/dist/extensionBridge.js.map +1 -1
  29. package/dist/index.js +2 -3
  30. package/dist/index.js.map +1 -1
  31. package/dist/instructions.d.ts +1 -1
  32. package/dist/instructions.js +1 -1
  33. package/dist/layout.d.ts +68 -0
  34. package/dist/layout.js +122 -0
  35. package/dist/layout.js.map +1 -0
  36. package/dist/linkedFields.d.ts +77 -0
  37. package/dist/linkedFields.js +191 -0
  38. package/dist/linkedFields.js.map +1 -0
  39. package/dist/pathPatch.d.ts +41 -3
  40. package/dist/pathPatch.js +162 -14
  41. package/dist/pathPatch.js.map +1 -1
  42. package/dist/planSettings.d.ts +21 -2
  43. package/dist/planSettings.js +30 -6
  44. package/dist/planSettings.js.map +1 -1
  45. package/dist/planVersion.d.ts +7 -2
  46. package/dist/planVersion.js +27 -11
  47. package/dist/planVersion.js.map +1 -1
  48. package/dist/plans.d.ts +46 -6
  49. package/dist/plans.js +152 -15
  50. package/dist/plans.js.map +1 -1
  51. package/dist/realEstate.d.ts +20 -0
  52. package/dist/realEstate.js +57 -0
  53. package/dist/realEstate.js.map +1 -1
  54. package/dist/redact.d.ts +20 -0
  55. package/dist/redact.js +62 -0
  56. package/dist/redact.js.map +1 -1
  57. package/dist/resources/dataModel.d.ts +6 -2
  58. package/dist/resources/dataModel.js +96 -16
  59. package/dist/resources/dataModel.js.map +1 -1
  60. package/dist/resources/knowledge.d.ts +7 -1
  61. package/dist/resources/knowledge.js +262 -14
  62. package/dist/resources/knowledge.js.map +1 -1
  63. package/dist/resources/layoutResource.d.ts +19 -0
  64. package/dist/resources/layoutResource.js +43 -0
  65. package/dist/resources/layoutResource.js.map +1 -0
  66. package/dist/resources/planData.js +1 -1
  67. package/dist/resources/planData.js.map +1 -1
  68. package/dist/snapshot.d.ts +2 -1
  69. package/dist/snapshot.js +3 -1
  70. package/dist/snapshot.js.map +1 -1
  71. package/dist/summary.d.ts +39 -2
  72. package/dist/summary.js +148 -31
  73. package/dist/summary.js.map +1 -1
  74. package/dist/tools/bootstrap.js +2 -1
  75. package/dist/tools/bootstrap.js.map +1 -1
  76. package/dist/tools/clonePlan.js +10 -9
  77. package/dist/tools/clonePlan.js.map +1 -1
  78. package/dist/tools/connection.js +8 -8
  79. package/dist/tools/connection.js.map +1 -1
  80. package/dist/tools/deletePlan.js +9 -8
  81. package/dist/tools/deletePlan.js.map +1 -1
  82. package/dist/tools/diff.js +54 -15
  83. package/dist/tools/diff.js.map +1 -1
  84. package/dist/tools/export.js +5 -5
  85. package/dist/tools/export.js.map +1 -1
  86. package/dist/tools/getCurrentFinances.js +80 -24
  87. package/dist/tools/getCurrentFinances.js.map +1 -1
  88. package/dist/tools/getPlan.js +7 -1
  89. package/dist/tools/getPlan.js.map +1 -1
  90. package/dist/tools/getPlanSection.js +27 -4
  91. package/dist/tools/getPlanSection.js.map +1 -1
  92. package/dist/tools/getPlanSettings.js +16 -4
  93. package/dist/tools/getPlanSettings.js.map +1 -1
  94. package/dist/tools/restore.d.ts +4 -3
  95. package/dist/tools/restore.js +82 -42
  96. package/dist/tools/restore.js.map +1 -1
  97. package/dist/tools/schema.js +100 -22
  98. package/dist/tools/schema.js.map +1 -1
  99. package/dist/tools/snapshots.js +39 -19
  100. package/dist/tools/snapshots.js.map +1 -1
  101. package/dist/tools/summary.js +34 -1
  102. package/dist/tools/summary.js.map +1 -1
  103. package/dist/tools/updateAccount.js +69 -26
  104. package/dist/tools/updateAccount.js.map +1 -1
  105. package/dist/tools/updatePlanEvent.js +62 -27
  106. package/dist/tools/updatePlanEvent.js.map +1 -1
  107. package/dist/tools/updatePlanSection.js +59 -12
  108. package/dist/tools/updatePlanSection.js.map +1 -1
  109. package/dist/tools/updatePlanSettings.js +33 -13
  110. package/dist/tools/updatePlanSettings.js.map +1 -1
  111. package/dist/tools/writeGuard.d.ts +11 -0
  112. package/dist/tools/writeGuard.js +17 -0
  113. package/dist/tools/writeGuard.js.map +1 -0
  114. package/dist/types/projectionlab.d.ts +4 -0
  115. package/dist/types/wire.d.ts +57 -8
  116. package/dist/types/wire.js +16 -2
  117. package/dist/types/wire.js.map +1 -1
  118. package/package.json +1 -1
  119. package/skills/projectionlab/SKILL.md +234 -18
@@ -1,18 +1,36 @@
1
- import { DATA_MODEL_GROUPS, DATA_MODEL_PROJECTIONLAB_VERSION, } from "../dataModel.js";
1
+ import { DATA_MODEL_GROUPS, DATA_MODEL_PROJECTIONLAB_VERSION, DATA_MODEL_V5_GROUPS, DATA_MODEL_V5_PROJECTIONLAB_VERSION, enforcesAllowedValues, UI_LABELS_V5, } from "../dataModel.js";
2
+ import { ACCOUNT_EVENT_LINKED_FIELDS, ASSET_EVENT_LINKED_FIELDS, } from "../linkedFields.js";
3
+ import { registerLayoutResource } from "./layoutResource.js";
2
4
  function renderField(pattern, field) {
3
5
  const parts = [`- \`${pattern}\` [${field.evidence}]: ${field.description}`];
4
6
  if (field.units)
5
7
  parts.push(`Units: ${field.units}.`);
6
8
  if (field.allowedValues) {
7
9
  parts.push(`Allowed values: ${field.allowedValues.join(", ")}.`);
10
+ if (enforcesAllowedValues(field)) {
11
+ parts.push("A write of any other value is refused.");
12
+ }
8
13
  }
9
14
  if (field.enabledBy)
10
15
  parts.push(`Enabled by: ${field.enabledBy}.`);
11
16
  if (field.note)
12
17
  parts.push(`Note: ${field.note}`);
18
+ if (field.uiLabel && field.uiLocation) {
19
+ parts.push(`In the app (ProjectionLab 5.0.0): "${field.uiLabel}" under ${field.uiLocation}.`);
20
+ }
13
21
  return parts.join(" ");
14
22
  }
15
- export function renderDataModelMarkdown() {
23
+ /** Every field whose ProjectionLab 5.0.0 label is recorded. */
24
+ function renderUiLabels() {
25
+ const lines = [];
26
+ for (const [scope, labels] of Object.entries(UI_LABELS_V5)) {
27
+ for (const [path, [label, location]] of Object.entries(labels)) {
28
+ lines.push(`- \`${scope}.${path}\`: "${label}" under ${location}.`);
29
+ }
30
+ }
31
+ return lines;
32
+ }
33
+ export function renderDataModelV4Markdown() {
16
34
  const lines = [
17
35
  `# ProjectionLab Data Model (ProjectionLab ${DATA_MODEL_PROJECTIONLAB_VERSION})`,
18
36
  "",
@@ -46,21 +64,83 @@ export function renderDataModelMarkdown() {
46
64
  }
47
65
  return lines.join("\n");
48
66
  }
49
- export function registerDataModelResource(server) {
50
- server.registerResource("data-model", "projectionlab://data-model", {
67
+ export function renderDataModelV5Markdown() {
68
+ const lines = [
69
+ `# ProjectionLab Data Model (ProjectionLab ${DATA_MODEL_V5_PROJECTIONLAB_VERSION})`,
70
+ "",
71
+ "Field reference for the values in ProjectionLab 5 exports. " +
72
+ "The root document envelope carries schema version 1 and an exportedAt timestamp, " +
73
+ "containing currentFinances, plans, settings, and accountHistory.",
74
+ "",
75
+ "Key characteristics of the ProjectionLab 5 layout:",
76
+ "- Accounts live in documents.currentFinances.accounts keyed by account ID. " +
77
+ "Each account record carries a kind discriminator: account (with balance and costBasis), " +
78
+ "debt (with balance and optional securedByAssetId), or real-asset (with value and purchasePrice). " +
79
+ "Archived accounts carry an archivedOn ISO date string.",
80
+ "- The Solo 401k, Roth Solo 401k, and SEP IRA account types store as type \"401k\" or \"roth-401k\" with subtype \"solo\", and type \"ira\" with subtype \"sep\".",
81
+ "- Plan events carry a kind discriminator: account, real-asset, income, expense, or priority. " +
82
+ "Plan account events link to Current Finances accounts via accountId, and asset events link via assetId. " +
83
+ "Event timing is defined by timing objects with type (date, milestone, keyword), value, and optional modifier.",
84
+ "- Plans carry no active flag. settings.plan.activeId and baselineId are reported as stored, and " +
85
+ "no plan is treated as the selected plan.",
86
+ "- A priority's accountId names the plan account event it routes cash to, not a Current Finances account. " +
87
+ "Event names need not be unique within a section; address an event by id when its name is ambiguous.",
88
+ "- Historical records are stored in documents.accountHistory keyed by account ID then calendar year, " +
89
+ "without a separate progress section.",
90
+ "",
91
+ "Evidence tags: [export-shape] means the field and its value type appear in a " +
92
+ "ProjectionLab 5 export; its meaning is not yet confirmed by a stored-value test. " +
93
+ "[observed] means a value was set through the ProjectionLab 5 UI and the stored value " +
94
+ "was read back. Writes are refused only on [observed] option lists.",
95
+ "",
96
+ ];
97
+ for (const group of DATA_MODEL_V5_GROUPS) {
98
+ lines.push(`## ${group.title}`, "");
99
+ for (const [pattern, field] of Object.entries(group.fields)) {
100
+ lines.push(renderField(pattern, field));
101
+ }
102
+ lines.push("");
103
+ }
104
+ lines.push("## Fields in the app", "", "Plan settings (variables, montecarlo, withdrawalStrategy) and plan events keep the paths " +
105
+ "ProjectionLab 4 uses; their meanings, units and allowed values are in " +
106
+ "projectionlab://data-model?layout=v4. Each field below was found in the app by writing a " +
107
+ "distinct value to it or by matching a stored value to its control. Use the label and " +
108
+ "location when telling the user where to look. A location in parentheses names the mode " +
109
+ "or choice that must be selected for the control to appear.", "", ...renderUiLabels(), "", "## Fields the tools cannot change", "", "Do not write these, and do not try to reach them through another field. Tell the user " +
110
+ "where to change them in the app instead.", "", "- Milestone settings (Whose Milestone, Count Progress From, Start a Chapter, Active in " +
111
+ "This Plan, Marker on Charts, Warn if Never Reached) are not in the export.", "- Built-in milestones (retirement, life expectancy) have no `removable: true` and cannot " +
112
+ "be deleted.", "- Events ProjectionLab generates, such as the Medicare expenses, carry " +
113
+ '`_meta.deletion: "locked"`; leave them in place.', "- Derived figures are computed by the app and have no stored field: Monthly Benefit, " +
114
+ "Full Retirement Age, Years to Pay Off, Real Return, and a real asset's equity and loan " +
115
+ "balance.", "- Keys starting with an underscore (`_rothConversions`, `bondSettings._allocation`) are " +
116
+ "switched-off copies; editing them changes nothing in the app.", "- A field that only applies in a mode, such as `incomeRate` while `generateIncome` is " +
117
+ "off, has no effect until the user selects that mode.", "- A plan event linked to Current Finances takes some fields from the item it links " +
118
+ "to, and ProjectionLab overwrites a value written to them in the plan. Writes to them " +
119
+ "are refused; change them with projectionlab_update_account, which changes every plan " +
120
+ "linked to that item. An account event with `accountId` takes " +
121
+ `${ACCOUNT_EVENT_LINKED_FIELDS.map((f) => "`" + f + "`").join(", ")}. ` +
122
+ "An asset event with `assetId` takes " +
123
+ `${ASSET_EVENT_LINKED_FIELDS.map((f) => "`" + f + "`").join(", ")}. ` +
124
+ "A priority with `accountId` takes `owner` and `icon` from the account it routes to " +
125
+ "(a transfer priority takes only `owner`). listPaths on one event marks these paths " +
126
+ "with `syncedFrom`. A field the event lists in `_meta.overriddenFields` keeps its plan " +
127
+ "value, except on the baseline plan, which keeps no overrides.", "- Progress history is recorded by ProjectionLab 5; writing it is refused.", "- Switching a Social Security income to Estimate Benefit in the app also changes its " +
128
+ "end and `taxExempt`; read the event again after the user switches modes.", "");
129
+ return lines.join("\n");
130
+ }
131
+ export function renderDataModelMarkdown(layout = "v4") {
132
+ return layout === "v5" ? renderDataModelV5Markdown() : renderDataModelV4Markdown();
133
+ }
134
+ export function registerDataModelResource(server, bridge) {
135
+ registerLayoutResource(server, bridge, {
136
+ name: "data-model",
137
+ uri: "projectionlab://data-model",
51
138
  title: "ProjectionLab Data Model",
52
139
  description: `Field meanings, units, and allowed values for path-addressable reads and writes, ` +
53
- `version-stamped to ProjectionLab ${DATA_MODEL_PROJECTIONLAB_VERSION}. Static. ` +
54
- "Entries tagged ui-label are not yet confirmed by a stored-value test.",
55
- mimeType: "text/markdown",
56
- }, async (uri) => ({
57
- contents: [
58
- {
59
- uri: uri.href,
60
- text: renderDataModelMarkdown(),
61
- mimeType: "text/markdown",
62
- },
63
- ],
64
- }));
140
+ `version-stamped to ProjectionLab ${DATA_MODEL_PROJECTIONLAB_VERSION} (v4) and ` +
141
+ `${DATA_MODEL_V5_PROJECTIONLAB_VERSION} (v5). Follows the connected ProjectionLab version once a connection check has run, and ProjectionLab 4 before that; append ?layout=v4 or ?layout=v5 to choose. ` +
142
+ "Entries tagged ui-label or export-shape are not yet confirmed by a stored-value test.",
143
+ render: renderDataModelMarkdown,
144
+ });
65
145
  }
66
146
  //# sourceMappingURL=dataModel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dataModel.js","sourceRoot":"","sources":["../../src/resources/dataModel.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,gCAAgC,GAEjC,MAAM,iBAAiB,CAAC;AAEzB,SAAS,WAAW,CAAC,OAAe,EAAE,KAAqB;IACzD,MAAM,KAAK,GAAG,CAAC,OAAO,OAAO,OAAO,KAAK,CAAC,QAAQ,MAAM,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;IAC7E,IAAI,KAAK,CAAC,KAAK;QAAE,KAAK,CAAC,IAAI,CAAC,UAAU,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC;IACtD,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC;QACxB,KAAK,CAAC,IAAI,CAAC,mBAAmB,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GA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C,yBAAyB,EAAE,CAAC;AACrF,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,MAAiB,EAAE,MAAe;IAC1E,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE;QACrC,IAAI,EAAE,YAAY;QAClB,GAAG,EAAE,4BAA4B;QACjC,KAAK,EAAE,0BAA0B;QACjC,WAAW,EACT,mFAAmF;YACnF,oCAAoC,gCAAgC,YAAY;YAChF,GAAG,mCAAmC,kKAAkK;YACxM,uFAAuF;QACzF,MAAM,EAAE,uBAAuB;KAChC,CAAC,CAAC;AACL,CAAC"}
@@ -1,2 +1,8 @@
1
1
  import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- export declare function registerKnowledgeResource(server: McpServer): void;
2
+ import type { Bridge } from "../bridge.js";
3
+ import type { ExportLayout } from "../layout.js";
4
+ export declare const KNOWLEDGE_V4 = "# ProjectionLab & FIRE Reference\n\nCurated concepts for analyzing retirement plans through this MCP server.\n\nProjectionLab v5 is in early access; this reference and the tool descriptions\ndescribe the current release, 4.6.0\n(https://projectionlab.com/help/projectionlab-v5-early-access-guide).\n\n## How to use this reference\n\n- **Explain, do not recommend.** Say what a term means, what ProjectionLab does\n with it, and what the user can look at in the app to decide. Do not tell the\n user what to do with their money and do not predict a personal outcome. This\n is information and education, not personalized financial advice; the decision\n belongs to the user and a licensed professional.\n- **Concepts only; ProjectionLab owns the yearly figures.** The app applies the\n current tax brackets, standard deduction, IRMAA tiers, RMD ages, contribution\n limits and ACA subsidies, and the user sees those numbers in the app (Tax\n Analytics). Never state a yearly figure from memory: they change every year.\n Ask the user to read the current one in ProjectionLab.\n\n## Evidence legend\n\nWhen evaluating plan elements or answering user questions, anchor claims with tags:\n- **[EXACT]**: Verified directly from plan JSON via tool inspection or output.\n- **[INFERRED]**: Derived logically from adjacent plan data or standard rule interactions.\n- **[ASSUMPTION]**: A placeholder, default, or external benchmark where plan data is absent.\n\n## ProjectionLab data model (quick map)\n\n- **plans[]**: each plan is a milestone-driven simulation.\n - **milestones[]**: lifecycle events (retirement, Medicare, death) keyed by\n date/year/milestone-relative criteria. Other events reference milestone IDs.\n Retirement and Life Expectancy always exist in the app and its delete\n control is disabled for them, so never remove either one\n (https://projectionlab.com/help/manage-milestones).\n - **income.events[]**: salary, Social Security, pension, inheritance; start/end\n reference milestone IDs.\n - **expenses.events[]**: living, travel, healthcare, LTC; carry a\n `spendingType` (essential vs discretionary).\n - **accounts.events[]**: investment accounts with `rothConversions`\n schedules, withdrawal rules, and bond/equity allocation glidepaths. A custom\n growth or dividend rate on one account covers its stock portion only; the\n bonds there follow the plan-level bond settings unless that account's bond\n allocation is 0%\n (https://projectionlab.com/help/growth-dividend-settings-chance-of-success).\n - **assets.events[]**: real estate, vehicles with appreciation/depreciation.\n - **variables**: tax settings, inflation, returns, drawdown order, IRMAA,\n estate config.\n - **withdrawalStrategy**: a separate mode, not the plan's normal drawdown\n policy. From the year or milestone it starts, its rule replaces most other\n plan events, such as expenses and asset purchases, so most plans leave it\n off (https://projectionlab.com/help/withdrawal-strategy-mode).\n - **montecarlo**: Chance of Success settings (review only; cannot be run\n remotely). Chance of Success runs many trials over historical market periods\n by default, with randomized (Monte Carlo) sampling as an option\n (https://projectionlab.com/help/plan-vs-chance-of-success).\n - **priorities.events[]**: savings contribution ordering. An \"Always Fund\"\n flow is paid even when income falls short: ProjectionLab sells from other\n accounts to cover it (https://projectionlab.com/help/mandatory-goals).\n- **today / currentFinances**: actual account balances; `accountId` links these\n to plan `accounts.events[]`.\n- Chance of Success trials and projection *math* run only in the ProjectionLab\n UI. This server reads/writes the plan definition; it does not compute\n projections.\n\n## Plan-change outcome metrics\n\nEvaluate a plan change primarily with ProjectionLab's projected ending net worth\nand Chance of Success from a completed simulation. Current Finances net worth is\nan input balance sheet, not an outcome. Mutation before/after values verify that\nthe requested input changed; they do not measure its financial impact. The\nPlugin API currently does not expose a supported calculation/result method, so\nrecalculate both outcomes in the UI after applying a change.\n\n## Account tax vocabulary\n\nUse three words for every account, and use them consistently:\n\n- **taxable**: funded with after-tax money; interest, dividends and gains are\n taxed in the year they are received.\n- **tax-deferred**: traditional 401(k) and IRA. Contributions lower taxable\n income now; withdrawals are taxed as ordinary income later.\n- **tax-free**: Roth accounts, and an HSA spent on healthcare. Qualified\n withdrawals are not taxed.\n\nDo not use \"pre-tax\" or \"post-tax\" as account names; they blur the line between\ntax-deferred and taxable.\n\n## Core FIRE / decumulation concepts\n\n- **Safe Withdrawal Rate (SWR)**: the share of the portfolio taken out in the\n first year of drawdown. The classic \"4% rule\" (Trinity study) is a starting\n heuristic for a 30-year horizon, not a guarantee; a longer horizon argues for\n a lower start. The portfolio withdrawal a plan needs falls as guaranteed\n income (Social Security, pension) switches on.\n- **Sequence-of-returns risk**: poor returns in the first years of drawdown do\n far more damage than the same returns later. Common mitigations: a cash/bond\n bridge, and a **rising-equity glidepath** (\"bond tent\" - most bonds at\n retirement, equity rising after).\n- **Asset location**: which account holds which asset. A common convention\n places bonds in tax-deferred accounts, high-growth equity in tax-free (Roth,\n HSA) accounts, and tax-efficient equity and cash in taxable. Location changes\n after-tax return without changing the overall allocation.\n- **Roth conversion**: moving money from a tax-deferred account into a tax-free\n one. The converted amount is taxed as ordinary income in the year of the\n conversion. A \"Roth conversion ladder\" converts in low-income years (often\n the window after work ends and before Social Security or RMDs start) to fill\n a low bracket, lower later RMDs, and shrink the taxable estate. Paying that\n year's tax from a taxable account rather than from withholding keeps more\n money inside the tax-free account.\n\n## Tax concepts that gate conversions\n\nOnly the shape of each rule is here. ProjectionLab computes with the\ncurrent-year figures, and the user reads them in Tax Analytics. MAGI means\nmodified adjusted gross income; each program (ACA, IRMAA, NIIT) defines it\nslightly differently.\n\n- **Federal income tax brackets**: ordinary income is taxed in bands. Income\n that fills an unused low band is cheap; income pushed into the next band\n costs more. What a conversion costs depends on where it lands.\n- **ACA premium subsidies**: marketplace health coverage is income-tested. In\n some income ranges extra income can cut a subsidy faster than tax does, so\n the effective marginal rate in those pre-Medicare years is higher than the\n bracket alone suggests. Not a factor with employer, retiree or other\n non-marketplace coverage.\n- **IRMAA**: an extra charge on Medicare Part B and Part D premiums. It is set\n by the person's MAGI from two years earlier and comes in tiers, so income\n just over a tier boundary pays the whole higher charge. A conversion in one\n year can raise premiums two years later. If the user is already on Medicare\n when the plan starts, ProjectionLab estimates that lookback income in the\n first two plan years, and the actual rule applies from year 3\n (https://projectionlab.com/help/modeling-irmaa-surcharges).\n- **NIIT (net investment income tax)**: a surtax on investment income (gains,\n dividends, interest, rent) once MAGI is above an income threshold. It raises\n the cost of a year that mixes a conversion with investment income.\n- **Long-term capital gains rate**: while taxable income stays under a\n threshold, long-term gains are taxed at 0%. A low-income year can realize\n some gains at no tax cost before that room is gone.\n- **RMDs (Required Minimum Distributions)**: once a person reaches the RMD age,\n tax-deferred accounts require a withdrawal every year, whether or not the\n cash is needed. A large tax-deferred balance can push those forced\n withdrawals into higher brackets and IRMAA tiers, which is the usual reason\n people convert while their income is still low.\n\n## Analysis checklist\n\n1. Build a lifecycle timeline (phase, date range, milestone trigger).\n2. Cash flow by phase; flag pure-drawdown years and the gap before Social\n Security starts.\n3. Withdrawal rate now and after guaranteed income begins.\n4. Sequence risk: what a poor-return start does to the plan. Only a run in the\n ProjectionLab UI can show it.\n5. Roth conversion efficiency: bracket headroom versus the ACA, IRMAA and NIIT\n ceilings; compare lifetime taxes and net legacy, not just the tax now.\n6. Longevity: does the plan last well past life expectancy?\n7. Inflation: healthcare and long-term care costs rise with inflation and are\n often decades out; check how the plan assumes them.\n\n## ProjectionLab help articles\n\nProjectionLab's own pages, linked for the user and summarized here for a model\nwith no web access. The bracketed tag is the plan section or area this reference\nuses for it. The summaries are ours, not ProjectionLab's wording. Glossary of\nfinancial terms: https://projectionlab.com/financial-terms\n\n- **Withdrawal Strategy mode** [withdrawalStrategy]\n https://projectionlab.com/help/withdrawal-strategy-mode - a comparison mode\n for classic rules (initial percentage, variable percentage withdrawal,\n Guyton-Klinger) that starts at a chosen year or milestone. While it is on,\n its rule replaces most other plan events, so most plans leave it off.\n- **Flows, the cash flow priorities** [priorities]\n https://projectionlab.com/help/cash-flow-priorities - Flows (the\n `priorities` section in the data) send income to savings goals,\n contributions, extra debt payments and transfers, earliest-added first.\n- **Mandatory goals (\"Always Fund\")** [priorities]\n https://projectionlab.com/help/mandatory-goals - an Always Fund flow is paid\n ahead of the other flows, selling from other accounts when income falls short.\n- **Milestones** [milestones]\n https://projectionlab.com/help/manage-milestones - lifecycle markers\n triggered by age, date, balance, or a combination of criteria; other events\n anchor their start and end to them. Retirement and Life Expectancy cannot be\n deleted.\n- **Drawdown order** [variables; the chart is app only]\n https://projectionlab.com/help/drawdown-order-visualization - the order\n accounts are liquidated in to cover a yearly shortfall. The graph and its red\n early-withdrawal penalty line are a UI view of that order.\n- **Roth conversions** [accounts; the optimizer is app only]\n https://projectionlab.com/help/roth-conversion - Optimize searches conversion\n strategies against brackets, IRMAA and legacy goals with a beam search, then\n writes the chosen schedule into the plan's accounts. This server can read and\n edit such a schedule; it cannot run the search.\n- **Bond allocation and location** [accounts, variables]\n https://projectionlab.com/help/bond-allocation-and-overrides - the bond\n percentage is set plan-wide and can be overridden per account, and the other\n accounts adjust to keep the plan-wide target, with a warning when it cannot\n balance. Bond location chooses which accounts hold bonds first.\n- **Custom growth and dividend rates** [accounts]\n https://projectionlab.com/help/growth-dividend-settings-chance-of-success - an\n account's custom growth or dividend rate covers its stock portion; the bond\n portion follows the plan's bond settings unless the account's bond allocation\n is overridden to 0%. In Chance of Success such a rate is either held fixed or\n sampled like the rest of the simulation.\n- **IRMAA surcharges** [variables; the optimizer is app only]\n https://projectionlab.com/help/modeling-irmaa-surcharges - tiered Medicare\n Part B and Part D surcharges set by MAGI two years earlier, where crossing a\n tier by any amount costs the whole surcharge. When the user is already on\n Medicare at plan start, ProjectionLab estimates the lookback income for the\n first two plan years.\n- **Plan vs Chance of Success** [montecarlo; results are app only]\n https://projectionlab.com/help/plan-vs-chance-of-success - the Plan tab is one\n fixed path at fixed growth; Chance of Success runs many trials over historical\n or randomized market data. All other tabs follow the Plan tab, not the trial\n outcomes.\n- **Simulation engine** [app only]\n https://projectionlab.com/help/simulation-engine - the app simulates a full\n year at a time (income, withholding, expenses, debt, dividends, prior-year\n taxes, RMDs) and turns a surplus into savings and a shortfall into\n withdrawals.\n- **Flexible spending** [expenses; the feature is app only]\n https://projectionlab.com/help/flex-spending - an optional rule that raises\n or cuts spending with portfolio performance against earlier all-time highs,\n scoped either to all spending or to discretionary expenses only.\n- **Plugins and external accounts** [Current Finances; app only]\n https://projectionlab.com/help/plugins - ProjectionLab does not link to banks;\n plugins (Lunch Money, YNAB, Monarch, or your own code) write balances into\n Current Finances through the Plugin API, which has to be enabled in account\n settings. This server uses that same API.\n";
5
+ export declare const KNOWLEDGE = "# ProjectionLab & FIRE Reference\n\nCurated concepts for analyzing retirement plans through this MCP server.\n\nProjectionLab v5 is in early access; this reference and the tool descriptions\ndescribe the current release, 4.6.0\n(https://projectionlab.com/help/projectionlab-v5-early-access-guide).\n\n## How to use this reference\n\n- **Explain, do not recommend.** Say what a term means, what ProjectionLab does\n with it, and what the user can look at in the app to decide. Do not tell the\n user what to do with their money and do not predict a personal outcome. This\n is information and education, not personalized financial advice; the decision\n belongs to the user and a licensed professional.\n- **Concepts only; ProjectionLab owns the yearly figures.** The app applies the\n current tax brackets, standard deduction, IRMAA tiers, RMD ages, contribution\n limits and ACA subsidies, and the user sees those numbers in the app (Tax\n Analytics). Never state a yearly figure from memory: they change every year.\n Ask the user to read the current one in ProjectionLab.\n\n## Evidence legend\n\nWhen evaluating plan elements or answering user questions, anchor claims with tags:\n- **[EXACT]**: Verified directly from plan JSON via tool inspection or output.\n- **[INFERRED]**: Derived logically from adjacent plan data or standard rule interactions.\n- **[ASSUMPTION]**: A placeholder, default, or external benchmark where plan data is absent.\n\n## ProjectionLab data model (quick map)\n\n- **plans[]**: each plan is a milestone-driven simulation.\n - **milestones[]**: lifecycle events (retirement, Medicare, death) keyed by\n date/year/milestone-relative criteria. Other events reference milestone IDs.\n Retirement and Life Expectancy always exist in the app and its delete\n control is disabled for them, so never remove either one\n (https://projectionlab.com/help/manage-milestones).\n - **income.events[]**: salary, Social Security, pension, inheritance; start/end\n reference milestone IDs.\n - **expenses.events[]**: living, travel, healthcare, LTC; carry a\n `spendingType` (essential vs discretionary).\n - **accounts.events[]**: investment accounts with `rothConversions`\n schedules, withdrawal rules, and bond/equity allocation glidepaths. A custom\n growth or dividend rate on one account covers its stock portion only; the\n bonds there follow the plan-level bond settings unless that account's bond\n allocation is 0%\n (https://projectionlab.com/help/growth-dividend-settings-chance-of-success).\n - **assets.events[]**: real estate, vehicles with appreciation/depreciation.\n - **variables**: tax settings, inflation, returns, drawdown order, IRMAA,\n estate config.\n - **withdrawalStrategy**: a separate mode, not the plan's normal drawdown\n policy. From the year or milestone it starts, its rule replaces most other\n plan events, such as expenses and asset purchases, so most plans leave it\n off (https://projectionlab.com/help/withdrawal-strategy-mode).\n - **montecarlo**: Chance of Success settings (review only; cannot be run\n remotely). Chance of Success runs many trials over historical market periods\n by default, with randomized (Monte Carlo) sampling as an option\n (https://projectionlab.com/help/plan-vs-chance-of-success).\n - **priorities.events[]**: savings contribution ordering. An \"Always Fund\"\n flow is paid even when income falls short: ProjectionLab sells from other\n accounts to cover it (https://projectionlab.com/help/mandatory-goals).\n- **today / currentFinances**: actual account balances; `accountId` links these\n to plan `accounts.events[]`.\n- Chance of Success trials and projection *math* run only in the ProjectionLab\n UI. This server reads/writes the plan definition; it does not compute\n projections.\n\n## Plan-change outcome metrics\n\nEvaluate a plan change primarily with ProjectionLab's projected ending net worth\nand Chance of Success from a completed simulation. Current Finances net worth is\nan input balance sheet, not an outcome. Mutation before/after values verify that\nthe requested input changed; they do not measure its financial impact. The\nPlugin API currently does not expose a supported calculation/result method, so\nrecalculate both outcomes in the UI after applying a change.\n\n## Account tax vocabulary\n\nUse three words for every account, and use them consistently:\n\n- **taxable**: funded with after-tax money; interest, dividends and gains are\n taxed in the year they are received.\n- **tax-deferred**: traditional 401(k) and IRA. Contributions lower taxable\n income now; withdrawals are taxed as ordinary income later.\n- **tax-free**: Roth accounts, and an HSA spent on healthcare. Qualified\n withdrawals are not taxed.\n\nDo not use \"pre-tax\" or \"post-tax\" as account names; they blur the line between\ntax-deferred and taxable.\n\n## Core FIRE / decumulation concepts\n\n- **Safe Withdrawal Rate (SWR)**: the share of the portfolio taken out in the\n first year of drawdown. The classic \"4% rule\" (Trinity study) is a starting\n heuristic for a 30-year horizon, not a guarantee; a longer horizon argues for\n a lower start. The portfolio withdrawal a plan needs falls as guaranteed\n income (Social Security, pension) switches on.\n- **Sequence-of-returns risk**: poor returns in the first years of drawdown do\n far more damage than the same returns later. Common mitigations: a cash/bond\n bridge, and a **rising-equity glidepath** (\"bond tent\" - most bonds at\n retirement, equity rising after).\n- **Asset location**: which account holds which asset. A common convention\n places bonds in tax-deferred accounts, high-growth equity in tax-free (Roth,\n HSA) accounts, and tax-efficient equity and cash in taxable. Location changes\n after-tax return without changing the overall allocation.\n- **Roth conversion**: moving money from a tax-deferred account into a tax-free\n one. The converted amount is taxed as ordinary income in the year of the\n conversion. A \"Roth conversion ladder\" converts in low-income years (often\n the window after work ends and before Social Security or RMDs start) to fill\n a low bracket, lower later RMDs, and shrink the taxable estate. Paying that\n year's tax from a taxable account rather than from withholding keeps more\n money inside the tax-free account.\n\n## Tax concepts that gate conversions\n\nOnly the shape of each rule is here. ProjectionLab computes with the\ncurrent-year figures, and the user reads them in Tax Analytics. MAGI means\nmodified adjusted gross income; each program (ACA, IRMAA, NIIT) defines it\nslightly differently.\n\n- **Federal income tax brackets**: ordinary income is taxed in bands. Income\n that fills an unused low band is cheap; income pushed into the next band\n costs more. What a conversion costs depends on where it lands.\n- **ACA premium subsidies**: marketplace health coverage is income-tested. In\n some income ranges extra income can cut a subsidy faster than tax does, so\n the effective marginal rate in those pre-Medicare years is higher than the\n bracket alone suggests. Not a factor with employer, retiree or other\n non-marketplace coverage.\n- **IRMAA**: an extra charge on Medicare Part B and Part D premiums. It is set\n by the person's MAGI from two years earlier and comes in tiers, so income\n just over a tier boundary pays the whole higher charge. A conversion in one\n year can raise premiums two years later. If the user is already on Medicare\n when the plan starts, ProjectionLab estimates that lookback income in the\n first two plan years, and the actual rule applies from year 3\n (https://projectionlab.com/help/modeling-irmaa-surcharges).\n- **NIIT (net investment income tax)**: a surtax on investment income (gains,\n dividends, interest, rent) once MAGI is above an income threshold. It raises\n the cost of a year that mixes a conversion with investment income.\n- **Long-term capital gains rate**: while taxable income stays under a\n threshold, long-term gains are taxed at 0%. A low-income year can realize\n some gains at no tax cost before that room is gone.\n- **RMDs (Required Minimum Distributions)**: once a person reaches the RMD age,\n tax-deferred accounts require a withdrawal every year, whether or not the\n cash is needed. A large tax-deferred balance can push those forced\n withdrawals into higher brackets and IRMAA tiers, which is the usual reason\n people convert while their income is still low.\n\n## Analysis checklist\n\n1. Build a lifecycle timeline (phase, date range, milestone trigger).\n2. Cash flow by phase; flag pure-drawdown years and the gap before Social\n Security starts.\n3. Withdrawal rate now and after guaranteed income begins.\n4. Sequence risk: what a poor-return start does to the plan. Only a run in the\n ProjectionLab UI can show it.\n5. Roth conversion efficiency: bracket headroom versus the ACA, IRMAA and NIIT\n ceilings; compare lifetime taxes and net legacy, not just the tax now.\n6. Longevity: does the plan last well past life expectancy?\n7. Inflation: healthcare and long-term care costs rise with inflation and are\n often decades out; check how the plan assumes them.\n\n## ProjectionLab help articles\n\nProjectionLab's own pages, linked for the user and summarized here for a model\nwith no web access. The bracketed tag is the plan section or area this reference\nuses for it. The summaries are ours, not ProjectionLab's wording. Glossary of\nfinancial terms: https://projectionlab.com/financial-terms\n\n- **Withdrawal Strategy mode** [withdrawalStrategy]\n https://projectionlab.com/help/withdrawal-strategy-mode - a comparison mode\n for classic rules (initial percentage, variable percentage withdrawal,\n Guyton-Klinger) that starts at a chosen year or milestone. While it is on,\n its rule replaces most other plan events, so most plans leave it off.\n- **Flows, the cash flow priorities** [priorities]\n https://projectionlab.com/help/cash-flow-priorities - Flows (the\n `priorities` section in the data) send income to savings goals,\n contributions, extra debt payments and transfers, earliest-added first.\n- **Mandatory goals (\"Always Fund\")** [priorities]\n https://projectionlab.com/help/mandatory-goals - an Always Fund flow is paid\n ahead of the other flows, selling from other accounts when income falls short.\n- **Milestones** [milestones]\n https://projectionlab.com/help/manage-milestones - lifecycle markers\n triggered by age, date, balance, or a combination of criteria; other events\n anchor their start and end to them. Retirement and Life Expectancy cannot be\n deleted.\n- **Drawdown order** [variables; the chart is app only]\n https://projectionlab.com/help/drawdown-order-visualization - the order\n accounts are liquidated in to cover a yearly shortfall. The graph and its red\n early-withdrawal penalty line are a UI view of that order.\n- **Roth conversions** [accounts; the optimizer is app only]\n https://projectionlab.com/help/roth-conversion - Optimize searches conversion\n strategies against brackets, IRMAA and legacy goals with a beam search, then\n writes the chosen schedule into the plan's accounts. This server can read and\n edit such a schedule; it cannot run the search.\n- **Bond allocation and location** [accounts, variables]\n https://projectionlab.com/help/bond-allocation-and-overrides - the bond\n percentage is set plan-wide and can be overridden per account, and the other\n accounts adjust to keep the plan-wide target, with a warning when it cannot\n balance. Bond location chooses which accounts hold bonds first.\n- **Custom growth and dividend rates** [accounts]\n https://projectionlab.com/help/growth-dividend-settings-chance-of-success - an\n account's custom growth or dividend rate covers its stock portion; the bond\n portion follows the plan's bond settings unless the account's bond allocation\n is overridden to 0%. In Chance of Success such a rate is either held fixed or\n sampled like the rest of the simulation.\n- **IRMAA surcharges** [variables; the optimizer is app only]\n https://projectionlab.com/help/modeling-irmaa-surcharges - tiered Medicare\n Part B and Part D surcharges set by MAGI two years earlier, where crossing a\n tier by any amount costs the whole surcharge. When the user is already on\n Medicare at plan start, ProjectionLab estimates the lookback income for the\n first two plan years.\n- **Plan vs Chance of Success** [montecarlo; results are app only]\n https://projectionlab.com/help/plan-vs-chance-of-success - the Plan tab is one\n fixed path at fixed growth; Chance of Success runs many trials over historical\n or randomized market data. All other tabs follow the Plan tab, not the trial\n outcomes.\n- **Simulation engine** [app only]\n https://projectionlab.com/help/simulation-engine - the app simulates a full\n year at a time (income, withholding, expenses, debt, dividends, prior-year\n taxes, RMDs) and turns a surplus into savings and a shortfall into\n withdrawals.\n- **Flexible spending** [expenses; the feature is app only]\n https://projectionlab.com/help/flex-spending - an optional rule that raises\n or cuts spending with portfolio performance against earlier all-time highs,\n scoped either to all spending or to discretionary expenses only.\n- **Plugins and external accounts** [Current Finances; app only]\n https://projectionlab.com/help/plugins - ProjectionLab does not link to banks;\n plugins (Lunch Money, YNAB, Monarch, or your own code) write balances into\n Current Finances through the Plugin API, which has to be enabled in account\n settings. This server uses that same API.\n";
6
+ export declare const KNOWLEDGE_V5 = "# ProjectionLab 5 & FIRE Reference\n\nCurated concepts for analyzing retirement plans through this MCP server on ProjectionLab 5.\n\nProjectionLab 5 operates under Plugin API contract 2, using a multi-document export envelope.\n\n## How to use this reference\n\n- **Explain, do not recommend.** Say what a term means, what ProjectionLab does\n with it, and what the user can look at in the app to decide. Do not tell the\n user what to do with their money and do not predict a personal outcome. This\n is information and education, not personalized financial advice; the decision\n belongs to the user and a licensed professional.\n- **Concepts only; ProjectionLab owns the yearly figures.** The app applies the\n current tax brackets, standard deduction, IRMAA tiers, RMD ages, contribution\n limits and ACA subsidies, and the user sees those numbers in the app (Tax\n Analytics). Never state a yearly figure from memory: they change every year.\n Ask the user to read the current one in ProjectionLab.\n\n## Evidence legend\n\nData model entries for ProjectionLab 5 carry the tag `[export-shape]`, meaning the field and its value type appear in a ProjectionLab 5 export; its meaning is not yet confirmed by a stored-value test.\n\nWhen evaluating plan elements or answering user questions, anchor claims with tags:\n- **[EXACT]**: Verified directly from plan JSON via tool inspection or output.\n- **[INFERRED]**: Derived logically from adjacent plan data or standard rule interactions.\n- **[ASSUMPTION]**: A placeholder, default, or external benchmark where plan data is absent.\n\n## ProjectionLab 5 data model (quick map)\n\n- **Root envelope**: `{ schema: 1, exportedAt, documents: { currentFinances, plans, settings, accountHistory } }`.\n Each document carries its own internal `schema` version.\n- **documents.currentFinances**: actual financial state and baseline balance sheet.\n - **household**: member demographics under `household.people.me` and `household.people.spouse`,\n with partnership filing status under `household.partnerStatus`.\n - **accounts**: all financial accounts, debts, and real property, stored as a map keyed by account ID.\n - Each record carries a `kind` discriminator: `\"account\"` (cash, investment, and retirement accounts\n with `balance` and `costBasis`), `\"debt\"` (liabilities with `balance` and optional `securedByAssetId`),\n or `\"real-asset\"` (physical property with `value` and `purchasePrice`).\n - Archived accounts carry an `archivedOn` ISO date string.\n - Supported account types: the Solo 401k, Roth Solo 401k, and SEP IRA account types store as\n `\"401k\"` or `\"roth-401k\"` with `subtype: \"solo\"`, and `\"ira\"` with `subtype: \"sep\"`.\n Observed type strings include `\"taxable\"`, `\"401k\"`, `\"savings\"`, `\"land\"`, and `\"secured-loan\"`.\n- **documents.plans[]**: milestone-driven simulation plans.\n - Plans carry no `active` flag. `settings.plan.activeId` and `settings.plan.baselineId` are\n reported as stored; no plan is treated as the selected plan.\n - Every plan event item carries a `kind` discriminator: `\"account\"`, `\"real-asset\"`,\n `\"income\"`, `\"expense\"`, or `\"priority\"`.\n - Timing for event start and end is defined by structured objects:\n `{ type: \"date\" | \"milestone\" | \"keyword\", value, modifier? }`.\n - **milestones[]**: lifecycle events (retirement, Medicare, death) triggered by date, year, age,\n or milestone-relative criteria. Other events anchor timing to milestone IDs.\n - **income.events[]**: salary, pensions, social security, other income.\n - **expenses.events[]**: living expenses carrying a `spendingType` (`\"essential\"` vs `\"discretionary\"`).\n - **accounts.events[]**: plan investment accounts, linking to Current Finances via `accountId`.\n - **assets.events[]**: real estate and physical assets with appreciation and depreciation, linking\n to Current Finances via `assetId`.\n - **variables**: tax settings, inflation, returns, drawdown order, IRMAA, estate rules.\n - **withdrawalStrategy**: alternative withdrawal policy mode (such as fixed percentage or Guyton-Klinger).\n - **montecarlo**: Chance of Success simulation parameters.\n - **priorities.events[]**: savings contribution ordering and cash flow routing. A priority's\n `accountId` is the id of the plan account event it routes cash to, not a Current Finances account id.\n - Event names need not be unique within a section; address an event by id when its name is ambiguous.\n- **documents.settings**:\n - **plan**: viewing preferences including `activeId` and `baselineId` (reported as stored),\n the account's year alignment (`alignment.type`: `\"calendar\"`, `\"rolling\"`, `\"au-tax\"`,\n `\"uk-tax\"` or `\"custom\"`), and pinned tabs. A plan can override the alignment in\n `variables.alignment`; null or absent means it follows the account.\n - **plugins**: plugin configuration with `enabled` status and `apiKey` (authentication secret,\n redacted on reads; sits at `documents.settings.plugins.apiKey`).\n- **documents.accountHistory**:\n - End-of-year balances, tax cost basis, and asset values tracked by account ID and calendar year\n under `documents.accountHistory.<accountId>.<year>`. Replaces the separate progress section.\n- Simulation math and Chance of Success trials run only in the ProjectionLab UI.\n This server reads the plan and financial definitions; it does not compute projections.\n\n## Plan-change outcome metrics\n\nEvaluate a plan change primarily with ProjectionLab's projected ending net worth\nand Chance of Success from a completed simulation. Current Finances net worth is\nan input balance sheet, not an outcome. Mutation before/after values verify that\nthe requested input changed; they do not measure its financial impact. The\nPlugin API currently does not expose a supported calculation/result method, so\nrecalculate both outcomes in the UI after applying a change.\n\n## Account tax vocabulary\n\nUse three words for every account, and use them consistently:\n\n- **taxable**: funded with after-tax money; interest, dividends and gains are\n taxed in the year they are received.\n- **tax-deferred**: traditional 401(k) and IRA. Contributions lower taxable\n income now; withdrawals are taxed as ordinary income later.\n- **tax-free**: Roth accounts, and an HSA spent on healthcare. Qualified\n withdrawals are not taxed.\n\nDo not use \"pre-tax\" or \"post-tax\" as account names; they blur the line between\ntax-deferred and taxable.\n\n## Core FIRE / decumulation concepts\n\n- **Safe Withdrawal Rate (SWR)**: the share of the portfolio taken out in the\n first year of drawdown. The classic \"4% rule\" (Trinity study) is a starting\n heuristic for a 30-year horizon, not a guarantee; a longer horizon argues for\n a lower start. The portfolio withdrawal a plan needs falls as guaranteed\n income (Social Security, pension) switches on.\n- **Sequence-of-returns risk**: poor returns in the first years of drawdown do\n far more damage than the same returns later. Common mitigations: a cash/bond\n bridge, and a **rising-equity glidepath** (\"bond tent\" - most bonds at\n retirement, equity rising after).\n- **Asset location**: which account holds which asset. A common convention\n places bonds in tax-deferred accounts, high-growth equity in tax-free (Roth,\n HSA) accounts, and tax-efficient equity and cash in taxable. Location changes\n after-tax return without changing the overall allocation.\n- **Roth conversion**: moving money from a tax-deferred account into a tax-free\n one. The converted amount is taxed as ordinary income in the year of the\n conversion. A \"Roth conversion ladder\" converts in low-income years (often\n the window after work ends and before Social Security or RMDs start) to fill\n a low bracket, lower later RMDs, and shrink the taxable estate. Paying that\n year's tax from a taxable account rather than from withholding keeps more\n money inside the tax-free account.\n\n## Tax concepts that gate conversions\n\nOnly the shape of each rule is here. ProjectionLab computes with the\ncurrent-year figures, and the user reads them in Tax Analytics. MAGI means\nmodified adjusted gross income; each program (ACA, IRMAA, NIIT) defines it\nslightly differently.\n\n- **Federal income tax brackets**: ordinary income is taxed in bands. Income\n that fills an unused low band is cheap; income pushed into the next band\n costs more. What a conversion costs depends on where it lands.\n- **ACA premium subsidies**: marketplace health coverage is income-tested. In\n some income ranges extra income can cut a subsidy faster than tax does, so\n the effective marginal rate in those pre-Medicare years is higher than the\n bracket alone suggests. Not a factor with employer, retiree or other\n non-marketplace coverage.\n- **IRMAA**: an extra charge on Medicare Part B and Part D premiums. It is set\n by the person's MAGI from two years earlier and comes in tiers, so income\n just over a tier boundary pays the whole higher charge. A conversion in one\n year can raise premiums two years later. If the user is already on Medicare\n when the plan starts, ProjectionLab estimates that lookback income in the\n first two plan years, and the actual rule applies from year 3\n (https://projectionlab.com/help/modeling-irmaa-surcharges).\n- **NIIT (net investment income tax)**: a surtax on investment income (gains,\n dividends, interest, rent) once MAGI is above an income threshold. It raises\n the cost of a year that mixes a conversion with investment income.\n- **Long-term capital gains rate**: while taxable income stays under a\n threshold, long-term gains are taxed at 0%. A low-income year can realize\n some gains at no tax cost before that room is gone.\n- **RMDs (Required Minimum Distributions)**: once a person reaches the RMD age,\n tax-deferred accounts require a withdrawal every year, whether or not the\n cash is needed. A large tax-deferred balance can push those forced\n withdrawals into higher brackets and IRMAA tiers, which is the usual reason\n people convert while their income is still low.\n\n## Analysis checklist\n\n1. Build a lifecycle timeline (phase, date range, milestone trigger).\n2. Cash flow by phase; flag pure-drawdown years and the gap before Social\n Security starts.\n3. Withdrawal rate now and after guaranteed income begins.\n4. Sequence risk: what a poor-return start does to the plan. Only a run in the\n ProjectionLab UI can show it.\n5. Roth conversion efficiency: bracket headroom versus the ACA, IRMAA and NIIT\n ceilings; compare lifetime taxes and net legacy, not just the tax now.\n6. Longevity: does the plan last well past life expectancy?\n7. Inflation: healthcare and long-term care costs rise with inflation and are\n often decades out; check how the plan assumes them.\n\n## ProjectionLab help articles\n\nProjectionLab's own pages, linked for the user and summarized here for a model\nwith no web access. The bracketed tag is the plan section or area this reference\nuses for it. The summaries are ours, not ProjectionLab's wording. Glossary of\nfinancial terms: https://projectionlab.com/financial-terms\n\n- **Withdrawal Strategy mode** [withdrawalStrategy]\n https://projectionlab.com/help/withdrawal-strategy-mode - a comparison mode\n for classic rules (initial percentage, variable percentage withdrawal,\n Guyton-Klinger) that starts at a chosen year or milestone. While it is on,\n its rule replaces most other plan events, so most plans leave it off.\n- **Flows, the cash flow priorities** [priorities]\n https://projectionlab.com/help/cash-flow-priorities - Flows (the\n `priorities` section in the data) send income to savings goals,\n contributions, extra debt payments and transfers, earliest-added first.\n- **Mandatory goals (\"Always Fund\")** [priorities]\n https://projectionlab.com/help/mandatory-goals - an Always Fund flow is paid\n ahead of the other flows, selling from other accounts when income falls short.\n- **Milestones** [milestones]\n https://projectionlab.com/help/manage-milestones - lifecycle markers\n triggered by age, date, balance, or a combination of criteria; other events\n anchor their start and end to them. Retirement and Life Expectancy cannot be\n deleted.\n- **Drawdown order** [variables; the chart is app only]\n https://projectionlab.com/help/drawdown-order-visualization - the order\n accounts are liquidated in to cover a yearly shortfall. The graph and its red\n early-withdrawal penalty line are a UI view of that order.\n- **Roth conversions** [accounts; the optimizer is app only]\n https://projectionlab.com/help/roth-conversion - Optimize searches conversion\n strategies against brackets, IRMAA and legacy goals with a beam search, then\n writes the chosen schedule into the plan's accounts. This server can read and\n edit such a schedule; it cannot run the search.\n- **Bond allocation and location** [accounts, variables]\n https://projectionlab.com/help/bond-allocation-and-overrides - the bond\n percentage is set plan-wide and can be overridden per account, and the other\n accounts adjust to keep the plan-wide target, with a warning when it cannot\n balance. Bond location chooses which accounts hold bonds first.\n- **Custom growth and dividend rates** [accounts]\n https://projectionlab.com/help/growth-dividend-settings-chance-of-success - an\n account's custom growth or dividend rate covers its stock portion; the bond\n portion follows the plan's bond settings unless the account's bond allocation\n is overridden to 0%. In Chance of Success such a rate is either held fixed or\n sampled like the rest of the simulation.\n- **IRMAA surcharges** [variables; the optimizer is app only]\n https://projectionlab.com/help/modeling-irmaa-surcharges - tiered Medicare\n Part B and Part D surcharges set by MAGI two years earlier, where crossing a\n tier by any amount costs the whole surcharge. When the user is already on\n Medicare at plan start, ProjectionLab estimates the lookback income for the\n first two plan years.\n- **Plan vs Chance of Success** [montecarlo; results are app only]\n https://projectionlab.com/help/plan-vs-chance-of-success - the Plan tab is one\n fixed path at fixed growth; Chance of Success runs many trials over historical\n or randomized market data. All other tabs follow the Plan tab, not the trial\n outcomes.\n- **Simulation engine** [app only]\n https://projectionlab.com/help/simulation-engine - the app simulates a full\n year at a time (income, withholding, expenses, debt, dividends, prior-year\n taxes, RMDs) and turns a surplus into savings and a shortfall into\n withdrawals.\n- **Flexible spending** [expenses; the feature is app only]\n https://projectionlab.com/help/flex-spending - an optional rule that raises\n or cuts spending with portfolio performance against earlier all-time highs,\n scoped either to all spending or to discretionary expenses only.\n- **Plugins and external accounts** [Current Finances; app only]\n https://projectionlab.com/help/plugins - ProjectionLab does not link to banks;\n plugins (Lunch Money, YNAB, Monarch, or your own code) write balances into\n Current Finances through the Plugin API, which has to be enabled in account\n settings. This server uses that same API.\n";
7
+ export declare function renderKnowledgeMarkdown(layout?: ExportLayout): string;
8
+ export declare function registerKnowledgeResource(server: McpServer, bridge?: Bridge): void;
@@ -1,4 +1,5 @@
1
- const KNOWLEDGE = `# ProjectionLab & FIRE Reference
1
+ import { registerLayoutResource } from "./layoutResource.js";
2
+ export const KNOWLEDGE_V4 = `# ProjectionLab & FIRE Reference
2
3
 
3
4
  Curated concepts for analyzing retirement plans through this MCP server.
4
5
 
@@ -19,6 +20,13 @@ describe the current release, 4.6.0
19
20
  Analytics). Never state a yearly figure from memory: they change every year.
20
21
  Ask the user to read the current one in ProjectionLab.
21
22
 
23
+ ## Evidence legend
24
+
25
+ When evaluating plan elements or answering user questions, anchor claims with tags:
26
+ - **[EXACT]**: Verified directly from plan JSON via tool inspection or output.
27
+ - **[INFERRED]**: Derived logically from adjacent plan data or standard rule interactions.
28
+ - **[ASSUMPTION]**: A placeholder, default, or external benchmark where plan data is absent.
29
+
22
30
  ## ProjectionLab data model (quick map)
23
31
 
24
32
  - **plans[]**: each plan is a milestone-driven simulation.
@@ -221,22 +229,262 @@ financial terms: https://projectionlab.com/financial-terms
221
229
  Current Finances through the Plugin API, which has to be enabled in account
222
230
  settings. This server uses that same API.
223
231
  `;
224
- export function registerKnowledgeResource(server) {
225
- server.registerResource("knowledge", "projectionlab://knowledge", {
232
+ export const KNOWLEDGE = KNOWLEDGE_V4;
233
+ export const KNOWLEDGE_V5 = `# ProjectionLab 5 & FIRE Reference
234
+
235
+ Curated concepts for analyzing retirement plans through this MCP server on ProjectionLab 5.
236
+
237
+ ProjectionLab 5 operates under Plugin API contract 2, using a multi-document export envelope.
238
+
239
+ ## How to use this reference
240
+
241
+ - **Explain, do not recommend.** Say what a term means, what ProjectionLab does
242
+ with it, and what the user can look at in the app to decide. Do not tell the
243
+ user what to do with their money and do not predict a personal outcome. This
244
+ is information and education, not personalized financial advice; the decision
245
+ belongs to the user and a licensed professional.
246
+ - **Concepts only; ProjectionLab owns the yearly figures.** The app applies the
247
+ current tax brackets, standard deduction, IRMAA tiers, RMD ages, contribution
248
+ limits and ACA subsidies, and the user sees those numbers in the app (Tax
249
+ Analytics). Never state a yearly figure from memory: they change every year.
250
+ Ask the user to read the current one in ProjectionLab.
251
+
252
+ ## Evidence legend
253
+
254
+ Data model entries for ProjectionLab 5 carry the tag \`[export-shape]\`, meaning the field and its value type appear in a ProjectionLab 5 export; its meaning is not yet confirmed by a stored-value test.
255
+
256
+ When evaluating plan elements or answering user questions, anchor claims with tags:
257
+ - **[EXACT]**: Verified directly from plan JSON via tool inspection or output.
258
+ - **[INFERRED]**: Derived logically from adjacent plan data or standard rule interactions.
259
+ - **[ASSUMPTION]**: A placeholder, default, or external benchmark where plan data is absent.
260
+
261
+ ## ProjectionLab 5 data model (quick map)
262
+
263
+ - **Root envelope**: \`{ schema: 1, exportedAt, documents: { currentFinances, plans, settings, accountHistory } }\`.
264
+ Each document carries its own internal \`schema\` version.
265
+ - **documents.currentFinances**: actual financial state and baseline balance sheet.
266
+ - **household**: member demographics under \`household.people.me\` and \`household.people.spouse\`,
267
+ with partnership filing status under \`household.partnerStatus\`.
268
+ - **accounts**: all financial accounts, debts, and real property, stored as a map keyed by account ID.
269
+ - Each record carries a \`kind\` discriminator: \`"account"\` (cash, investment, and retirement accounts
270
+ with \`balance\` and \`costBasis\`), \`"debt"\` (liabilities with \`balance\` and optional \`securedByAssetId\`),
271
+ or \`"real-asset"\` (physical property with \`value\` and \`purchasePrice\`).
272
+ - Archived accounts carry an \`archivedOn\` ISO date string.
273
+ - Supported account types: the Solo 401k, Roth Solo 401k, and SEP IRA account types store as
274
+ \`"401k"\` or \`"roth-401k"\` with \`subtype: "solo"\`, and \`"ira"\` with \`subtype: "sep"\`.
275
+ Observed type strings include \`"taxable"\`, \`"401k"\`, \`"savings"\`, \`"land"\`, and \`"secured-loan"\`.
276
+ - **documents.plans[]**: milestone-driven simulation plans.
277
+ - Plans carry no \`active\` flag. \`settings.plan.activeId\` and \`settings.plan.baselineId\` are
278
+ reported as stored; no plan is treated as the selected plan.
279
+ - Every plan event item carries a \`kind\` discriminator: \`"account"\`, \`"real-asset"\`,
280
+ \`"income"\`, \`"expense"\`, or \`"priority"\`.
281
+ - Timing for event start and end is defined by structured objects:
282
+ \`{ type: "date" | "milestone" | "keyword", value, modifier? }\`.
283
+ - **milestones[]**: lifecycle events (retirement, Medicare, death) triggered by date, year, age,
284
+ or milestone-relative criteria. Other events anchor timing to milestone IDs.
285
+ - **income.events[]**: salary, pensions, social security, other income.
286
+ - **expenses.events[]**: living expenses carrying a \`spendingType\` (\`"essential"\` vs \`"discretionary"\`).
287
+ - **accounts.events[]**: plan investment accounts, linking to Current Finances via \`accountId\`.
288
+ - **assets.events[]**: real estate and physical assets with appreciation and depreciation, linking
289
+ to Current Finances via \`assetId\`.
290
+ - **variables**: tax settings, inflation, returns, drawdown order, IRMAA, estate rules.
291
+ - **withdrawalStrategy**: alternative withdrawal policy mode (such as fixed percentage or Guyton-Klinger).
292
+ - **montecarlo**: Chance of Success simulation parameters.
293
+ - **priorities.events[]**: savings contribution ordering and cash flow routing. A priority's
294
+ \`accountId\` is the id of the plan account event it routes cash to, not a Current Finances account id.
295
+ - Event names need not be unique within a section; address an event by id when its name is ambiguous.
296
+ - **documents.settings**:
297
+ - **plan**: viewing preferences including \`activeId\` and \`baselineId\` (reported as stored),
298
+ the account's year alignment (\`alignment.type\`: \`"calendar"\`, \`"rolling"\`, \`"au-tax"\`,
299
+ \`"uk-tax"\` or \`"custom"\`), and pinned tabs. A plan can override the alignment in
300
+ \`variables.alignment\`; null or absent means it follows the account.
301
+ - **plugins**: plugin configuration with \`enabled\` status and \`apiKey\` (authentication secret,
302
+ redacted on reads; sits at \`documents.settings.plugins.apiKey\`).
303
+ - **documents.accountHistory**:
304
+ - End-of-year balances, tax cost basis, and asset values tracked by account ID and calendar year
305
+ under \`documents.accountHistory.<accountId>.<year>\`. Replaces the separate progress section.
306
+ - Simulation math and Chance of Success trials run only in the ProjectionLab UI.
307
+ This server reads the plan and financial definitions; it does not compute projections.
308
+
309
+ ## Plan-change outcome metrics
310
+
311
+ Evaluate a plan change primarily with ProjectionLab's projected ending net worth
312
+ and Chance of Success from a completed simulation. Current Finances net worth is
313
+ an input balance sheet, not an outcome. Mutation before/after values verify that
314
+ the requested input changed; they do not measure its financial impact. The
315
+ Plugin API currently does not expose a supported calculation/result method, so
316
+ recalculate both outcomes in the UI after applying a change.
317
+
318
+ ## Account tax vocabulary
319
+
320
+ Use three words for every account, and use them consistently:
321
+
322
+ - **taxable**: funded with after-tax money; interest, dividends and gains are
323
+ taxed in the year they are received.
324
+ - **tax-deferred**: traditional 401(k) and IRA. Contributions lower taxable
325
+ income now; withdrawals are taxed as ordinary income later.
326
+ - **tax-free**: Roth accounts, and an HSA spent on healthcare. Qualified
327
+ withdrawals are not taxed.
328
+
329
+ Do not use "pre-tax" or "post-tax" as account names; they blur the line between
330
+ tax-deferred and taxable.
331
+
332
+ ## Core FIRE / decumulation concepts
333
+
334
+ - **Safe Withdrawal Rate (SWR)**: the share of the portfolio taken out in the
335
+ first year of drawdown. The classic "4% rule" (Trinity study) is a starting
336
+ heuristic for a 30-year horizon, not a guarantee; a longer horizon argues for
337
+ a lower start. The portfolio withdrawal a plan needs falls as guaranteed
338
+ income (Social Security, pension) switches on.
339
+ - **Sequence-of-returns risk**: poor returns in the first years of drawdown do
340
+ far more damage than the same returns later. Common mitigations: a cash/bond
341
+ bridge, and a **rising-equity glidepath** ("bond tent" - most bonds at
342
+ retirement, equity rising after).
343
+ - **Asset location**: which account holds which asset. A common convention
344
+ places bonds in tax-deferred accounts, high-growth equity in tax-free (Roth,
345
+ HSA) accounts, and tax-efficient equity and cash in taxable. Location changes
346
+ after-tax return without changing the overall allocation.
347
+ - **Roth conversion**: moving money from a tax-deferred account into a tax-free
348
+ one. The converted amount is taxed as ordinary income in the year of the
349
+ conversion. A "Roth conversion ladder" converts in low-income years (often
350
+ the window after work ends and before Social Security or RMDs start) to fill
351
+ a low bracket, lower later RMDs, and shrink the taxable estate. Paying that
352
+ year's tax from a taxable account rather than from withholding keeps more
353
+ money inside the tax-free account.
354
+
355
+ ## Tax concepts that gate conversions
356
+
357
+ Only the shape of each rule is here. ProjectionLab computes with the
358
+ current-year figures, and the user reads them in Tax Analytics. MAGI means
359
+ modified adjusted gross income; each program (ACA, IRMAA, NIIT) defines it
360
+ slightly differently.
361
+
362
+ - **Federal income tax brackets**: ordinary income is taxed in bands. Income
363
+ that fills an unused low band is cheap; income pushed into the next band
364
+ costs more. What a conversion costs depends on where it lands.
365
+ - **ACA premium subsidies**: marketplace health coverage is income-tested. In
366
+ some income ranges extra income can cut a subsidy faster than tax does, so
367
+ the effective marginal rate in those pre-Medicare years is higher than the
368
+ bracket alone suggests. Not a factor with employer, retiree or other
369
+ non-marketplace coverage.
370
+ - **IRMAA**: an extra charge on Medicare Part B and Part D premiums. It is set
371
+ by the person's MAGI from two years earlier and comes in tiers, so income
372
+ just over a tier boundary pays the whole higher charge. A conversion in one
373
+ year can raise premiums two years later. If the user is already on Medicare
374
+ when the plan starts, ProjectionLab estimates that lookback income in the
375
+ first two plan years, and the actual rule applies from year 3
376
+ (https://projectionlab.com/help/modeling-irmaa-surcharges).
377
+ - **NIIT (net investment income tax)**: a surtax on investment income (gains,
378
+ dividends, interest, rent) once MAGI is above an income threshold. It raises
379
+ the cost of a year that mixes a conversion with investment income.
380
+ - **Long-term capital gains rate**: while taxable income stays under a
381
+ threshold, long-term gains are taxed at 0%. A low-income year can realize
382
+ some gains at no tax cost before that room is gone.
383
+ - **RMDs (Required Minimum Distributions)**: once a person reaches the RMD age,
384
+ tax-deferred accounts require a withdrawal every year, whether or not the
385
+ cash is needed. A large tax-deferred balance can push those forced
386
+ withdrawals into higher brackets and IRMAA tiers, which is the usual reason
387
+ people convert while their income is still low.
388
+
389
+ ## Analysis checklist
390
+
391
+ 1. Build a lifecycle timeline (phase, date range, milestone trigger).
392
+ 2. Cash flow by phase; flag pure-drawdown years and the gap before Social
393
+ Security starts.
394
+ 3. Withdrawal rate now and after guaranteed income begins.
395
+ 4. Sequence risk: what a poor-return start does to the plan. Only a run in the
396
+ ProjectionLab UI can show it.
397
+ 5. Roth conversion efficiency: bracket headroom versus the ACA, IRMAA and NIIT
398
+ ceilings; compare lifetime taxes and net legacy, not just the tax now.
399
+ 6. Longevity: does the plan last well past life expectancy?
400
+ 7. Inflation: healthcare and long-term care costs rise with inflation and are
401
+ often decades out; check how the plan assumes them.
402
+
403
+ ## ProjectionLab help articles
404
+
405
+ ProjectionLab's own pages, linked for the user and summarized here for a model
406
+ with no web access. The bracketed tag is the plan section or area this reference
407
+ uses for it. The summaries are ours, not ProjectionLab's wording. Glossary of
408
+ financial terms: https://projectionlab.com/financial-terms
409
+
410
+ - **Withdrawal Strategy mode** [withdrawalStrategy]
411
+ https://projectionlab.com/help/withdrawal-strategy-mode - a comparison mode
412
+ for classic rules (initial percentage, variable percentage withdrawal,
413
+ Guyton-Klinger) that starts at a chosen year or milestone. While it is on,
414
+ its rule replaces most other plan events, so most plans leave it off.
415
+ - **Flows, the cash flow priorities** [priorities]
416
+ https://projectionlab.com/help/cash-flow-priorities - Flows (the
417
+ \`priorities\` section in the data) send income to savings goals,
418
+ contributions, extra debt payments and transfers, earliest-added first.
419
+ - **Mandatory goals ("Always Fund")** [priorities]
420
+ https://projectionlab.com/help/mandatory-goals - an Always Fund flow is paid
421
+ ahead of the other flows, selling from other accounts when income falls short.
422
+ - **Milestones** [milestones]
423
+ https://projectionlab.com/help/manage-milestones - lifecycle markers
424
+ triggered by age, date, balance, or a combination of criteria; other events
425
+ anchor their start and end to them. Retirement and Life Expectancy cannot be
426
+ deleted.
427
+ - **Drawdown order** [variables; the chart is app only]
428
+ https://projectionlab.com/help/drawdown-order-visualization - the order
429
+ accounts are liquidated in to cover a yearly shortfall. The graph and its red
430
+ early-withdrawal penalty line are a UI view of that order.
431
+ - **Roth conversions** [accounts; the optimizer is app only]
432
+ https://projectionlab.com/help/roth-conversion - Optimize searches conversion
433
+ strategies against brackets, IRMAA and legacy goals with a beam search, then
434
+ writes the chosen schedule into the plan's accounts. This server can read and
435
+ edit such a schedule; it cannot run the search.
436
+ - **Bond allocation and location** [accounts, variables]
437
+ https://projectionlab.com/help/bond-allocation-and-overrides - the bond
438
+ percentage is set plan-wide and can be overridden per account, and the other
439
+ accounts adjust to keep the plan-wide target, with a warning when it cannot
440
+ balance. Bond location chooses which accounts hold bonds first.
441
+ - **Custom growth and dividend rates** [accounts]
442
+ https://projectionlab.com/help/growth-dividend-settings-chance-of-success - an
443
+ account's custom growth or dividend rate covers its stock portion; the bond
444
+ portion follows the plan's bond settings unless the account's bond allocation
445
+ is overridden to 0%. In Chance of Success such a rate is either held fixed or
446
+ sampled like the rest of the simulation.
447
+ - **IRMAA surcharges** [variables; the optimizer is app only]
448
+ https://projectionlab.com/help/modeling-irmaa-surcharges - tiered Medicare
449
+ Part B and Part D surcharges set by MAGI two years earlier, where crossing a
450
+ tier by any amount costs the whole surcharge. When the user is already on
451
+ Medicare at plan start, ProjectionLab estimates the lookback income for the
452
+ first two plan years.
453
+ - **Plan vs Chance of Success** [montecarlo; results are app only]
454
+ https://projectionlab.com/help/plan-vs-chance-of-success - the Plan tab is one
455
+ fixed path at fixed growth; Chance of Success runs many trials over historical
456
+ or randomized market data. All other tabs follow the Plan tab, not the trial
457
+ outcomes.
458
+ - **Simulation engine** [app only]
459
+ https://projectionlab.com/help/simulation-engine - the app simulates a full
460
+ year at a time (income, withholding, expenses, debt, dividends, prior-year
461
+ taxes, RMDs) and turns a surplus into savings and a shortfall into
462
+ withdrawals.
463
+ - **Flexible spending** [expenses; the feature is app only]
464
+ https://projectionlab.com/help/flex-spending - an optional rule that raises
465
+ or cuts spending with portfolio performance against earlier all-time highs,
466
+ scoped either to all spending or to discretionary expenses only.
467
+ - **Plugins and external accounts** [Current Finances; app only]
468
+ https://projectionlab.com/help/plugins - ProjectionLab does not link to banks;
469
+ plugins (Lunch Money, YNAB, Monarch, or your own code) write balances into
470
+ Current Finances through the Plugin API, which has to be enabled in account
471
+ settings. This server uses that same API.
472
+ `;
473
+ export function renderKnowledgeMarkdown(layout = "v4") {
474
+ return layout === "v5" ? KNOWLEDGE_V5 : KNOWLEDGE_V4;
475
+ }
476
+ export function registerKnowledgeResource(server, bridge) {
477
+ registerLayoutResource(server, bridge, {
478
+ name: "knowledge",
479
+ uri: "projectionlab://knowledge",
226
480
  title: "ProjectionLab & FIRE Knowledge",
227
481
  description: "Curated reference: ProjectionLab data model, FIRE/decumulation concepts, " +
228
482
  "retirement tax concepts without yearly figures, an analysis checklist, and an " +
229
- "index of ProjectionLab help articles. Static; information and education, not " +
483
+ "index of ProjectionLab help articles, for the connected ProjectionLab version once a " +
484
+ "connection check has run (ProjectionLab 4 before that; append ?layout=v4 or ?layout=v5 " +
485
+ "to choose). Information and education, not " +
230
486
  "personalized financial advice.",
231
- mimeType: "text/markdown",
232
- }, async (uri) => ({
233
- contents: [
234
- {
235
- uri: uri.href,
236
- text: KNOWLEDGE,
237
- mimeType: "text/markdown",
238
- },
239
- ],
240
- }));
487
+ render: renderKnowledgeMarkdown,
488
+ });
241
489
  }
242
490
  //# sourceMappingURL=knowledge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"knowledge.js","sourceRoot":"","sources":["../../src/resources/knowledge.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8NjB,CAAC;AAEF,MAAM,UAAU,yBAAyB,CAAC,MAAiB;IACzD,MAAM,CAAC,gBAAgB,CACrB,WAAW,EACX,2BAA2B,EAC3B;QACE,KAAK,EAAE,gCAAgC;QACvC,WAAW,EACT,2EAA2E;YAC3E,gFAAgF;YACh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ACvD,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,MAAiB,EAAE,MAAe;IAC1E,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE;QACrC,IAAI,EAAE,WAAW;QACjB,GAAG,EAAE,2BAA2B;QAChC,KAAK,EAAE,gCAAgC;QACvC,WAAW,EACT,2EAA2E;YAC3E,gFAAgF;YAChF,uFAAuF;YACvF,yFAAyF;YACzF,6CAA6C;YAC7C,gCAAgC;QAClC,MAAM,EAAE,uBAAuB;KAChC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { type McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { Bridge } from "../bridge.js";
3
+ import { type ExportLayout } from "../layout.js";
4
+ export interface LayoutResourceSpec {
5
+ name: string;
6
+ uri: string;
7
+ title: string;
8
+ description: string;
9
+ render: (layout: ExportLayout) => string;
10
+ }
11
+ /**
12
+ * Registers a markdown resource whose text follows the ProjectionLab layout.
13
+ *
14
+ * The plain URI is a fixed resource, so it is listed and read by exact match.
15
+ * `<uri>?layout=v4` and `<uri>?layout=v5` are served by a URI template beside
16
+ * it, because the SDK reads a fixed resource only when the requested URI
17
+ * matches it exactly, query string included.
18
+ */
19
+ export declare function registerLayoutResource(server: McpServer, bridge: Bridge | undefined, spec: LayoutResourceSpec): void;