@dizzlkheinz/ynab-mcpb 0.23.0 → 0.24.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 (71) hide show
  1. package/.github/workflows/ci-tests.yml +3 -0
  2. package/.github/workflows/claude-code-review.yml +3 -0
  3. package/.github/workflows/claude.yml +3 -0
  4. package/.github/workflows/full-integration.yml +3 -0
  5. package/.github/workflows/publish.yml +3 -0
  6. package/.github/workflows/release.yml +3 -0
  7. package/CHANGELOG.md +23 -0
  8. package/CLAUDE.md +50 -28
  9. package/README.md +3 -0
  10. package/dist/bundle/index.cjs +96 -95
  11. package/dist/server/YNABMCPServer.js +26 -7
  12. package/dist/server/resources.d.ts +5 -0
  13. package/dist/server/resources.js +10 -0
  14. package/dist/server/toolRegistry.js +22 -0
  15. package/dist/tools/accountTools.js +32 -26
  16. package/dist/tools/budgetTools.js +2 -0
  17. package/dist/tools/categoryTools.js +35 -29
  18. package/dist/tools/compareTransactions/formatter.js +8 -6
  19. package/dist/tools/compareTransactions/parser.js +12 -5
  20. package/dist/tools/csvFilePath.d.ts +1 -0
  21. package/dist/tools/csvFilePath.js +48 -0
  22. package/dist/tools/exportTransactions.js +23 -21
  23. package/dist/tools/monthTools.js +2 -0
  24. package/dist/tools/payeeTools.js +2 -0
  25. package/dist/tools/reconciliation/index.js +45 -7
  26. package/dist/tools/reconciliation/statementWindow.d.ts +13 -0
  27. package/dist/tools/reconciliation/statementWindow.js +71 -0
  28. package/dist/tools/transactionReadTools.js +3 -0
  29. package/dist/tools/transactionUtils.js +9 -0
  30. package/dist/tools/transactionWriteTools.js +137 -110
  31. package/dist/tools/utilityTools.js +1 -0
  32. package/package.json +2 -2
  33. package/src/server/CLAUDE.md +38 -6
  34. package/src/server/YNABMCPServer.ts +33 -7
  35. package/src/server/__tests__/resources.test.ts +2 -0
  36. package/src/server/__tests__/toolRegistry.test.ts +112 -0
  37. package/src/server/resources.ts +21 -0
  38. package/src/server/toolRegistry.ts +40 -4
  39. package/src/tools/CLAUDE.md +67 -25
  40. package/src/tools/__tests__/accountTools.integration.test.ts +3 -0
  41. package/src/tools/__tests__/budgetTools.delta.integration.test.ts +11 -2
  42. package/src/tools/__tests__/budgetTools.integration.test.ts +8 -2
  43. package/src/tools/__tests__/categoryTools.delta.integration.test.ts +4 -1
  44. package/src/tools/__tests__/categoryTools.integration.test.ts +4 -0
  45. package/src/tools/__tests__/compareTransactions/formatter.test.ts +2 -1
  46. package/src/tools/__tests__/compareTransactions/parser.test.ts +2 -2
  47. package/src/tools/__tests__/csvFilePath.test.ts +48 -0
  48. package/src/tools/__tests__/monthTools.delta.integration.test.ts +4 -1
  49. package/src/tools/__tests__/monthTools.integration.test.ts +5 -0
  50. package/src/tools/__tests__/payeeTools.delta.integration.test.ts +4 -1
  51. package/src/tools/__tests__/payeeTools.integration.test.ts +5 -0
  52. package/src/tools/__tests__/transactionTools.integration.test.ts +18 -2
  53. package/src/tools/__tests__/transactionUtils.test.ts +35 -0
  54. package/src/tools/__tests__/utilityTools.integration.test.ts +3 -1
  55. package/src/tools/accountTools.ts +32 -28
  56. package/src/tools/budgetTools.ts +2 -0
  57. package/src/tools/categoryTools.ts +35 -29
  58. package/src/tools/compareTransactions/formatter.ts +8 -6
  59. package/src/tools/compareTransactions/parser.ts +18 -6
  60. package/src/tools/csvFilePath.ts +63 -0
  61. package/src/tools/exportTransactions.ts +25 -23
  62. package/src/tools/monthTools.ts +2 -0
  63. package/src/tools/payeeTools.ts +2 -0
  64. package/src/tools/reconciliation/CLAUDE.md +1 -0
  65. package/src/tools/reconciliation/__tests__/statementWindow.test.ts +112 -0
  66. package/src/tools/reconciliation/index.ts +64 -7
  67. package/src/tools/reconciliation/statementWindow.ts +107 -0
  68. package/src/tools/transactionReadTools.ts +3 -0
  69. package/src/tools/transactionUtils.ts +12 -0
  70. package/src/tools/transactionWriteTools.ts +145 -114
  71. package/src/tools/utilityTools.ts +1 -0
