@dizzlkheinz/ynab-mcpb 0.18.3 → 0.19.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/CHANGELOG.md +17 -0
- package/CLAUDE.md +87 -8
- package/bin/ynab-mcp-server.cjs +2 -2
- package/bin/ynab-mcp-server.js +3 -3
- package/biome.json +39 -0
- package/dist/bundle/index.cjs +67 -67
- package/dist/index.d.ts +1 -1
- package/dist/index.js +27 -27
- package/dist/server/YNABMCPServer.d.ts +3 -4
- package/dist/server/YNABMCPServer.js +111 -116
- package/dist/server/budgetResolver.d.ts +6 -5
- package/dist/server/budgetResolver.js +46 -36
- package/dist/server/cacheKeys.js +6 -6
- package/dist/server/cacheManager.js +14 -11
- package/dist/server/completions.d.ts +2 -2
- package/dist/server/completions.js +20 -15
- package/dist/server/config.d.ts +10 -5
- package/dist/server/config.js +24 -7
- package/dist/server/deltaCache.d.ts +2 -2
- package/dist/server/deltaCache.js +22 -16
- package/dist/server/deltaCache.merge.d.ts +2 -2
- package/dist/server/diagnostics.d.ts +4 -4
- package/dist/server/diagnostics.js +38 -32
- package/dist/server/errorHandler.d.ts +5 -12
- package/dist/server/errorHandler.js +219 -217
- package/dist/server/prompts.d.ts +2 -2
- package/dist/server/prompts.js +45 -45
- package/dist/server/rateLimiter.js +4 -4
- package/dist/server/requestLogger.d.ts +1 -1
- package/dist/server/requestLogger.js +40 -35
- package/dist/server/resources.d.ts +3 -3
- package/dist/server/resources.js +55 -52
- package/dist/server/responseFormatter.js +6 -6
- package/dist/server/securityMiddleware.d.ts +2 -2
- package/dist/server/securityMiddleware.js +22 -20
- package/dist/server/serverKnowledgeStore.js +1 -1
- package/dist/server/toolRegistry.d.ts +3 -3
- package/dist/server/toolRegistry.js +47 -40
- package/dist/tools/__tests__/deltaTestUtils.d.ts +3 -3
- package/dist/tools/__tests__/deltaTestUtils.js +2 -2
- package/dist/tools/accountTools.d.ts +9 -8
- package/dist/tools/accountTools.js +47 -47
- package/dist/tools/adapters.d.ts +13 -8
- package/dist/tools/adapters.js +21 -11
- package/dist/tools/budgetTools.d.ts +8 -7
- package/dist/tools/budgetTools.js +22 -22
- package/dist/tools/categoryTools.d.ts +9 -8
- package/dist/tools/categoryTools.js +68 -59
- package/dist/tools/compareTransactions/formatter.d.ts +3 -3
- package/dist/tools/compareTransactions/formatter.js +9 -9
- package/dist/tools/compareTransactions/index.d.ts +6 -6
- package/dist/tools/compareTransactions/index.js +58 -43
- package/dist/tools/compareTransactions/matcher.d.ts +1 -1
- package/dist/tools/compareTransactions/matcher.js +28 -15
- package/dist/tools/compareTransactions/parser.d.ts +2 -2
- package/dist/tools/compareTransactions/parser.js +144 -138
- package/dist/tools/compareTransactions/types.d.ts +4 -4
- package/dist/tools/compareTransactions.d.ts +1 -1
- package/dist/tools/compareTransactions.js +1 -1
- package/dist/tools/deltaFetcher.d.ts +2 -2
- package/dist/tools/deltaFetcher.js +16 -15
- package/dist/tools/deltaSupport.d.ts +4 -4
- package/dist/tools/deltaSupport.js +35 -41
- package/dist/tools/exportTransactions.d.ts +5 -4
- package/dist/tools/exportTransactions.js +61 -59
- package/dist/tools/monthTools.d.ts +7 -6
- package/dist/tools/monthTools.js +31 -29
- package/dist/tools/payeeTools.d.ts +7 -6
- package/dist/tools/payeeTools.js +28 -28
- package/dist/tools/reconcileAdapter.d.ts +2 -2
- package/dist/tools/reconcileAdapter.js +21 -11
- package/dist/tools/reconciliation/analyzer.d.ts +4 -4
- package/dist/tools/reconciliation/analyzer.js +136 -57
- package/dist/tools/reconciliation/csvParser.d.ts +3 -3
- package/dist/tools/reconciliation/csvParser.js +128 -104
- package/dist/tools/reconciliation/executor.d.ts +4 -4
- package/dist/tools/reconciliation/executor.js +148 -109
- package/dist/tools/reconciliation/index.d.ts +10 -10
- package/dist/tools/reconciliation/index.js +96 -83
- package/dist/tools/reconciliation/matcher.d.ts +3 -3
- package/dist/tools/reconciliation/matcher.js +17 -16
- package/dist/tools/reconciliation/payeeNormalizer.js +19 -8
- package/dist/tools/reconciliation/recommendationEngine.d.ts +1 -1
- package/dist/tools/reconciliation/recommendationEngine.js +40 -40
- package/dist/tools/reconciliation/reportFormatter.d.ts +2 -2
- package/dist/tools/reconciliation/reportFormatter.js +79 -54
- package/dist/tools/reconciliation/signDetector.d.ts +1 -1
- package/dist/tools/reconciliation/types.d.ts +19 -16
- package/dist/tools/reconciliation/ynabAdapter.d.ts +2 -2
- package/dist/tools/schemas/common.d.ts +1 -1
- package/dist/tools/schemas/common.js +1 -1
- package/dist/tools/schemas/outputs/accountOutputs.d.ts +1 -1
- package/dist/tools/schemas/outputs/accountOutputs.js +24 -18
- package/dist/tools/schemas/outputs/budgetOutputs.d.ts +1 -1
- package/dist/tools/schemas/outputs/budgetOutputs.js +14 -11
- package/dist/tools/schemas/outputs/categoryOutputs.d.ts +1 -1
- package/dist/tools/schemas/outputs/categoryOutputs.js +49 -29
- package/dist/tools/schemas/outputs/comparisonOutputs.d.ts +1 -1
- package/dist/tools/schemas/outputs/comparisonOutputs.js +12 -12
- package/dist/tools/schemas/outputs/index.d.ts +14 -14
- package/dist/tools/schemas/outputs/index.js +14 -14
- package/dist/tools/schemas/outputs/monthOutputs.d.ts +1 -1
- package/dist/tools/schemas/outputs/monthOutputs.js +56 -41
- package/dist/tools/schemas/outputs/payeeOutputs.d.ts +1 -1
- package/dist/tools/schemas/outputs/payeeOutputs.js +10 -10
- package/dist/tools/schemas/outputs/reconciliationOutputs.d.ts +2 -2
- package/dist/tools/schemas/outputs/reconciliationOutputs.js +45 -45
- package/dist/tools/schemas/outputs/transactionMutationOutputs.d.ts +1 -1
- package/dist/tools/schemas/outputs/transactionMutationOutputs.js +28 -22
- package/dist/tools/schemas/outputs/transactionOutputs.d.ts +1 -1
- package/dist/tools/schemas/outputs/transactionOutputs.js +43 -35
- package/dist/tools/schemas/outputs/utilityOutputs.d.ts +1 -1
- package/dist/tools/schemas/outputs/utilityOutputs.js +5 -3
- package/dist/tools/schemas/shared/commonOutputs.d.ts +1 -1
- package/dist/tools/schemas/shared/commonOutputs.js +15 -9
- package/dist/tools/transactionReadTools.d.ts +11 -0
- package/dist/tools/transactionReadTools.js +202 -0
- package/dist/tools/transactionSchemas.d.ts +309 -0
- package/dist/tools/transactionSchemas.js +235 -0
- package/dist/tools/transactionTools.d.ts +6 -302
- package/dist/tools/transactionTools.js +7 -2054
- package/dist/tools/transactionUtils.d.ts +31 -0
- package/dist/tools/transactionUtils.js +364 -0
- package/dist/tools/transactionWriteTools.d.ts +20 -0
- package/dist/tools/transactionWriteTools.js +1342 -0
- package/dist/tools/utilityTools.d.ts +5 -4
- package/dist/tools/utilityTools.js +11 -11
- package/dist/types/index.d.ts +7 -7
- package/dist/types/index.js +6 -6
- package/dist/types/reconciliation.d.ts +1 -1
- package/dist/types/toolRegistration.d.ts +14 -12
- package/dist/utils/amountUtils.js +1 -1
- package/dist/utils/dateUtils.js +4 -4
- package/dist/utils/errors.d.ts +3 -3
- package/dist/utils/errors.js +4 -4
- package/dist/utils/money.d.ts +2 -2
- package/dist/utils/money.js +8 -8
- package/dist/utils/validationError.d.ts +1 -1
- package/dist/utils/validationError.js +1 -1
- package/docs/assets/examples/reconciliation-with-recommendations.json +66 -66
- package/docs/assets/schemas/reconciliation-v2.json +360 -336
- package/docs/plans/2025-12-25-transaction-tools-refactor-design.md +211 -0
- package/docs/plans/2025-12-25-transaction-tools-refactor.md +905 -0
- package/esbuild.config.mjs +53 -50
- package/meta.json +12548 -12548
- package/package.json +98 -109
- package/scripts/analyze-bundle.mjs +33 -30
- package/scripts/create-pr-description.js +169 -120
- package/scripts/run-all-tests.js +205 -0
- package/scripts/run-domain-integration-tests.js +28 -18
- package/scripts/run-generate-mcpb.js +19 -17
- package/scripts/run-throttled-integration-tests.js +92 -83
- package/scripts/test-delta-params.mjs +149 -120
- package/scripts/test-recommendations.ts +36 -32
- package/scripts/tmpTransaction.ts +80 -43
- package/scripts/validate-env.js +98 -91
- package/scripts/verify-build.js +78 -76
- package/src/__tests__/comprehensive.integration.test.ts +1281 -1154
- package/src/__tests__/performance.test.ts +723 -671
- package/src/__tests__/setup.ts +442 -395
- package/src/__tests__/smoke.e2e.test.ts +41 -39
- package/src/__tests__/testRunner.ts +314 -295
- package/src/__tests__/testUtils.ts +456 -364
- package/src/__tests__/tools/reconciliation/csvParser.integration.test.ts +109 -107
- package/src/__tests__/tools/reconciliation/real-world.integration.test.ts +41 -41
- package/src/index.ts +68 -59
- package/src/server/CLAUDE.md +480 -0
- package/src/server/YNABMCPServer.ts +821 -794
- package/src/server/__tests__/YNABMCPServer.integration.test.ts +929 -893
- package/src/server/__tests__/YNABMCPServer.test.ts +903 -899
- package/src/server/__tests__/budgetResolver.test.ts +466 -423
- package/src/server/__tests__/cacheManager.test.ts +891 -874
- package/src/server/__tests__/completions.integration.test.ts +115 -106
- package/src/server/__tests__/completions.test.ts +334 -313
- package/src/server/__tests__/config.test.ts +98 -86
- package/src/server/__tests__/deltaCache.merge.test.ts +774 -703
- package/src/server/__tests__/deltaCache.swr.test.ts +198 -153
- package/src/server/__tests__/deltaCache.test.ts +946 -759
- package/src/server/__tests__/diagnostics.test.ts +825 -792
- package/src/server/__tests__/errorHandler.integration.test.ts +512 -462
- package/src/server/__tests__/errorHandler.test.ts +402 -397
- package/src/server/__tests__/prompts.test.ts +424 -347
- package/src/server/__tests__/rateLimiter.test.ts +313 -309
- package/src/server/__tests__/requestLogger.test.ts +443 -403
- package/src/server/__tests__/resources.template.test.ts +196 -185
- package/src/server/__tests__/resources.test.ts +294 -288
- package/src/server/__tests__/security.integration.test.ts +487 -421
- package/src/server/__tests__/securityMiddleware.test.ts +519 -444
- package/src/server/__tests__/server-startup.integration.test.ts +509 -490
- package/src/server/__tests__/serverKnowledgeStore.test.ts +174 -173
- package/src/server/__tests__/toolRegistration.test.ts +239 -210
- package/src/server/__tests__/toolRegistry.test.ts +907 -845
- package/src/server/budgetResolver.ts +221 -181
- package/src/server/cacheKeys.ts +6 -6
- package/src/server/cacheManager.ts +498 -484
- package/src/server/completions.ts +267 -243
- package/src/server/config.ts +35 -14
- package/src/server/deltaCache.merge.ts +146 -128
- package/src/server/deltaCache.ts +352 -309
- package/src/server/diagnostics.ts +257 -242
- package/src/server/errorHandler.ts +747 -744
- package/src/server/prompts.ts +181 -176
- package/src/server/rateLimiter.ts +131 -129
- package/src/server/requestLogger.ts +350 -322
- package/src/server/resources.ts +442 -374
- package/src/server/responseFormatter.ts +41 -37
- package/src/server/securityMiddleware.ts +223 -205
- package/src/server/serverKnowledgeStore.ts +67 -67
- package/src/server/toolRegistry.ts +508 -474
- package/src/tools/CLAUDE.md +604 -0
- package/src/tools/__tests__/accountTools.delta.integration.test.ts +128 -111
- package/src/tools/__tests__/accountTools.integration.test.ts +129 -111
- package/src/tools/__tests__/accountTools.test.ts +685 -638
- package/src/tools/__tests__/adapters.test.ts +142 -108
- package/src/tools/__tests__/budgetTools.delta.integration.test.ts +73 -73
- package/src/tools/__tests__/budgetTools.integration.test.ts +132 -124
- package/src/tools/__tests__/budgetTools.test.ts +442 -413
- package/src/tools/__tests__/categoryTools.delta.integration.test.ts +76 -68
- package/src/tools/__tests__/categoryTools.integration.test.ts +314 -288
- package/src/tools/__tests__/categoryTools.test.ts +656 -625
- package/src/tools/__tests__/compareTransactions/formatter.test.ts +535 -462
- package/src/tools/__tests__/compareTransactions/index.test.ts +378 -358
- package/src/tools/__tests__/compareTransactions/matcher.test.ts +497 -398
- package/src/tools/__tests__/compareTransactions/parser.test.ts +765 -747
- package/src/tools/__tests__/compareTransactions.test.ts +352 -332
- package/src/tools/__tests__/compareTransactions.window.test.ts +150 -146
- package/src/tools/__tests__/deltaFetcher.scheduled.integration.test.ts +69 -65
- package/src/tools/__tests__/deltaFetcher.test.ts +325 -265
- package/src/tools/__tests__/deltaSupport.test.ts +211 -184
- package/src/tools/__tests__/deltaTestUtils.ts +37 -33
- package/src/tools/__tests__/exportTransactions.test.ts +205 -200
- package/src/tools/__tests__/monthTools.delta.integration.test.ts +68 -68
- package/src/tools/__tests__/monthTools.integration.test.ts +178 -166
- package/src/tools/__tests__/monthTools.test.ts +561 -512
- package/src/tools/__tests__/payeeTools.delta.integration.test.ts +68 -68
- package/src/tools/__tests__/payeeTools.integration.test.ts +158 -142
- package/src/tools/__tests__/payeeTools.test.ts +486 -434
- package/src/tools/__tests__/transactionSchemas.test.ts +1204 -0
- package/src/tools/__tests__/transactionTools.integration.test.ts +875 -825
- package/src/tools/__tests__/transactionTools.test.ts +4923 -4366
- package/src/tools/__tests__/transactionUtils.test.ts +1016 -0
- package/src/tools/__tests__/utilityTools.integration.test.ts +32 -32
- package/src/tools/__tests__/utilityTools.test.ts +68 -58
- package/src/tools/accountTools.ts +293 -271
- package/src/tools/adapters.ts +120 -63
- package/src/tools/budgetTools.ts +121 -116
- package/src/tools/categoryTools.ts +379 -339
- package/src/tools/compareTransactions/formatter.ts +131 -119
- package/src/tools/compareTransactions/index.ts +249 -214
- package/src/tools/compareTransactions/matcher.ts +259 -209
- package/src/tools/compareTransactions/parser.ts +517 -487
- package/src/tools/compareTransactions/types.ts +38 -38
- package/src/tools/compareTransactions.ts +1 -1
- package/src/tools/deltaFetcher.ts +281 -260
- package/src/tools/deltaSupport.ts +264 -259
- package/src/tools/exportTransactions.ts +230 -218
- package/src/tools/monthTools.ts +180 -165
- package/src/tools/payeeTools.ts +152 -140
- package/src/tools/reconcileAdapter.ts +297 -246
- package/src/tools/reconciliation/CLAUDE.md +506 -0
- package/src/tools/reconciliation/__tests__/adapter.causes.test.ts +135 -112
- package/src/tools/reconciliation/__tests__/adapter.test.ts +249 -227
- package/src/tools/reconciliation/__tests__/analyzer.test.ts +408 -335
- package/src/tools/reconciliation/__tests__/csvParser.test.ts +71 -69
- package/src/tools/reconciliation/__tests__/executor.integration.test.ts +348 -323
- package/src/tools/reconciliation/__tests__/executor.progress.test.ts +503 -457
- package/src/tools/reconciliation/__tests__/executor.test.ts +898 -831
- package/src/tools/reconciliation/__tests__/matcher.test.ts +667 -663
- package/src/tools/reconciliation/__tests__/payeeNormalizer.test.ts +296 -276
- package/src/tools/reconciliation/__tests__/recommendationEngine.integration.test.ts +692 -624
- package/src/tools/reconciliation/__tests__/recommendationEngine.test.ts +1008 -986
- package/src/tools/reconciliation/__tests__/reconciliation.delta.integration.test.ts +187 -146
- package/src/tools/reconciliation/__tests__/reportFormatter.test.ts +583 -530
- package/src/tools/reconciliation/__tests__/scenarios/adapterCurrency.scenario.test.ts +75 -71
- package/src/tools/reconciliation/__tests__/scenarios/extremes.scenario.test.ts +70 -58
- package/src/tools/reconciliation/__tests__/scenarios/repeatAmount.scenario.test.ts +102 -88
- package/src/tools/reconciliation/__tests__/schemaUrl.test.ts +58 -43
- package/src/tools/reconciliation/__tests__/signDetector.test.ts +209 -206
- package/src/tools/reconciliation/__tests__/ynabAdapter.test.ts +66 -60
- package/src/tools/reconciliation/analyzer.ts +582 -406
- package/src/tools/reconciliation/csvParser.ts +656 -609
- package/src/tools/reconciliation/executor.ts +1290 -1128
- package/src/tools/reconciliation/index.ts +580 -528
- package/src/tools/reconciliation/matcher.ts +256 -240
- package/src/tools/reconciliation/payeeNormalizer.ts +92 -78
- package/src/tools/reconciliation/recommendationEngine.ts +357 -345
- package/src/tools/reconciliation/reportFormatter.ts +349 -276
- package/src/tools/reconciliation/signDetector.ts +89 -83
- package/src/tools/reconciliation/types.ts +164 -153
- package/src/tools/reconciliation/ynabAdapter.ts +17 -15
- package/src/tools/schemas/CLAUDE.md +546 -0
- package/src/tools/schemas/common.ts +1 -1
- package/src/tools/schemas/outputs/__tests__/accountOutputs.test.ts +410 -409
- package/src/tools/schemas/outputs/__tests__/budgetOutputs.test.ts +305 -299
- package/src/tools/schemas/outputs/__tests__/categoryOutputs.test.ts +431 -430
- package/src/tools/schemas/outputs/__tests__/comparisonOutputs.test.ts +510 -495
- package/src/tools/schemas/outputs/__tests__/dateValidation.test.ts +179 -153
- package/src/tools/schemas/outputs/__tests__/discrepancyDirection.test.ts +293 -254
- package/src/tools/schemas/outputs/__tests__/monthOutputs.test.ts +457 -457
- package/src/tools/schemas/outputs/__tests__/payeeOutputs.test.ts +362 -356
- package/src/tools/schemas/outputs/__tests__/reconciliationOutputs.test.ts +402 -399
- package/src/tools/schemas/outputs/__tests__/transactionMutationSchemas.test.ts +225 -211
- package/src/tools/schemas/outputs/__tests__/transactionOutputs.test.ts +457 -454
- package/src/tools/schemas/outputs/__tests__/utilityOutputs.test.ts +316 -315
- package/src/tools/schemas/outputs/accountOutputs.ts +40 -34
- package/src/tools/schemas/outputs/budgetOutputs.ts +24 -19
- package/src/tools/schemas/outputs/categoryOutputs.ts +76 -56
- package/src/tools/schemas/outputs/comparisonOutputs.ts +192 -169
- package/src/tools/schemas/outputs/index.ts +163 -163
- package/src/tools/schemas/outputs/monthOutputs.ts +95 -80
- package/src/tools/schemas/outputs/payeeOutputs.ts +18 -18
- package/src/tools/schemas/outputs/reconciliationOutputs.ts +386 -373
- package/src/tools/schemas/outputs/transactionMutationOutputs.ts +259 -231
- package/src/tools/schemas/outputs/transactionOutputs.ts +81 -71
- package/src/tools/schemas/outputs/utilityOutputs.ts +90 -84
- package/src/tools/schemas/shared/commonOutputs.ts +27 -19
- package/src/tools/toolCategories.ts +114 -114
- package/src/tools/transactionReadTools.ts +327 -0
- package/src/tools/transactionSchemas.ts +484 -0
- package/src/tools/transactionTools.ts +107 -2990
- package/src/tools/transactionUtils.ts +621 -0
- package/src/tools/transactionWriteTools.ts +2110 -0
- package/src/tools/utilityTools.ts +46 -41
- package/src/types/CLAUDE.md +477 -0
- package/src/types/__tests__/index.test.ts +51 -51
- package/src/types/index.ts +43 -39
- package/src/types/integration-tests.d.ts +26 -26
- package/src/types/reconciliation.ts +29 -29
- package/src/types/toolAnnotations.ts +30 -30
- package/src/types/toolRegistration.ts +43 -32
- package/src/utils/CLAUDE.md +508 -0
- package/src/utils/__tests__/dateUtils.test.ts +174 -168
- package/src/utils/__tests__/money.test.ts +193 -187
- package/src/utils/amountUtils.ts +5 -5
- package/src/utils/baseError.ts +5 -5
- package/src/utils/dateUtils.ts +29 -26
- package/src/utils/errors.ts +14 -14
- package/src/utils/money.ts +66 -52
- package/src/utils/validationError.ts +1 -1
- package/tsconfig.json +29 -29
- package/tsconfig.prod.json +16 -16
- package/vitest-reporters/split-json-reporter.ts +247 -204
- package/vitest.config.ts +99 -95
- package/.prettierignore +0 -10
- package/.prettierrc.json +0 -10
- package/eslint.config.js +0 -49
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.18.4] - 2025-12-26
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- **Reconciliation Date Range Filtering** - Fix bug where transactions outside the bank statement period were incorrectly flagged as "missing from bank"
|
|
15
|
+
- Now filters YNAB transactions to statement period ± 7 days tolerance before matching
|
|
16
|
+
- New summary fields: `ynab_in_range_count`, `ynab_outside_range_count`
|
|
17
|
+
- Transactions outside the date range are reported separately in `ynab_outside_date_range`
|
|
18
|
+
- Uses `Date.UTC()` for timezone-safe date calculations (prevents off-by-one-day errors)
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- **Code Organization** - Refactored `transactionTools.ts` for better maintainability
|
|
23
|
+
- Extracted Zod schemas to `transactionSchemas.ts` (453 lines)
|
|
24
|
+
- Extracted utility functions to `transactionUtils.ts` (536 lines)
|
|
25
|
+
- Main file reduced from 2,995 to 2,274 lines (24% reduction)
|
|
26
|
+
|
|
10
27
|
## [0.18.3] - 2025-12-24
|
|
11
28
|
|
|
12
29
|
### Fixed
|
package/CLAUDE.md
CHANGED
|
@@ -6,7 +6,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
|
|
6
6
|
|
|
7
7
|
This is a Model Context Protocol (MCP) server for YNAB (You Need A Budget) integration, enabling AI assistants to interact with YNAB budgets, accounts, transactions, and categories. The codebase uses TypeScript with a modular, service-oriented architecture.
|
|
8
8
|
|
|
9
|
-
**Current Version:** 0.
|
|
9
|
+
**Current Version:** 0.19.0
|
|
10
10
|
|
|
11
11
|
## Essential Commands
|
|
12
12
|
|
|
@@ -48,9 +48,9 @@ npm run test:all # Run all tests (unit, integration, e2e, perf
|
|
|
48
48
|
### Code Quality
|
|
49
49
|
|
|
50
50
|
```bash
|
|
51
|
-
npm run lint # Run
|
|
52
|
-
npm run lint:fix # Auto-fix
|
|
53
|
-
npm run format # Format code with
|
|
51
|
+
npm run lint # Run Biome linting
|
|
52
|
+
npm run lint:fix # Auto-fix Biome lint/format issues
|
|
53
|
+
npm run format # Format code with Biome
|
|
54
54
|
npm run format:check # Check formatting without modifying files
|
|
55
55
|
```
|
|
56
56
|
|
|
@@ -72,7 +72,8 @@ The architecture is modular and service-oriented:
|
|
|
72
72
|
### Core Server Components (`src/server/`)
|
|
73
73
|
|
|
74
74
|
- **YNABMCPServer.ts** - Main orchestration server, coordinates all services
|
|
75
|
-
- **toolRegistry.ts** - Centralized tool metadata, validation, and
|
|
75
|
+
- **toolRegistry.ts** - Centralized tool metadata, validation, execution, and progress notification support
|
|
76
|
+
- **completions.ts** - MCP completions manager for autocomplete suggestions (budget_id, account_id, category, payee)
|
|
76
77
|
- **cacheManager.ts** - Enhanced caching with LRU eviction, observability, and stale-while-revalidate
|
|
77
78
|
- **deltaCache.ts** - Delta request management with server knowledge tracking and merge operations
|
|
78
79
|
- **deltaCache.merge.ts** - Entity merging functions for delta responses (transactions, categories, accounts)
|
|
@@ -103,7 +104,9 @@ Tools are organized by domain with some using modular sub-directories:
|
|
|
103
104
|
|
|
104
105
|
- **budgetTools.ts** - Budget listing and retrieval
|
|
105
106
|
- **accountTools.ts** - Account management
|
|
106
|
-
- **transactionTools.ts** - Transaction CRUD operations
|
|
107
|
+
- **transactionTools.ts** - Transaction CRUD operations (v0.18.4: refactored into 3 files)
|
|
108
|
+
- **transactionSchemas.ts** - Transaction Zod schemas (extracted v0.18.4, 453 lines)
|
|
109
|
+
- **transactionUtils.ts** - Transaction utilities and helpers (extracted v0.18.4, 536 lines)
|
|
107
110
|
- **categoryTools.ts** - Category management
|
|
108
111
|
- **payeeTools.ts** - Payee listing and retrieval
|
|
109
112
|
- **monthTools.ts** - Monthly budget data
|
|
@@ -135,12 +138,18 @@ Tools are organized by domain with some using modular sub-directories:
|
|
|
135
138
|
### Type Definitions (`src/types/`)
|
|
136
139
|
|
|
137
140
|
- **index.ts** - Shared types, error classes, server configuration
|
|
141
|
+
- **toolRegistration.ts** - ToolContext, handler signatures (Handler, DeltaHandler, WriteHandler, NoInputHandler)
|
|
142
|
+
- **toolAnnotations.ts** - MCP annotation types and interfaces
|
|
143
|
+
- **reconciliation.ts** - Reconciliation-specific type definitions
|
|
138
144
|
|
|
139
145
|
### Utilities (`src/utils/`)
|
|
140
146
|
|
|
141
147
|
- **money.ts** - Amount conversion (dollars ↔ milliunits)
|
|
142
148
|
- **dateUtils.ts** - Date formatting and validation
|
|
143
149
|
- **amountUtils.ts** - Amount validation and utilities
|
|
150
|
+
- **baseError.ts** - Base error class for custom errors
|
|
151
|
+
- **errors.ts** - Custom error classes and error handling utilities
|
|
152
|
+
- **validationError.ts** - Validation-specific error handling
|
|
144
153
|
|
|
145
154
|
## Key Architecture Patterns
|
|
146
155
|
|
|
@@ -254,6 +263,61 @@ Resource templates allow AI assistants to discover and access YNAB data using UR
|
|
|
254
263
|
|
|
255
264
|
Resources support full caching with configurable TTLs and return structured data that AI assistants can use for analysis and recommendations.
|
|
256
265
|
|
|
266
|
+
## MCP Completions
|
|
267
|
+
|
|
268
|
+
The server provides autocomplete suggestions via MCP completions API to help AI assistants discover available values for tool arguments:
|
|
269
|
+
|
|
270
|
+
### Supported Completions
|
|
271
|
+
|
|
272
|
+
- **budget_id** - Lists all available budget IDs with names
|
|
273
|
+
- **account_id** - Lists account IDs for a specific budget (context-aware)
|
|
274
|
+
- **category** - Lists category names for a specific budget (context-aware)
|
|
275
|
+
- **payee** - Lists payee names for a specific budget (context-aware)
|
|
276
|
+
|
|
277
|
+
### Implementation
|
|
278
|
+
|
|
279
|
+
- **CompletionsManager** class in `src/server/completions.ts`
|
|
280
|
+
- Maximum 100 completions per request
|
|
281
|
+
- Context-aware: uses `budget_id` from prior arguments when available
|
|
282
|
+
- Full caching support with standard TTLs
|
|
283
|
+
- Returns structured completion items with labels and values
|
|
284
|
+
|
|
285
|
+
### Usage Example
|
|
286
|
+
|
|
287
|
+
When an AI assistant requests completions for the `account_id` argument, the server returns a list of accounts for the current budget, allowing the assistant to autocomplete valid account IDs.
|
|
288
|
+
|
|
289
|
+
## Progress Notifications
|
|
290
|
+
|
|
291
|
+
Long-running operations can emit MCP progress notifications to provide real-time feedback during execution:
|
|
292
|
+
|
|
293
|
+
### Implementation
|
|
294
|
+
|
|
295
|
+
- **ProgressCallback** type defined in `src/server/toolRegistry.ts`
|
|
296
|
+
- Optional callback passed to tool handlers via adapter pattern
|
|
297
|
+
- Usage: `await sendProgress?.({ progress, total, message })`
|
|
298
|
+
- Currently used by: `reconcile_account` tool
|
|
299
|
+
|
|
300
|
+
### Progress Notification Pattern
|
|
301
|
+
|
|
302
|
+
```typescript
|
|
303
|
+
// In tool handler
|
|
304
|
+
async function handleLongOperation(
|
|
305
|
+
input: InputType,
|
|
306
|
+
sendProgress?: ProgressCallback
|
|
307
|
+
): Promise<ResultType> {
|
|
308
|
+
// Send progress updates during operation
|
|
309
|
+
await sendProgress?.({
|
|
310
|
+
progress: currentStep,
|
|
311
|
+
total: totalSteps,
|
|
312
|
+
message: 'Processing transactions...',
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### Tools with Progress Support
|
|
318
|
+
|
|
319
|
+
- **reconcile_account** - Reports progress during CSV parsing, matching, and bulk operations
|
|
320
|
+
|
|
257
321
|
## Tool Annotations
|
|
258
322
|
|
|
259
323
|
All tools include MCP-compliant annotations as advisory hints for AI clients. These annotations follow the Model Context Protocol specification and help AI assistants understand tool capabilities, safety characteristics, and expected behavior. The annotation system uses type-safe presets defined in `src/tools/toolCategories.ts` via the `ToolAnnotationPresets` constant.
|
|
@@ -398,6 +462,10 @@ Optional (Output):
|
|
|
398
462
|
- `YNAB_MCP_MINIFY_OUTPUT` (default: true) - Minify JSON responses
|
|
399
463
|
- `YNAB_MCP_PRETTY_SPACES` (default: 2) - Spaces for pretty-print when not minified
|
|
400
464
|
|
|
465
|
+
Optional (Delta):
|
|
466
|
+
|
|
467
|
+
- `YNAB_MCP_ENABLE_DELTA` (default: `"true"`) - Enable delta request caching (`"true"` or `"false"`)
|
|
468
|
+
|
|
401
469
|
Optional (Export):
|
|
402
470
|
|
|
403
471
|
- `YNAB_EXPORT_PATH` - Directory for exported files (default: ~/Downloads or ~/Documents)
|
|
@@ -421,8 +489,7 @@ Strict mode enabled with extensive safety checks:
|
|
|
421
489
|
|
|
422
490
|
## Code Style & Linting
|
|
423
491
|
|
|
424
|
-
- **
|
|
425
|
-
- **Prettier**: Auto-formatting for consistent style
|
|
492
|
+
- **Biome**: Linting + formatting for TypeScript/JavaScript
|
|
426
493
|
- **Import Style**: Use `.js` extensions in imports (ES modules)
|
|
427
494
|
- **Naming**: camelCase for functions/variables, PascalCase for classes/types
|
|
428
495
|
|
|
@@ -470,6 +537,7 @@ The reconciliation tool (`reconcile_account`) is a comprehensive account reconci
|
|
|
470
537
|
- **Executor** - Handles bulk create/update/unclear operations with comprehensive error handling
|
|
471
538
|
- **Recommendation Engine** - Provides smart reconciliation suggestions
|
|
472
539
|
- **Sign Detector** - Auto-detects debit/credit sign conventions from CSV data
|
|
540
|
+
- **Date Range Filtering** (v0.18.4) - Filters YNAB transactions to statement period to prevent false "missing from bank" matches
|
|
473
541
|
|
|
474
542
|
### Configuration
|
|
475
543
|
|
|
@@ -478,6 +546,17 @@ The reconciliation tool (`reconcile_account`) is a comprehensive account reconci
|
|
|
478
546
|
- Scoring weights: amount 50%, payee 35%, date 15%
|
|
479
547
|
- Auto-match threshold: 85%
|
|
480
548
|
|
|
549
|
+
### Date Range Filtering (v0.18.4)
|
|
550
|
+
|
|
551
|
+
The reconciliation system now filters YNAB transactions to only those within the statement date range:
|
|
552
|
+
|
|
553
|
+
- **Purpose**: Prevents false positives for transactions outside the statement period
|
|
554
|
+
- **Implementation**: Uses `Date.UTC()` for timezone-safe date comparison
|
|
555
|
+
- **New Report Fields**:
|
|
556
|
+
- `ynab_in_range_count` - YNAB transactions within statement period
|
|
557
|
+
- `ynab_outside_range_count` - YNAB transactions outside statement period
|
|
558
|
+
- **Behavior**: Only transactions within the CSV date range are considered for matching
|
|
559
|
+
|
|
481
560
|
See `docs/technical/reconciliation-system-architecture.md` for detailed documentation.
|
|
482
561
|
|
|
483
562
|
## Boundaries
|
package/bin/ynab-mcp-server.cjs
CHANGED
package/bin/ynab-mcp-server.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import path from
|
|
3
|
-
import { fileURLToPath } from
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
4
|
|
|
5
5
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
6
|
-
const entry = path.resolve(__dirname,
|
|
6
|
+
const entry = path.resolve(__dirname, "../dist/index.js");
|
|
7
7
|
|
|
8
8
|
await import(entry);
|
package/biome.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
|
|
3
|
+
"files": {
|
|
4
|
+
"ignore": [
|
|
5
|
+
"dist/**",
|
|
6
|
+
"coverage/**",
|
|
7
|
+
"node_modules/**",
|
|
8
|
+
".git/**",
|
|
9
|
+
"test-results/**",
|
|
10
|
+
"test-results.json"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
"linter": {
|
|
14
|
+
"rules": {
|
|
15
|
+
"complexity": {
|
|
16
|
+
"useLiteralKeys": "off"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"overrides": [
|
|
21
|
+
{
|
|
22
|
+
"include": ["**/*.test.ts", "**/__tests__/**/*.ts"],
|
|
23
|
+
"linter": {
|
|
24
|
+
"rules": {
|
|
25
|
+
"suspicious": {
|
|
26
|
+
"noExplicitAny": "off"
|
|
27
|
+
},
|
|
28
|
+
"style": {
|
|
29
|
+
"noNonNullAssertion": "off"
|
|
30
|
+
},
|
|
31
|
+
"complexity": {
|
|
32
|
+
"noForEach": "off",
|
|
33
|
+
"noStaticOnlyClass": "off"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|