@dizzlkheinz/ynab-mcpb 0.16.1 → 0.17.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 (169) hide show
  1. package/.env.example +33 -33
  2. package/.github/workflows/ci-tests.yml +45 -45
  3. package/.github/workflows/claude-code-review.yml +57 -57
  4. package/.github/workflows/claude.yml +50 -50
  5. package/.github/workflows/full-integration.yml +22 -22
  6. package/.github/workflows/publish.yml +11 -2
  7. package/CLAUDE.md +33 -47
  8. package/README.md +8 -10
  9. package/dist/bundle/index.cjs +54 -54
  10. package/dist/server/YNABMCPServer.d.ts +120 -54
  11. package/dist/server/YNABMCPServer.js +28 -381
  12. package/dist/server/config.d.ts +2 -0
  13. package/dist/server/config.js +1 -0
  14. package/dist/server/securityMiddleware.d.ts +37 -8
  15. package/dist/tools/accountTools.d.ts +2 -0
  16. package/dist/tools/accountTools.js +45 -0
  17. package/dist/tools/adapters.d.ts +12 -0
  18. package/dist/tools/adapters.js +25 -0
  19. package/dist/tools/budgetTools.d.ts +2 -0
  20. package/dist/tools/budgetTools.js +30 -0
  21. package/dist/tools/categoryTools.d.ts +2 -0
  22. package/dist/tools/categoryTools.js +45 -0
  23. package/dist/tools/monthTools.d.ts +2 -0
  24. package/dist/tools/monthTools.js +32 -0
  25. package/dist/tools/payeeTools.d.ts +2 -0
  26. package/dist/tools/payeeTools.js +32 -0
  27. package/dist/tools/reconciliation/index.d.ts +2 -0
  28. package/dist/tools/reconciliation/index.js +33 -0
  29. package/dist/tools/schemas/common.d.ts +3 -0
  30. package/dist/tools/schemas/common.js +3 -0
  31. package/dist/tools/schemas/outputs/comparisonOutputs.d.ts +1 -1
  32. package/dist/tools/schemas/outputs/index.d.ts +2 -2
  33. package/dist/tools/schemas/outputs/index.js +2 -2
  34. package/dist/tools/schemas/outputs/utilityOutputs.d.ts +0 -15
  35. package/dist/tools/schemas/outputs/utilityOutputs.js +0 -9
  36. package/dist/tools/transactionTools.d.ts +2 -0
  37. package/dist/tools/transactionTools.js +124 -0
  38. package/dist/tools/utilityTools.d.ts +2 -7
  39. package/dist/tools/utilityTools.js +19 -38
  40. package/dist/types/index.d.ts +1 -0
  41. package/dist/types/toolRegistration.d.ts +27 -0
  42. package/dist/types/toolRegistration.js +1 -0
  43. package/docs/maintainers/npm-publishing.md +27 -0
  44. package/docs/reference/API.md +15 -70
  45. package/docs/technical/reconciliation-system-architecture.md +2251 -2251
  46. package/package.json +6 -6
  47. package/scripts/analyze-bundle.mjs +41 -41
  48. package/scripts/generate-mcpb.ps1 +95 -95
  49. package/scripts/run-domain-integration-tests.js +4 -1
  50. package/scripts/watch-and-restart.ps1 +49 -49
  51. package/src/__tests__/comprehensive.integration.test.ts +0 -28
  52. package/src/__tests__/performance.test.ts +4 -12
  53. package/src/__tests__/setup.ts +45 -14
  54. package/src/__tests__/workflows.e2e.test.ts +1 -51
  55. package/src/server/YNABMCPServer.ts +33 -519
  56. package/src/server/__tests__/YNABMCPServer.test.ts +0 -1
  57. package/src/server/__tests__/toolRegistration.test.ts +236 -0
  58. package/src/server/config.ts +1 -0
  59. package/src/tools/__tests__/adapters.test.ts +113 -0
  60. package/src/tools/__tests__/transactionTools.integration.test.ts +63 -3
  61. package/src/tools/__tests__/utilityTools.integration.test.ts +1 -85
  62. package/src/tools/__tests__/utilityTools.test.ts +1 -123
  63. package/src/tools/accountTools.ts +53 -0
  64. package/src/tools/adapters.ts +74 -0
  65. package/src/tools/budgetTools.ts +37 -0
  66. package/src/tools/categoryTools.ts +53 -0
  67. package/src/tools/monthTools.ts +39 -0
  68. package/src/tools/payeeTools.ts +39 -0
  69. package/src/tools/reconciliation/index.ts +45 -0
  70. package/src/tools/schemas/common.ts +18 -0
  71. package/src/tools/schemas/outputs/index.ts +0 -3
  72. package/src/tools/schemas/outputs/utilityOutputs.ts +2 -43
  73. package/src/tools/toolCategories.ts +0 -1
  74. package/src/tools/transactionTools.ts +140 -0
  75. package/src/tools/utilityTools.ts +24 -55
  76. package/src/types/index.ts +3 -0
  77. package/src/types/toolRegistration.ts +88 -0
  78. package/vitest.config.ts +2 -1
  79. package/.chunkhound.json +0 -11
  80. package/.code/agents/01a13ef4-3f23-4f52-b33b-3585b73cfa60/error.txt +0 -3
  81. package/.code/agents/084fd32f-e298-4728-9103-a78d7dc39613/error.txt +0 -3
  82. package/.code/agents/0fed51e1-a943-4b97-a2a8-a6f0f27c844d/status.txt +0 -1
  83. package/.code/agents/1059b6bd-5ccd-4d83-a12c-7c9d89137399/error.txt +0 -5
  84. package/.code/agents/110/exec-call_F9BDNG7JfxKkq7Vc8ESAvdft.txt +0 -1569
  85. package/.code/agents/11ebcef3-b13f-4e44-ad80-d94a866804b7/error.txt +0 -3
  86. package/.code/agents/1398/exec-call_CjItcWMU1G6JoPshX62QvpaR.txt +0 -2832
  87. package/.code/agents/1398/exec-call_SUVq2ivmONQ5LMCmd7ngmOqr.txt +0 -2709
  88. package/.code/agents/1398/exec-call_SdNY4NOffdcC5pRYjVXHjPCK.txt +0 -2832
  89. package/.code/agents/1398/exec-call_qblJo9et1gsFFB63TtLOiji2.txt +0 -2832
  90. package/.code/agents/1398/exec-call_zaRrzlGz7GJcNzVfkAmML7Zg.txt +0 -2709
  91. package/.code/agents/171834fd-5905-42fc-bbcc-2c755145b0fc/status.txt +0 -1
  92. package/.code/agents/1724/exec-call_HvHQe0w5CCG3T7Q3ULT6MO3g.txt +0 -5217
  93. package/.code/agents/1724/exec-call_QwUNESVzfxxk78K1frh1Vahb.txt +0 -2594
  94. package/.code/agents/1724/exec-call_aJ1Xwz71XmIpD4SBxSHERzLe.txt +0 -2594
  95. package/.code/agents/1d7d7ab7-7473-4b69-8b97-6e914f56056a/result.txt +0 -231
  96. package/.code/agents/210/exec-call_0tQCsKNJ1WTuIchb8wlcFJpW.txt +0 -2590
  97. package/.code/agents/210/exec-call_8ZlY9cUc8Ft1twi4ch8UJ6IN.txt +0 -5195
  98. package/.code/agents/2188/exec-call_5HqayBxIteJtoI8oPTiLWgvJ.txt +0 -286
  99. package/.code/agents/2188/exec-call_XRbBKBq3adZe6dcppAvQtM7G.txt +0 -218
  100. package/.code/agents/2188/exec-call_ehA0SjpYtrUi6GJXmibLjp4i.txt +0 -180
  101. package/.code/agents/21902821-ecaf-4759-bb9d-222b90921af5/error.txt +0 -3
  102. package/.code/agents/232073be-aa0e-46da-b478-5b64dbf03cf5/status.txt +0 -1
  103. package/.code/agents/234ff534-2336-4771-a8d9-aa04421a63be/result.txt +0 -747
  104. package/.code/agents/253e2695-dc36-4022-b436-27655e0fc6c7/status.txt +0 -1
  105. package/.code/agents/2583/exec-call_M59I4eDjpjlBIWBiSxyS0YlJ.txt +0 -2594
  106. package/.code/agents/2583/exec-call_usLRGh7OhVHtsRBL4iUwRhjq.txt +0 -2594
  107. package/.code/agents/292aa3ff-dbab-470f-97c9-e7e8fd65e0db/result.txt +0 -144
  108. package/.code/agents/3134/exec-call_IgCAMGx19lWfuo8zfYIt5FFC.txt +0 -416
  109. package/.code/agents/3134/exec-call_IxvLR2Oo7kba2QTsI1gHVko8.txt +0 -2590
  110. package/.code/agents/3134/exec-call_jYvc8hksZChSiysbzKjl2ZbB.txt +0 -2590
  111. package/.code/agents/329/exec-call_4QdP3SfSO7HGPCwVcqZIth6s.txt +0 -2590
  112. package/.code/agents/472/exec-call_4AxzEEcWwkKhpqRB3bE8Ha4L.txt +0 -790
  113. package/.code/agents/472/exec-call_CB3LPYQA8QIZRi8I6kj4J17A.txt +0 -766
  114. package/.code/agents/472/exec-call_YeoUWvaFoktay2nqVUsa9KKX.txt +0 -790
  115. package/.code/agents/472/exec-call_jPWgKVquBBXTg0T3Lks5ZfkK.txt +0 -2594
  116. package/.code/agents/472/exec-call_qBkvunpGBDEHph2jPmTwtcsb.txt +0 -1000
  117. package/.code/agents/472/exec-call_v0ffRV1p0kTckBmJPzzHAEy0.txt +0 -3489
  118. package/.code/agents/472/exec-call_xAX5FXqWIlk02d9WubHbHWh8.txt +0 -766
  119. package/.code/agents/5346/exec-call_9q0muXUuLaucwEqI51Pt7idT.txt +0 -2594
  120. package/.code/agents/5346/exec-call_B2el3B79rVkq9LhWTI2VYlz7.txt +0 -2456
  121. package/.code/agents/5346/exec-call_BfX08f02qkZI9uJD5dvCvuoj.txt +0 -2594
  122. package/.code/agents/543328d0-61d6-4fd1-a723-bb168656e2e2/error.txt +0 -18
  123. package/.code/agents/5580c02c-1383-4d18-9cbd-cc8a06e3408d/result.txt +0 -48
  124. package/.code/agents/60ce1a22-5126-44b2-b977-1d5b56142a7b/status.txt +0 -1
  125. package/.code/agents/6215d9db-7fa9-4429-aeec-3835c3212291/error.txt +0 -1
  126. package/.code/agents/6743db55-30e5-4b4e-9366-a8214fc7f714/error.txt +0 -1
  127. package/.code/agents/6bf9591b-b9c9-422c-b0a5-e968c7d8422a/status.txt +0 -1
  128. package/.code/agents/7/exec-call_eww3GfdEiJZx61sJEQ9wNmt3.txt +0 -1271
  129. package/.code/agents/70/exec-call_owUtDMYiVgqDf8vsz1i32PFf.txt +0 -1570
  130. package/.code/agents/8/exec-call_UtrjAcLbhYLatxR4O97fZgnm.txt +0 -2590
  131. package/.code/agents/82490bc9-f34e-4b1b-8a8e-bccc2e6254f5/error.txt +0 -3
  132. package/.code/agents/841/exec-call_7nTNhSBCNjTDUIJv7py6CepO.txt +0 -3299
  133. package/.code/agents/841/exec-call_TLI0yUdUijuUAvI4o3DXEvHO.txt +0 -3299
  134. package/.code/agents/9/exec-call_XaABQT1hIlRpnKZ2uyBMWsTC.txt +0 -1882
  135. package/.code/agents/941/exec-call_GuGHRx7NNXWIDAnxUG2NEWPa.txt +0 -2594
  136. package/.code/agents/95d9fbab-19a2-48af-83f9-c792566a347f/error.txt +0 -1
  137. package/.code/agents/b0098cb8-cb32-4ada-9bc4-37c587518896/result.txt +0 -170
  138. package/.code/agents/b4fe59a4-81df-42e2-a112-0153e504faca/error.txt +0 -1
  139. package/.code/agents/bf4ce152-f623-49d7-aa52-c18631625c3c/error.txt +0 -3
  140. package/.code/agents/d7d1db75-d7eb-468e-adea-4ef4d916d187/status.txt +0 -1
  141. package/.code/agents/e2baa9c8-bac3-49e3-a39d-024333e6a990/status.txt +0 -1
  142. package/.code/agents/e350b8c3-8483-408c-b2bb-94515f492a11/error.txt +0 -3
  143. package/.code/agents/e63f9919-719f-4ad0-bccf-01b1a596e1e9/status.txt +0 -1
  144. package/.code/agents/e71695a8-3044-478d-8f12-ed13d02884c7/status.txt +0 -1
  145. package/.code/agents/f95b7464-3e25-4897-b153-c8dfd63fd605/error.txt +0 -5
  146. package/.code/agents/fa3c5ddf-cdf7-47a2-930a-b806c6363689/status.txt +0 -1
  147. package/.github/workflows/pr-description-check.yml +0 -88
  148. package/AGENTS.md +0 -36
  149. package/NUL +0 -1
  150. package/docs/README.md +0 -72
  151. package/docs/getting-started/CONFIGURATION.md +0 -175
  152. package/docs/getting-started/INSTALLATION.md +0 -333
  153. package/docs/getting-started/QUICKSTART.md +0 -282
  154. package/docs/guides/ARCHITECTURE.md +0 -533
  155. package/docs/guides/DEPLOYMENT.md +0 -189
  156. package/docs/guides/INTEGRATION_TESTING.md +0 -730
  157. package/docs/guides/TESTING.md +0 -591
  158. package/docs/reconciliation-flow.md +0 -83
  159. package/docs/reference/EXAMPLES.md +0 -946
  160. package/docs/reference/TOOLS.md +0 -348
  161. package/docs/reference/TROUBLESHOOTING.md +0 -481
  162. package/package.json.tmp +0 -105
  163. package/temp-recon.ts +0 -126
  164. package/test-exports/ynab_account_e9ddc2a6_minimal_1items_2025-11-19_09-04-53.json +0 -23
  165. package/test-exports/ynab_account_e9ddc2a6_minimal_1items_2025-11-19_10-37-42.json +0 -23
  166. package/test-exports/ynab_account_e9ddc2a6_minimal_4items_2025-11-19_09-02-09.json +0 -44
  167. package/test-exports/ynab_account_e9ddc2a6_minimal_6items_2025-11-19_10-37-52.json +0 -58
  168. package/test-exports/ynab_since_2025-10-16_account_53298e13_238items_2025-11-28_13-46-20.json +0 -3662
  169. package/test-exports/ynab_since_2025-11-01_account_4c18e9f0_minimal_14items_2025-11-16_10-07-10.json +0 -115