@@ -6,6 +6,9 @@ on:
6
6
  - master
7
7
  pull_request:
8
8
 
9
+ env:
10
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
11
+
9
12
  jobs:
10
13
  unit-tests:
11
14
  runs-on: ubuntu-latest
@@ -10,6 +10,9 @@ on:
10
10
  # - "src/**/*.js"
11
11
  # - "src/**/*.jsx"
12
12
 
13
+ env:
14
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
15
+
13
16
  jobs:
14
17
  claude-review:
15
18
  # Optional: Filter by PR author
@@ -10,6 +10,9 @@ on:
10
10
  pull_request_review:
11
11
  types: [submitted]
12
12
 
13
+ env:
14
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
15
+
13
16
  jobs:
14
17
  claude:
15
18
  if: |
@@ -5,6 +5,9 @@ on:
5
5
  - cron: '0 2 * * *'
6
6
  workflow_dispatch:
7
7
 
8
+ env:
9
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
10
+
8
11
  jobs:
9
12
  run-full-suite:
10
13
  runs-on: ubuntu-latest
@@ -9,6 +9,9 @@ on:
9
9
  release:
10
10
  types: [published]
11
11
 
12
+ env:
13
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
14
+
12
15
  jobs:
13
16
  publish:
14
17
  # Required to satisfy npm Trusted Publisher matching (environment name left blank in npm)
@@ -16,6 +16,9 @@ on:
16
16
  required: false
17
17
  default: 'master'
18
18
 
19
+ env:
20
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
21
+
19
22
  permissions:
20
23
  contents: write
21
24
 
package/CHANGELOG.md CHANGED
@@ -7,6 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.24.1] - 2026-03-29
11
+
12
+ ### Fixed
13
+
14
+ - **Reconciliation Bulk Creates** - Correlation now succeeds when YNAB populates `payee_id` on returned transactions; previously every bulk-created transaction landed in the `correlation_failed` bucket, reporting 0 transactions created
15
+ - **MCP SDK 1.27+ Compatibility** - All 28 tool handlers now return `structuredContent` alongside text content, resolving the `RuntimeError: Tool has an output schema but did not return structured content` thrown by SDK clients
16
+ - **Output Schema Stripping** - Zod schema stripping is now applied to handler-supplied `structuredContent`; previously the raw handler object was returned, leaking fields not declared in the output schema (e.g. `security` in diagnostic info)
17
+ - **Content Validation Ordering** - Content array validation now runs unconditionally before the `structuredContent` fast-path, so malformed content is caught centrally even when `structuredContent` is present
18
+
19
+ ### Changed
20
+
21
+ - **CI** - GitHub Actions runners now opt into Node.js 24 via `FORCE_JAVASCRIPT_ACTIONS_TO_NODE24=true`, ahead of the June 2026 forced migration
22
+
23
+ ## [0.24.0] - 2026-02-22
24
+
25
+ ### Changed
26
+
27
+ - **SDK** - Upgraded @modelcontextprotocol/sdk from 1.26.0 to 1.27.0
28
+ - **Server Info** - Added `title`, `description`, and `websiteUrl` to MCP server metadata
29
+ - **Logging** - Declared `logging` capability in server initialization
30
+ - **Resource Annotations** - Added `audience` and `priority` annotations to all resources and resource templates
31
+ - **Documentation** - Fixed all tool name references in CLAUDE.md to use actual `ynab_` prefixed names
32
+
10
33
  ## [0.23.0] - 2026-02-22
11
34
 
12
35
  ### Added
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.23.0
9
+ **Current Version:** 0.24.1
10
10
 
11
11
  ## Essential Commands
12
12
 
@@ -85,7 +85,8 @@ The architecture is modular and service-oriented:
85
85
  - **prompts.ts** - MCP prompt definitions and handlers
86
86
  - **diagnostics.ts** - System diagnostics and health monitoring
87
87
  - **securityMiddleware.ts** - Security validation and wrapper functions
88
- - **responseFormatter.ts** - JSON response formatting (minification/pretty-print)
88
+ - **responseFormatter.ts** - JSON response formatting (pretty-print)
89
+ - **markdownFormatter.ts** - Human-readable markdown output for all read tools (tables, detail views, pagination footers)
89
90
  - **rateLimiter.ts** - Rate limiting for YNAB API compliance
90
91
  - **requestLogger.ts** - Request/response logging middleware
91
92
  - **cacheKeys.ts** - Centralized cache key generation utilities
@@ -97,7 +98,7 @@ The architecture is modular and service-oriented:
97
98
  - Domain factories (`register*Tools`) live in each tool file: budget, account, transaction, category, payee, month, utility, reconciliation. `setupToolRegistry` now delegates to these factories.
98
99
  - Shared schemas: `emptyObjectSchema`, `looseObjectSchema` in `src/tools/schemas/common.ts`.
99
100
  - Output schemas: All 28 tools have Zod output schemas in `src/tools/schemas/outputs/`, registered via `outputSchema` field. The registry converts to JSON Schema for `tools/list` and validates handler output for `structuredContent`.
100
- - Server-owned inline tools that stay in `YNABMCPServer`: `set_default_budget`, `get_default_budget`, `diagnostic_info`, `clear_cache` (they depend on server internals).
101
+ - Server-owned inline tools that stay in `YNABMCPServer`: `ynab_set_default_budget`, `ynab_get_default_budget`, `ynab_diagnostic_info`, `ynab_clear_cache` (they depend on server internals).
101
102
 
102
103
  ### Tool Implementation (`src/tools/`)
103
104
 
@@ -167,7 +168,7 @@ All tools register through the centralized `ToolRegistry` for consistent validat
167
168
 
168
169
  ```typescript
169
170
  registry.register({
170
- name: 'my_tool',
171
+ name: 'ynab_my_tool',
171
172
  description: 'Tool description',
172
173
  inputSchema: MyToolSchema, // Zod input schema
173
174
  outputSchema: MyOutputSchema, // Zod output schema (structuredContent)
@@ -176,6 +177,27 @@ registry.register({
176
177
  });
177
178
  ```
178
179
 
180
+ ### Response Format (Markdown / JSON)
181
+
182
+ All read-only tools accept a `response_format` parameter (`"markdown"` | `"json"`, default: `"markdown"`):
183
+
184
+ - **`"markdown"`** — Human-readable tables and detail views via `markdownFormatter.ts`. Includes pagination footers and cache info.
185
+ - **`"json"`** — Structured JSON (pretty-printed). Also returned as `structuredContent` for clients that support output schemas.
186
+
187
+ **Supported tools**: `ynab_list_budgets`, `ynab_get_budget`, `ynab_list_accounts`, `ynab_get_account`, `ynab_list_transactions`, `ynab_get_transaction`, `ynab_list_categories`, `ynab_get_category`, `ynab_list_payees`, `ynab_get_payee`, `ynab_get_month`, `ynab_list_months`, `ynab_get_user`
188
+
189
+ ```typescript
190
+ // In tool handler
191
+ const fmt = params.response_format ?? "markdown";
192
+ return {
193
+ content: [{
194
+ type: "text",
195
+ text: fmt === "json" ? JSON.stringify(data, null, 2) : formatBudgetsList(data),
196
+ }],
197
+ structuredContent: data,
198
+ };
199
+ ```
200
+
179
201
  ### Enhanced Caching with Delta Support