package/.env.example CHANGED
@@ -1,36 +1,36 @@
1
- # YNAB MCP Server Environment Configuration
2
- # Copy this file to .env and fill in your actual values
3
-
4
- # Required: Your YNAB Personal Access Token
5
- # Get this from: https://app.youneedabudget.com/settings/developer
6
- YNAB_ACCESS_TOKEN=your_ynab_personal_access_token_here
7
-
8
- # Optional: Node.js environment (development, production, test)
9
- NODE_ENV=development
10
-
11
- # Optional: Logging level (error, warn, info, debug)
12
- LOG_LEVEL=info
13
-
14
- # Output formatting controls
15
- # Minify JSON output returned by tools (default: true)
16
- YNAB_MCP_MINIFY_OUTPUT=true
17
- # Number of spaces when pretty printing (used when minify=false)
18
- YNAB_MCP_PRETTY_SPACES=2
19
-
20
- # Export settings
21
- # Directory where exported transaction files are saved
22
- # Default: Windows/Mac = ~/Downloads, Linux/Unix = ~/Documents (or $XDG_DOCUMENTS_DIR)
23
- # Examples: C:\Users\YourName\Desktop, /home/user/exports, ./data, ~/Desktop
24
- YNAB_EXPORT_PATH=
25
-
26
- # Cache configuration
27
- # Maximum number of entries in the in-memory cache (default: 1000)
28
- # Set to 0 to disable caching entirely
29
- YNAB_MCP_CACHE_MAX_ENTRIES=1000
30
-
31
- # Default time-to-live for cache entries in milliseconds (default: 300000 = 5 minutes)
32
- YNAB_MCP_CACHE_DEFAULT_TTL_MS=300000
33
-
1
+ # YNAB MCP Server Environment Configuration
2
+ # Copy this file to .env and fill in your actual values
3
+
4
+ # Required: Your YNAB Personal Access Token
5
+ # Get this from: https://app.youneedabudget.com/settings/developer
6
+ YNAB_ACCESS_TOKEN=your_ynab_personal_access_token_here
7
+
8
+ # Optional: Node.js environment (development, production, test)
9
+ NODE_ENV=development
10
+
11
+ # Optional: Logging level (error, warn, info, debug)
12
+ LOG_LEVEL=info
13
+
14
+ # Output formatting controls
15
+ # Minify JSON output returned by tools (default: true)
16
+ YNAB_MCP_MINIFY_OUTPUT=true
17
+ # Number of spaces when pretty printing (used when minify=false)
18
+ YNAB_MCP_PRETTY_SPACES=2
19
+
20
+ # Export settings
21
+ # Directory where exported transaction files are saved
22
+ # Default: Windows/Mac = ~/Downloads, Linux/Unix = ~/Documents (or $XDG_DOCUMENTS_DIR)
23
+ # Examples: C:\Users\YourName\Desktop, /home/user/exports, ./data, ~/Desktop
24
+ YNAB_EXPORT_PATH=
25
+
26
+ # Cache configuration
27
+ # Maximum number of entries in the in-memory cache (default: 1000)
28
+ # Set to 0 to disable caching entirely
29
+ YNAB_MCP_CACHE_MAX_ENTRIES=1000
30
+
31
+ # Default time-to-live for cache entries in milliseconds (default: 300000 = 5 minutes)
32
+ YNAB_MCP_CACHE_DEFAULT_TTL_MS=300000
33
+
34
34
  # Default stale-while-revalidate window in milliseconds (default: 120000 = 2 minutes)
35
35
  # Used when stale-while-revalidate is explicitly requested but not specified
36
36
  YNAB_MCP_CACHE_STALE_MS=120000
@@ -1,45 +1,45 @@
1
- name: CI Tests
2
-
3
- on:
4
- push:
5
- branches:
6
- - master
7
- pull_request:
8
-
9
- jobs:
10
- unit-tests:
11
- runs-on: ubuntu-latest
12
- steps:
13
- - uses: actions/checkout@v4
14
- - uses: actions/setup-node@v4
15
- with:
16
- node-version: 20
17
- cache: npm
18
- - name: Install dependencies
19
- run: npm ci
20
- - name: Run unit tests
21
- # Temporarily allow failures while DeltaFetcher architecture tests are updated
22
- # See: docs/plans/2025-11-15-cache-test-alignment.md
23
- continue-on-error: true
24
- run: npm run test:unit
25
-
26
- integration-core:
27
- runs-on: ubuntu-latest
28
- needs: unit-tests
29
- if: always()
30
- env:
31
- YNAB_ACCESS_TOKEN: ${{ secrets.YNAB_ACCESS_TOKEN }}
32
- steps:
33
- - uses: actions/checkout@v4
34
- - uses: actions/setup-node@v4
35
- with:
36
- node-version: 20
37
- cache: npm
38
- - name: Install dependencies
39
- run: npm ci
40
- - name: Run core integration tests (throttled)
41
- # Integration tests with real YNAB API may hit rate limits (200/hour)
42
- # causing 60-minute waits. Tests provide visibility but don't block merges.
43
- continue-on-error: true
44
- run: npm run test:integration:full
45
- timeout-minutes: 90
1
+ name: CI Tests
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+
9
+ jobs:
10
+ unit-tests:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - uses: actions/setup-node@v4
15
+ with:
16
+ node-version: 20
17
+ cache: npm
18
+ - name: Install dependencies
19
+ run: npm ci
20
+ - name: Run unit tests
21
+ # Temporarily allow failures while DeltaFetcher architecture tests are updated
22
+ # See: docs/plans/2025-11-15-cache-test-alignment.md
23
+ continue-on-error: true
24
+ run: npm run test:unit
25
+
26
+ integration-core:
27
+ runs-on: ubuntu-latest
28
+ needs: unit-tests
29
+ if: always()
30
+ env:
31
+ YNAB_ACCESS_TOKEN: ${{ secrets.YNAB_ACCESS_TOKEN }}
32
+ steps:
33
+ - uses: actions/checkout@v4
34
+ - uses: actions/setup-node@v4
35
+ with:
36
+ node-version: 20
37
+ cache: npm
38
+ - name: Install dependencies
39
+ run: npm ci
40
+ - name: Run core integration tests (throttled)
41
+ # Integration tests with real YNAB API may hit rate limits (200/hour)
42
+ # causing 60-minute waits. Tests provide visibility but don't block merges.
43
+ continue-on-error: true
44
+ run: npm run test:integration:full
45
+ timeout-minutes: 90
@@ -1,57 +1,57 @@
1
- name: Claude Code Review
2
-
3
- on:
4
- pull_request:
5
- types: [opened, synchronize]
6
- # Optional: Only run on specific file changes
7
- # paths:
8
- # - "src/**/*.ts"
9
- # - "src/**/*.tsx"
10
- # - "src/**/*.js"
11
- # - "src/**/*.jsx"
12
-
13
- jobs:
14
- claude-review:
15
- # Optional: Filter by PR author
16
- # if: |
17
- # github.event.pull_request.user.login == 'external-contributor' ||
18
- # github.event.pull_request.user.login == 'new-developer' ||
19
- # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
20
-
21
- runs-on: ubuntu-latest
22
- permissions:
23
- contents: read
24
- pull-requests: read
25
- issues: read
26
- id-token: write
27
-
28
- steps:
29
- - name: Checkout repository
30
- uses: actions/checkout@v4
31
- with:
32
- fetch-depth: 1
33
-
34
- - name: Run Claude Code Review
35
- id: claude-review
36
- uses: anthropics/claude-code-action@v1
37
- with:
38
- claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
39
- prompt: |
40
- REPO: ${{ github.repository }}
41
- PR NUMBER: ${{ github.event.pull_request.number }}
42
-
43
- Please review this pull request and provide feedback on:
44
- - Code quality and best practices
45
- - Potential bugs or issues
46
- - Performance considerations
47
- - Security concerns
48
- - Test coverage
49
-
50
- Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.
51
-
52
- Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.
53
-
54
- # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
55
- # or https://docs.claude.com/en/docs/claude-code/cli-reference for available options
56
- claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'
57
-
1
+ name: Claude Code Review
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, synchronize]
6
+ # Optional: Only run on specific file changes
7
+ # paths:
8
+ # - "src/**/*.ts"
9
+ # - "src/**/*.tsx"
10
+ # - "src/**/*.js"
11
+ # - "src/**/*.jsx"
12
+
13
+ jobs:
14
+ claude-review:
15
+ # Optional: Filter by PR author
16
+ # if: |
17
+ # github.event.pull_request.user.login == 'external-contributor' ||
18
+ # github.event.pull_request.user.login == 'new-developer' ||
19
+ # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
20
+
21
+ runs-on: ubuntu-latest
22
+ permissions:
23
+ contents: read
24
+ pull-requests: read
25
+ issues: read
26
+ id-token: write
27
+
28
+ steps:
29
+ - name: Checkout repository
30
+ uses: actions/checkout@v4
31
+ with:
32
+ fetch-depth: 1
33
+
34
+ - name: Run Claude Code Review
35
+ id: claude-review
36
+ uses: anthropics/claude-code-action@v1
37
+ with:
38
+ claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
39
+ prompt: |
40
+ REPO: ${{ github.repository }}
41
+ PR NUMBER: ${{ github.event.pull_request.number }}
42
+
43
+ Please review this pull request and provide feedback on:
44
+ - Code quality and best practices
45
+ - Potential bugs or issues
46
+ - Performance considerations
47
+ - Security concerns
48
+ - Test coverage
49
+
50
+ Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.
51
+
52
+ Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.
53
+
54
+ # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
55
+ # or https://docs.claude.com/en/docs/claude-code/cli-reference for available options
56
+ claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'
57
+
@@ -1,50 +1,50 @@
1
- name: Claude Code
2
-
3
- on:
4
- issue_comment:
5
- types: [created]
6
- pull_request_review_comment:
7
- types: [created]
8
- issues:
9
- types: [opened, assigned]
10
- pull_request_review:
11
- types: [submitted]
12
-
13
- jobs:
14
- claude:
15
- if: |
16
- (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17
- (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18
- (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19
- (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
20
- runs-on: ubuntu-latest
21
- permissions:
22
- contents: read
23
- pull-requests: read
24
- issues: read
25
- id-token: write
26
- actions: read # Required for Claude to read CI results on PRs
27
- steps:
28
- - name: Checkout repository
29
- uses: actions/checkout@v4
30
- with:
31
- fetch-depth: 1
32
-
33
- - name: Run Claude Code
34
- id: claude
35
- uses: anthropics/claude-code-action@v1
36
- with:
37
- claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
38
-
39
- # This is an optional setting that allows Claude to read CI results on PRs
40
- additional_permissions: |
41
- actions: read
42
-
43
- # Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
44
- # prompt: 'Update the pull request description to include a summary of changes.'
45
-
46
- # Optional: Add claude_args to customize behavior and configuration
47
- # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
48
- # or https://docs.claude.com/en/docs/claude-code/cli-reference for available options
49
- # claude_args: '--allowed-tools Bash(gh pr:*)'
50
-
1
+ name: Claude Code
2
+
3
+ on:
4
+ issue_comment:
5
+ types: [created]
6
+ pull_request_review_comment:
7
+ types: [created]
8
+ issues:
9
+ types: [opened, assigned]
10
+ pull_request_review:
11
+ types: [submitted]
12
+
13
+ jobs:
14
+ claude:
15
+ if: |
16
+ (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17
+ (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18
+ (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19
+ (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
20
+ runs-on: ubuntu-latest
21
+ permissions:
22
+ contents: read
23
+ pull-requests: read
24
+ issues: read
25
+ id-token: write
26
+ actions: read # Required for Claude to read CI results on PRs
27
+ steps:
28
+ - name: Checkout repository
29
+ uses: actions/checkout@v4
30
+ with:
31
+ fetch-depth: 1
32
+
33
+ - name: Run Claude Code
34
+ id: claude
35
+ uses: anthropics/claude-code-action@v1
36
+ with:
37
+ claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
38
+
39
+ # This is an optional setting that allows Claude to read CI results on PRs
40
+ additional_permissions: |
41
+ actions: read
42
+
43
+ # Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
44
+ # prompt: 'Update the pull request description to include a summary of changes.'
45
+
46
+ # Optional: Add claude_args to customize behavior and configuration
47
+ # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
48
+ # or https://docs.claude.com/en/docs/claude-code/cli-reference for available options
49
+ # claude_args: '--allowed-tools Bash(gh pr:*)'
50
+
@@ -1,22 +1,22 @@
1
- name: Full Integration Suite
2
-
3
- on:
4
- schedule:
5
- - cron: '0 2 * * *'
6
- workflow_dispatch:
7
-
8
- jobs:
9
- run-full-suite:
10
- runs-on: ubuntu-latest
11
- env:
12
- YNAB_ACCESS_TOKEN: ${{ secrets.YNAB_ACCESS_TOKEN }}
13
- steps:
14
- - uses: actions/checkout@v4
15
- - uses: actions/setup-node@v4
16
- with:
17
- node-version: 20
18
- cache: npm
19
- - name: Install dependencies
20
- run: npm ci
21
- - name: Run throttled full integration suite
22
- run: npm run test:integration:full
1
+ name: Full Integration Suite
2
+
3
+ on:
4
+ schedule:
5
+ - cron: '0 2 * * *'
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ run-full-suite:
10
+ runs-on: ubuntu-latest
11
+ env:
12
+ YNAB_ACCESS_TOKEN: ${{ secrets.YNAB_ACCESS_TOKEN }}
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: actions/setup-node@v4
16
+ with:
17
+ node-version: 20
18
+ cache: npm
19
+ - name: Install dependencies
20
+ run: npm ci
21
+ - name: Run throttled full integration suite
22
+ run: npm run test:integration:full
@@ -1,11 +1,18 @@
1
1
  name: Publish to npm
2
2
 
3
3
  on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ tag:
7
+ description: 'Tag or ref to publish (e.g., v0.17.0)'
8
+ required: true
4
9
  release:
5
10
  types: [published]
6
11
 
7
12
  jobs:
8
13
  publish:
14
+ # Required to satisfy npm Trusted Publisher matching (environment name left blank in npm)
15
+ environment: npm-publish
9
16
  runs-on: ubuntu-latest
10
17
  permissions:
11
18
  contents: read
@@ -14,11 +21,14 @@ jobs:
14
21
  YNAB_ACCESS_TOKEN: ${{ secrets.YNAB_ACCESS_TOKEN }}
15
22
  steps:
16
23
  - uses: actions/checkout@v4
24
+ with:
25
+ ref: ${{ inputs.tag || github.ref }}
17
26
 
18
27
  - uses: actions/setup-node@v4
19
28
  with:
20
- node-version: 18
29
+ node-version: 24
21
30
  registry-url: https://registry.npmjs.org
31
+ scope: '@dizzlkheinz'
22
32
 
23
33
  - name: Install dependencies
24
34
  run: npm ci
@@ -28,6 +38,5 @@ jobs:
28
38
 
29
39
  - name: Publish to npm
30
40
  run: |
31
- echo "Using npm Trusted Publishing (OIDC)"
32
41
  npm run test:unit
33
42
  npm publish --provenance --access public
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.16.0
9
+ **Current Version:** 0.17.0
10
10
 
11
11
  ## Essential Commands
12
12
 
@@ -20,8 +20,6 @@ npm run dev # TypeScript watch mode for development
20
20
  npm run type-check # Run TypeScript type checking without emitting files
21
21
  ```
22
22
 
23
- See [docs/development/BUILD.md](docs/development/BUILD.md) for detailed build information.
24
-
25
23
  ### Testing
26
24
 
27
25
  ```bash
@@ -47,8 +45,6 @@ npm run test:comprehensive # Run comprehensive test suite
47
45
  npm run test:all # Run all tests (unit, integration, e2e, performance)
48
46
  ```
49
47
 
50
- See [docs/guides/TESTING.md](docs/guides/TESTING.md) for comprehensive testing documentation.
51
-
52
48
  ### Code Quality
53
49
 
54
50
  ```bash
@@ -69,8 +65,6 @@ npm run prepare # Prepare package for publication (runs build:prod)
69
65
  npm run prepublishOnly # Pre-publish checks (runs tests + build)
70
66
  ```
71
67
 
72
- See [docs/guides/DEPLOYMENT.md](docs/guides/DEPLOYMENT.md) for deployment instructions.
73
-
74
68
  ## Architecture Overview
75
69
 
76
70
  The architecture is modular and service-oriented:
@@ -95,6 +89,14 @@ The architecture is modular and service-oriented:
95
89
  - **requestLogger.ts** - Request/response logging middleware
96
90
  - **cacheKeys.ts** - Centralized cache key generation utilities
97
91
 
92
+ ### Tool Registration Pattern (2025-12)
93
+
94
+ - `ToolContext` (`src/types/toolRegistration.ts`) centralizes shared deps (ynabAPI, deltaFetcher/cache, knowledge store, default budget accessors, cache/diagnostic managers).
95
+ - Adapter helpers (`src/tools/adapters.ts`): `adapt`, `adaptNoInput`, `adaptWithDelta`, `adaptWrite`, and `createBudgetResolver` to inject default budget IDs; covered by unit tests in `src/tools/__tests__/adapters.test.ts`.
96
+ - Domain factories (`register*Tools`) live in each tool file: budget, account, transaction, category, payee, month, utility, reconciliation. `setupToolRegistry` now delegates to these factories.
97
+ - Shared schemas: `emptyObjectSchema`, `looseObjectSchema` in `src/tools/schemas/common.ts`.
98
+ - Server-owned inline tools that stay in `YNABMCPServer`: `set_default_budget`, `get_default_budget`, `diagnostic_info`, `clear_cache`, `set_output_format` (they depend on server internals).
99
+
98
100
  ### Tool Implementation (`src/tools/`)
99
101
 
100
102
  Tools are organized by domain with some using modular sub-directories:
@@ -106,6 +108,9 @@ Tools are organized by domain with some using modular sub-directories:
106
108
  - **payeeTools.ts** - Payee listing and retrieval
107
109
  - **monthTools.ts** - Monthly budget data
108
110
  - **utilityTools.ts** - User info and amount conversion
111
+ - **adapters.ts** - Tool adapter implementations
112
+ - **toolCategories.ts** - Tool categorization utilities
113
+ - **compareTransactions.ts** - Transaction comparison tool entry point
109
114
  - **exportTransactions.ts** - Transaction export to JSON files
110
115
  - **reconcileAdapter.ts** - Legacy adapter for reconciliation tool
111
116
  - **deltaFetcher.ts** - Delta request utilities for efficient API updates
@@ -281,12 +286,12 @@ The system defines 5 preset annotation patterns in `src/tools/toolCategories.ts`
281
286
  - Characteristics: Write operations, destructive, idempotent, external API
282
287
 
283
288
  - **UTILITY_LOCAL** - Local utility tools without external API calls
284
- - Examples: `convert_amount`, `clear_cache`, `diagnostic_info`
289
+ - Examples: `clear_cache`, `diagnostic_info`, `set_output_format`
285
290
  - Characteristics: Local operations, no external API dependencies
286
291
 
287
292
  ### Complete Tool Classification
288
293
 
289
- All tools are classified into the following categories:
294
+ All 29 tools are classified into the following categories:
290
295
 
291
296
  **Read-Only External (15 tools):**
292
297
 
@@ -304,20 +309,9 @@ All tools are classified into the following categories:
304
309
 
305
310
  - `delete_transaction` ⚠️
306
311
 
307
- **Utility Local (5 tools):**
312
+ **Utility Local (4 tools):**
308
313
 
309
- - `get_default_budget`, `convert_amount`, `diagnostic_info`, `clear_cache`, `set_output_format`
310
-
311
- ### Expected Benefits
312
-
313
- The tool annotation system provides several advantages:
314
-
315
- - **Enhanced AI Client UX** - AI assistants like Claude can show warnings/confirmations for destructive tools
316
- - **Safer Workflows** - AI understands which tools are dangerous and can prompt for confirmation before execution
317
- - **Better Tool Discovery** - Annotations help AI clients understand tool capabilities and constraints
318
- - **Future-Proof Integration** - As more MCP clients emerge, they'll respect these standard annotations
319
- - **Self-Documenting API** - Metadata provides clear documentation of tool behavior without reading implementation
320
- - **Zero Breaking Changes** - Fully backward compatible, annotations are advisory only and don't affect tool execution
314
+ - `get_default_budget`, `diagnostic_info`, `clear_cache`, `set_output_format`
321
315
 
322
316
  ### Usage Example
323
317
 
@@ -435,10 +429,11 @@ Strict mode enabled with extensive safety checks:
435
429
 
436
430
  1. Create Zod schema in appropriate tool file (e.g., `src/tools/myTools.ts`)
437
431
  2. Implement handler function following existing patterns
438
- 3. Register tool in `YNABMCPServer.ts` using `ToolRegistry`
432
+ 3. Register the tool in the appropriate domain factory (e.g., `registerBudgetTools` in
433
+ `src/tools/budgetTools.ts`) using `ToolRegistry`
439
434
  4. Add unit tests in `src/tools/__tests__/myTools.test.ts`
440
435
  5. Add integration tests in `src/tools/__tests__/myTools.integration.test.ts`
441
- 6. Update API documentation in `docs/API.md`
436
+ 6. Update API documentation in `docs/reference/API.md`
442
437
 
443
438
  ### Modifying Cache Behavior
444
439
 
@@ -453,27 +448,12 @@ Service modules (like diagnostics, resources, prompts) follow a pattern:
453
448
  3. Register in `YNABMCPServer` constructor
454
449
  4. Add tests in `src/server/__tests__/`
455
450
 
456
- ## MCPB Packaging for Claude Desktop
457
-
458
- The project builds a `.mcpb` file (MCP extension for Claude Desktop):
459
-
460
- ```bash
461
- npm run package:mcpb
462
- ```
463
-
464
- Output: `dist/ynab-mcp-server-<version>.mcpb`
465
-
466
- The MCPB includes:
467
-
468
- - Bundled Node.js code (single file, no node_modules)
469
- - Manifest with extension metadata
470
- - Environment variable configuration schema
471
-
472
- ## Git & Version Control
451
+ ## Git Workflow
473
452
 
474
453
  - **Main branch**: `master`
475
- - **Versioning**: Semantic versioning (currently 0.x.y - pre-1.0 API)
476
- - **Commit style**: Conventional commits encouraged (feat:, fix:, chore:, etc.)
454
+ - **Commit style**: Conventional commits (feat:, fix:, chore:, refactor:, test:, docs:)
455
+ - Run `npm test` and `npm run lint` before committing
456
+ - PR titles should follow: `type: description` (e.g., `feat: add bulk transaction import`)
477
457
 
478
458
  ## Reconciliation System
479
459
 
@@ -497,13 +477,19 @@ The reconciliation tool (`reconcile_account`) is a comprehensive account reconci
497
477
 
498
478
  See `docs/technical/reconciliation-system-architecture.md` for detailed documentation.
499
479
 
480
+ ## Boundaries
481
+
482
+ - ✅ **Always do**: Run `npm test` before commits, use milliunits for YNAB amounts, follow existing patterns
483
+ - ✅ **Always do**: Use `.js` extensions in imports, validate inputs with Zod schemas
484
+ - ⚠️ **Ask first**: Adding new dependencies, changing API response formats, modifying cache TTLs (see `src/server/cacheManager.ts`)
485
+ - 🚫 **Never do**: Commit `.env` or secrets, edit `dist/` or `node_modules/`, skip type checking
486
+ - 🚫 **Never do**: Remove failing tests without fixing, use `any` type without justification
487
+
500
488
  ## Important Notes
501
489
 
502
- - **Cache Invalidation**: Write operations (create, update, delete) should invalidate related caches
490
+ - **Amount Handling**: YNAB uses milliunits (1 dollar = 1000 milliunits) - always convert
503
491
  - **Date Format**: Always use ISO format `YYYY-MM-DD` for dates
504
492
  - **Budget ID Resolution**: Most tools auto-resolve budget_id from default budget if not provided
505
493
  - **Error Responses**: All errors return consistent JSON format via `ErrorHandler`
506
- - **Security**: Input validation via Zod schemas, security middleware wraps all tool executions
494
+ - **Cache Invalidation**: Write operations (create, update, delete) should invalidate related caches
507
495
  - **Rate Limiting**: YNAB API has rate limits - use delta caching and aggressive caching strategies
508
- - **Delta Requests**: Delta cache automatically manages server_knowledge tracking for efficient updates
509
- - **Resource Templates**: Use `ynab://` URI patterns for dynamic resource access