180
202
 
181
203
  Use `cacheManager.wrap()` for automatic caching with observability:
@@ -304,7 +326,7 @@ Long-running operations can emit MCP progress notifications to provide real-time
304
326
  - **ProgressCallback** type defined in `src/server/toolRegistry.ts`
305
327
  - Optional callback passed to tool handlers via adapter pattern
306
328
  - Usage: `await sendProgress?.({ progress, total, message })`
307
- - Currently used by: `reconcile_account` tool
329
+ - Currently used by: `ynab_reconcile_account` tool
308
330
 
309
331
  ### Progress Notification Pattern
310
332
 
@@ -325,7 +347,7 @@ async function handleLongOperation(
325
347
 
326
348
  ### Tools with Progress Support
327
349
 
328
- - **reconcile_account** - Reports progress during CSV parsing, matching, and bulk operations
350
+ - **ynab_reconcile_account** - Reports progress during CSV parsing, matching, and bulk operations
329
351
 
330
352
  ## Tool Annotations
331
353
 
@@ -346,23 +368,23 @@ Each tool includes the following annotation fields:
346
368
  The system defines 5 preset annotation patterns in `src/tools/toolCategories.ts`:
347
369
 
348
370
  - **READ_ONLY_EXTERNAL** - Read-only tools querying YNAB API
349
- - Examples: `list_budgets`, `get_account`, `list_transactions`
371
+ - Examples: `ynab_list_budgets`, `ynab_get_account`, `ynab_list_transactions`
350
372
  - Characteristics: Read-only, idempotent, external API calls
351
373
 
352
374
  - **WRITE_EXTERNAL_CREATE** - Tools creating new resources, non-idempotent
353
- - Examples: `create_transaction`, `create_account`
375
+ - Examples: `ynab_create_transaction`, `ynab_create_account`
354
376
  - Characteristics: Write operations, non-idempotent (repeated calls create duplicates), external API
355
377
 
356
378
  - **WRITE_EXTERNAL_UPDATE** - Tools updating existing resources, idempotent
357
- - Examples: `update_transaction`, `set_default_budget`, `reconcile_account`
379
+ - Examples: `ynab_update_transaction`, `ynab_set_default_budget`, `ynab_reconcile_account`
358
380
  - Characteristics: Write operations, idempotent (repeated calls produce same result), external API
359
381
 
360
382
  - **WRITE_EXTERNAL_DELETE** - Destructive tools deleting resources
361
- - Example: `delete_transaction` ⚠️
383
+ - Example: `ynab_delete_transaction` ⚠️
362
384
  - Characteristics: Write operations, destructive, idempotent, external API
363
385
 
364
386
  - **UTILITY_LOCAL** - Local utility tools without external API calls
365
- - Examples: `clear_cache`, `diagnostic_info`
387
+ - Examples: `ynab_clear_cache`, `ynab_diagnostic_info`
366
388
  - Characteristics: Local operations, no external API dependencies
367
389
 
368
390
  ### Complete Tool Classification
@@ -371,23 +393,23 @@ All 28 tools are classified into the following categories:
371
393
 
372
394
  **Read-Only External (15 tools):**
373
395
 
374
- - `list_budgets`, `get_budget`, `list_accounts`, `get_account`, `list_transactions`, `export_transactions`, `compare_transactions`, `get_transaction`, `list_categories`, `get_category`, `list_payees`, `get_payee`, `get_month`, `list_months`, `get_user`
396
+ - `ynab_list_budgets`, `ynab_get_budget`, `ynab_list_accounts`, `ynab_get_account`, `ynab_list_transactions`, `ynab_export_transactions`, `ynab_compare_transactions`, `ynab_get_transaction`, `ynab_list_categories`, `ynab_get_category`, `ynab_list_payees`, `ynab_get_payee`, `ynab_get_month`, `ynab_list_months`, `ynab_get_user`
375
397
 
376
398
  **Write External - Create (4 tools):**
377
399
 
378
- - `create_account`, `create_transaction`, `create_transactions`, `create_receipt_split_transaction`
400
+ - `ynab_create_account`, `ynab_create_transaction`, `ynab_create_transactions`, `ynab_create_receipt_split_transaction`
379
401
 
380
402
  **Write External - Update (5 tools):**
381
403
 
382
- - `set_default_budget`, `reconcile_account`, `update_transaction`, `update_transactions`, `update_category`
404
+ - `ynab_set_default_budget`, `ynab_reconcile_account`, `ynab_update_transaction`, `ynab_update_transactions`, `ynab_update_category`
383
405
 
384
406
  **Write External - Delete (1 tool):**
385
407
 
386
- - `delete_transaction` ⚠️
408
+ - `ynab_delete_transaction` ⚠️
387
409
 
388
410
  **Utility Local (3 tools):**
389
411
 
390
- - `get_default_budget`, `diagnostic_info`, `clear_cache`
412
+ - `ynab_get_default_budget`, `ynab_diagnostic_info`, `ynab_clear_cache`
391
413
 
392
414
  ### Usage Example
393
415
 
@@ -397,7 +419,7 @@ Tool annotations are applied during tool registration using preset patterns:
397
419
  import { ToolAnnotationPresets } from '../tools/toolCategories.js';
398
420
 
399
421
  register({
400
- name: 'delete_transaction',
422
+ name: 'ynab_delete_transaction',
401
423
  description: 'Delete a transaction',
402
424
  inputSchema: DeleteTransactionSchema,
403
425
  handler: adaptWrite(handleDeleteTransaction),
@@ -420,16 +442,16 @@ Output schemas live in `src/tools/schemas/outputs/` organized by domain:
420
442
 
421
443
  | File | Covers | Key Schemas |
422
444
  |------|--------|-------------|
423
- | `budgetOutputs.ts` | `list_budgets`, `get_budget` | `ListBudgetsOutputSchema`, `GetBudgetOutputSchema` |
424
- | `accountOutputs.ts` | `list_accounts`, `get_account`, `create_account` | `ListAccountsOutputSchema`, `GetAccountOutputSchema`, `CreateAccountOutputSchema` |
425
- | `transactionOutputs.ts` | `list_transactions`, `get_transaction` | `ListTransactionsOutputSchema` (union: normal/preview), `GetTransactionOutputSchema` |
426
- | `transactionMutationOutputs.ts` | `create_transaction`, `create_transactions`, `update_transaction`, `update_transactions`, `delete_transaction`, `create_receipt_split_transaction`, `update_category` | All mutation schemas with dry-run/execution unions |
427
- | `categoryOutputs.ts` | `list_categories`, `get_category` | `ListCategoriesOutputSchema`, `GetCategoryOutputSchema` |
428
- | `payeeOutputs.ts` | `list_payees`, `get_payee` | `ListPayeesOutputSchema`, `GetPayeeOutputSchema` |
429
- | `monthOutputs.ts` | `get_month`, `list_months` | `GetMonthOutputSchema`, `ListMonthsOutputSchema` |
430
- | `utilityOutputs.ts` | `get_user`, `get_default_budget`, `set_default_budget`, `clear_cache`, `diagnostic_info` | All utility output schemas |
431
- | `reconciliationOutputs.ts` | `reconcile_account` | `ReconcileAccountOutputSchema` (human-only or human+structured union) |
432
- | `comparisonOutputs.ts` | `compare_transactions`, `export_transactions` | `CompareTransactionsOutputSchema`, `ExportTransactionsOutputSchema` |
445
+ | `budgetOutputs.ts` | `ynab_list_budgets`, `ynab_get_budget` | `ListBudgetsOutputSchema`, `GetBudgetOutputSchema` |
446
+ | `accountOutputs.ts` | `ynab_list_accounts`, `ynab_get_account`, `ynab_create_account` | `ListAccountsOutputSchema`, `GetAccountOutputSchema`, `CreateAccountOutputSchema` |
447
+ | `transactionOutputs.ts` | `ynab_list_transactions`, `ynab_get_transaction` | `ListTransactionsOutputSchema` (union: normal/preview), `GetTransactionOutputSchema` |
448
+ | `transactionMutationOutputs.ts` | `ynab_create_transaction`, `ynab_create_transactions`, `ynab_update_transaction`, `ynab_update_transactions`, `ynab_delete_transaction`, `ynab_create_receipt_split_transaction`, `ynab_update_category` | All mutation schemas with dry-run/execution unions |
449
+ | `categoryOutputs.ts` | `ynab_list_categories`, `ynab_get_category` | `ListCategoriesOutputSchema`, `GetCategoryOutputSchema` |
450
+ | `payeeOutputs.ts` | `ynab_list_payees`, `ynab_get_payee` | `ListPayeesOutputSchema`, `GetPayeeOutputSchema` |
451
+ | `monthOutputs.ts` | `ynab_get_month`, `ynab_list_months` | `GetMonthOutputSchema`, `ListMonthsOutputSchema` |
452
+ | `utilityOutputs.ts` | `ynab_get_user`, `ynab_get_default_budget`, `ynab_set_default_budget`, `ynab_clear_cache`, `ynab_diagnostic_info` | All utility output schemas |
453
+ | `reconciliationOutputs.ts` | `ynab_reconcile_account` | `ReconcileAccountOutputSchema` (human-only or human+structured union) |
454
+ | `comparisonOutputs.ts` | `ynab_compare_transactions`, `ynab_export_transactions` | `CompareTransactionsOutputSchema`, `ExportTransactionsOutputSchema` |
433
455
 
434
456
  ### Shared Schema Components
435
457
 
@@ -598,7 +620,7 @@ Service modules (like diagnostics, resources, prompts) follow a pattern:
598
620
 
599
621
  ## Reconciliation System
600
622
 
601
- The reconciliation tool (`reconcile_account`) is a comprehensive account reconciliation system with advanced features:
623
+ The reconciliation tool (`ynab_reconcile_account`) is a comprehensive account reconciliation system with advanced features:
602
624
 
603
625
  ### Key Components
604
626
 
package/README.md CHANGED
@@ -56,6 +56,7 @@ graph LR
56
56
  - **Bank reconciliation (beta)** — Import a bank CSV, fuzzy-match against YNAB, detect missing or mismatched transactions, and apply bulk fixes.
57
57
  - **28 YNAB tools** — Full coverage of budgets, accounts, transactions, categories, payees, months, and utilities.
58
58
  - **Delta sync** — Fetches only changed data since the last request, keeping things fast.
59
+ - **Markdown or JSON** — All read tools support `response_format`: human-readable markdown tables (default) or structured JSON.
59
60
  - **MCP-native** — Structured outputs, annotations, completions API, and resource templates.
60
61
 
61
62
  ---
@@ -199,6 +200,8 @@ Create a transaction: $42.18 at Trader Joe's yesterday.
199
200
  | Reconciliation | `reconcile_account` |
200
201
  | Utilities | `get_user` `diagnostic_info` `clear_cache` |
201
202
 
203
+ All read tools accept `response_format` (`"markdown"` or `"json"`, default: `"markdown"`).
204
+
202
205
  Full reference: [docs/reference/API.md](docs/reference/API.md)
203
206
 
204
207
  </details>