memory-journal-mcp 4.4.2 → 5.0.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.
Files changed (291) hide show
  1. package/.github/workflows/codeql.yml +1 -6
  2. package/.github/workflows/docker-publish.yml +15 -49
  3. package/.github/workflows/lint-and-test.yml +1 -1
  4. package/.github/workflows/secrets-scanning.yml +4 -3
  5. package/.github/workflows/security-update.yml +3 -3
  6. package/CHANGELOG.md +213 -0
  7. package/CONTRIBUTING.md +132 -97
  8. package/DOCKER_README.md +184 -235
  9. package/Dockerfile +27 -24
  10. package/README.md +218 -190
  11. package/SECURITY.md +27 -35
  12. package/dist/cli.js +16 -1
  13. package/dist/cli.js.map +1 -1
  14. package/dist/constants/ServerInstructions.d.ts +5 -1
  15. package/dist/constants/ServerInstructions.d.ts.map +1 -1
  16. package/dist/constants/ServerInstructions.js +133 -73
  17. package/dist/constants/ServerInstructions.js.map +1 -1
  18. package/dist/constants/icons.d.ts +2 -2
  19. package/dist/constants/icons.d.ts.map +1 -1
  20. package/dist/constants/icons.js +7 -6
  21. package/dist/constants/icons.js.map +1 -1
  22. package/dist/database/SqliteAdapter.d.ts +37 -24
  23. package/dist/database/SqliteAdapter.d.ts.map +1 -1
  24. package/dist/database/SqliteAdapter.js +319 -157
  25. package/dist/database/SqliteAdapter.js.map +1 -1
  26. package/dist/database/schema.d.ts +45 -0
  27. package/dist/database/schema.d.ts.map +1 -0
  28. package/dist/database/schema.js +92 -0
  29. package/dist/database/schema.js.map +1 -0
  30. package/dist/filtering/ToolFilter.d.ts +1 -1
  31. package/dist/filtering/ToolFilter.d.ts.map +1 -1
  32. package/dist/filtering/ToolFilter.js +13 -2
  33. package/dist/filtering/ToolFilter.js.map +1 -1
  34. package/dist/github/GitHubIntegration.d.ts.map +1 -1
  35. package/dist/github/GitHubIntegration.js +1 -3
  36. package/dist/github/GitHubIntegration.js.map +1 -1
  37. package/dist/handlers/prompts/github.d.ts +12 -0
  38. package/dist/handlers/prompts/github.d.ts.map +1 -0
  39. package/dist/handlers/prompts/github.js +178 -0
  40. package/dist/handlers/prompts/github.js.map +1 -0
  41. package/dist/handlers/prompts/index.d.ts +23 -2
  42. package/dist/handlers/prompts/index.d.ts.map +1 -1
  43. package/dist/handlers/prompts/index.js +7 -432
  44. package/dist/handlers/prompts/index.js.map +1 -1
  45. package/dist/handlers/prompts/workflow.d.ts +12 -0
  46. package/dist/handlers/prompts/workflow.d.ts.map +1 -0
  47. package/dist/handlers/prompts/workflow.js +277 -0
  48. package/dist/handlers/prompts/workflow.js.map +1 -0
  49. package/dist/handlers/resources/core.d.ts +11 -0
  50. package/dist/handlers/resources/core.d.ts.map +1 -0
  51. package/dist/handlers/resources/core.js +433 -0
  52. package/dist/handlers/resources/core.js.map +1 -0
  53. package/dist/handlers/resources/github.d.ts +11 -0
  54. package/dist/handlers/resources/github.d.ts.map +1 -0
  55. package/dist/handlers/resources/github.js +314 -0
  56. package/dist/handlers/resources/github.js.map +1 -0
  57. package/dist/handlers/resources/graph.d.ts +11 -0
  58. package/dist/handlers/resources/graph.d.ts.map +1 -0
  59. package/dist/handlers/resources/graph.js +204 -0
  60. package/dist/handlers/resources/graph.js.map +1 -0
  61. package/dist/handlers/resources/index.d.ts +5 -20
  62. package/dist/handlers/resources/index.d.ts.map +1 -1
  63. package/dist/handlers/resources/index.js +16 -1278
  64. package/dist/handlers/resources/index.js.map +1 -1
  65. package/dist/handlers/resources/shared.d.ts +60 -0
  66. package/dist/handlers/resources/shared.d.ts.map +1 -0
  67. package/dist/handlers/resources/shared.js +49 -0
  68. package/dist/handlers/resources/shared.js.map +1 -0
  69. package/dist/handlers/resources/team.d.ts +13 -0
  70. package/dist/handlers/resources/team.d.ts.map +1 -0
  71. package/dist/handlers/resources/team.js +119 -0
  72. package/dist/handlers/resources/team.js.map +1 -0
  73. package/dist/handlers/resources/templates.d.ts +13 -0
  74. package/dist/handlers/resources/templates.d.ts.map +1 -0
  75. package/dist/handlers/resources/templates.js +310 -0
  76. package/dist/handlers/resources/templates.js.map +1 -0
  77. package/dist/handlers/tools/admin.d.ts +8 -0
  78. package/dist/handlers/tools/admin.d.ts.map +1 -0
  79. package/dist/handlers/tools/admin.js +270 -0
  80. package/dist/handlers/tools/admin.js.map +1 -0
  81. package/dist/handlers/tools/analytics.d.ts +8 -0
  82. package/dist/handlers/tools/analytics.d.ts.map +1 -0
  83. package/dist/handlers/tools/analytics.js +256 -0
  84. package/dist/handlers/tools/analytics.js.map +1 -0
  85. package/dist/handlers/tools/backup.d.ts +8 -0
  86. package/dist/handlers/tools/backup.d.ts.map +1 -0
  87. package/dist/handlers/tools/backup.js +224 -0
  88. package/dist/handlers/tools/backup.js.map +1 -0
  89. package/dist/handlers/tools/core.d.ts +9 -0
  90. package/dist/handlers/tools/core.d.ts.map +1 -0
  91. package/dist/handlers/tools/core.js +326 -0
  92. package/dist/handlers/tools/core.js.map +1 -0
  93. package/dist/handlers/tools/export.d.ts +8 -0
  94. package/dist/handlers/tools/export.d.ts.map +1 -0
  95. package/dist/handlers/tools/export.js +89 -0
  96. package/dist/handlers/tools/export.js.map +1 -0
  97. package/dist/handlers/tools/github/helpers.d.ts +34 -0
  98. package/dist/handlers/tools/github/helpers.d.ts.map +1 -0
  99. package/dist/handlers/tools/github/helpers.js +52 -0
  100. package/dist/handlers/tools/github/helpers.js.map +1 -0
  101. package/dist/handlers/tools/github/insights-tools.d.ts +8 -0
  102. package/dist/handlers/tools/github/insights-tools.d.ts.map +1 -0
  103. package/dist/handlers/tools/github/insights-tools.js +104 -0
  104. package/dist/handlers/tools/github/insights-tools.js.map +1 -0
  105. package/dist/handlers/tools/github/issue-tools.d.ts +8 -0
  106. package/dist/handlers/tools/github/issue-tools.d.ts.map +1 -0
  107. package/dist/handlers/tools/github/issue-tools.js +359 -0
  108. package/dist/handlers/tools/github/issue-tools.js.map +1 -0
  109. package/dist/handlers/tools/github/kanban-tools.d.ts +8 -0
  110. package/dist/handlers/tools/github/kanban-tools.d.ts.map +1 -0
  111. package/dist/handlers/tools/github/kanban-tools.js +108 -0
  112. package/dist/handlers/tools/github/kanban-tools.js.map +1 -0
  113. package/dist/handlers/tools/github/milestone-tools.d.ts +9 -0
  114. package/dist/handlers/tools/github/milestone-tools.d.ts.map +1 -0
  115. package/dist/handlers/tools/github/milestone-tools.js +302 -0
  116. package/dist/handlers/tools/github/milestone-tools.js.map +1 -0
  117. package/dist/handlers/tools/github/mutation-tools.d.ts +12 -0
  118. package/dist/handlers/tools/github/mutation-tools.d.ts.map +1 -0
  119. package/dist/handlers/tools/github/mutation-tools.js +15 -0
  120. package/dist/handlers/tools/github/mutation-tools.js.map +1 -0
  121. package/dist/handlers/tools/github/read-tools.d.ts +8 -0
  122. package/dist/handlers/tools/github/read-tools.d.ts.map +1 -0
  123. package/dist/handlers/tools/github/read-tools.js +260 -0
  124. package/dist/handlers/tools/github/read-tools.js.map +1 -0
  125. package/dist/handlers/tools/github/schemas.d.ts +467 -0
  126. package/dist/handlers/tools/github/schemas.d.ts.map +1 -0
  127. package/dist/handlers/tools/github/schemas.js +335 -0
  128. package/dist/handlers/tools/github/schemas.js.map +1 -0
  129. package/dist/handlers/tools/github.d.ts +14 -0
  130. package/dist/handlers/tools/github.d.ts.map +1 -0
  131. package/dist/handlers/tools/github.js +28 -0
  132. package/dist/handlers/tools/github.js.map +1 -0
  133. package/dist/handlers/tools/index.d.ts +15 -20
  134. package/dist/handlers/tools/index.d.ts.map +1 -1
  135. package/dist/handlers/tools/index.js +117 -2909
  136. package/dist/handlers/tools/index.js.map +1 -1
  137. package/dist/handlers/tools/relationships.d.ts +8 -0
  138. package/dist/handlers/tools/relationships.d.ts.map +1 -0
  139. package/dist/handlers/tools/relationships.js +308 -0
  140. package/dist/handlers/tools/relationships.js.map +1 -0
  141. package/dist/handlers/tools/schemas.d.ts +108 -0
  142. package/dist/handlers/tools/schemas.d.ts.map +1 -0
  143. package/dist/handlers/tools/schemas.js +122 -0
  144. package/dist/handlers/tools/schemas.js.map +1 -0
  145. package/dist/handlers/tools/search.d.ts +8 -0
  146. package/dist/handlers/tools/search.d.ts.map +1 -0
  147. package/dist/handlers/tools/search.js +282 -0
  148. package/dist/handlers/tools/search.js.map +1 -0
  149. package/dist/handlers/tools/team.d.ts +11 -0
  150. package/dist/handlers/tools/team.d.ts.map +1 -0
  151. package/dist/handlers/tools/team.js +239 -0
  152. package/dist/handlers/tools/team.js.map +1 -0
  153. package/dist/server/McpServer.d.ts +4 -0
  154. package/dist/server/McpServer.d.ts.map +1 -1
  155. package/dist/server/McpServer.js +48 -297
  156. package/dist/server/McpServer.js.map +1 -1
  157. package/dist/server/Scheduler.d.ts +91 -0
  158. package/dist/server/Scheduler.d.ts.map +1 -0
  159. package/dist/server/Scheduler.js +201 -0
  160. package/dist/server/Scheduler.js.map +1 -0
  161. package/dist/transports/http.d.ts +66 -0
  162. package/dist/transports/http.d.ts.map +1 -0
  163. package/dist/transports/http.js +519 -0
  164. package/dist/transports/http.js.map +1 -0
  165. package/dist/types/entities.d.ts +101 -0
  166. package/dist/types/entities.d.ts.map +1 -0
  167. package/dist/types/entities.js +5 -0
  168. package/dist/types/entities.js.map +1 -0
  169. package/dist/types/filtering.d.ts +34 -0
  170. package/dist/types/filtering.d.ts.map +1 -0
  171. package/dist/types/filtering.js +5 -0
  172. package/dist/types/filtering.js.map +1 -0
  173. package/dist/types/github.d.ts +166 -0
  174. package/dist/types/github.d.ts.map +1 -0
  175. package/dist/types/github.js +5 -0
  176. package/dist/types/github.js.map +1 -0
  177. package/dist/types/index.d.ts +35 -292
  178. package/dist/types/index.d.ts.map +1 -1
  179. package/dist/types/index.js +2 -2
  180. package/dist/types/index.js.map +1 -1
  181. package/dist/utils/error-helpers.d.ts +37 -0
  182. package/dist/utils/error-helpers.d.ts.map +1 -0
  183. package/dist/utils/error-helpers.js +47 -0
  184. package/dist/utils/error-helpers.js.map +1 -0
  185. package/dist/utils/logger.d.ts.map +1 -1
  186. package/dist/utils/logger.js +6 -3
  187. package/dist/utils/logger.js.map +1 -1
  188. package/dist/utils/security-utils.d.ts +0 -21
  189. package/dist/utils/security-utils.d.ts.map +1 -1
  190. package/dist/utils/security-utils.js +0 -47
  191. package/dist/utils/security-utils.js.map +1 -1
  192. package/dist/vector/VectorSearchManager.d.ts.map +1 -1
  193. package/dist/vector/VectorSearchManager.js +9 -32
  194. package/dist/vector/VectorSearchManager.js.map +1 -1
  195. package/docker-compose.yml +11 -2
  196. package/hooks/README.md +107 -0
  197. package/hooks/cursor/hooks.json +10 -0
  198. package/hooks/cursor/memory-journal.mdc +22 -0
  199. package/hooks/cursor/session-end.sh +19 -0
  200. package/hooks/kilo-code/session-end-mode.json +11 -0
  201. package/hooks/kiro/session-end.md +13 -0
  202. package/mcp-config-example.json +1 -0
  203. package/package.json +11 -9
  204. package/playwright.config.ts +29 -0
  205. package/releases/v4.5.0.md +116 -0
  206. package/releases/v5.0.0.md +105 -0
  207. package/scripts/generate-server-instructions.ts +176 -0
  208. package/scripts/server-instructions-function-body.ts +77 -0
  209. package/server.json +3 -3
  210. package/src/cli.ts +45 -1
  211. package/src/constants/ServerInstructions.ts +133 -73
  212. package/src/constants/icons.ts +8 -7
  213. package/src/constants/server-instructions.md +268 -0
  214. package/src/database/SqliteAdapter.ts +358 -192
  215. package/src/database/schema.ts +125 -0
  216. package/src/filtering/ToolFilter.ts +13 -2
  217. package/src/github/GitHubIntegration.ts +1 -3
  218. package/src/handlers/prompts/github.ts +209 -0
  219. package/src/handlers/prompts/index.ts +10 -499
  220. package/src/handlers/prompts/workflow.ts +314 -0
  221. package/src/handlers/resources/core.ts +528 -0
  222. package/src/handlers/resources/github.ts +358 -0
  223. package/src/handlers/resources/graph.ts +254 -0
  224. package/src/handlers/resources/index.ts +23 -1570
  225. package/src/handlers/resources/shared.ts +103 -0
  226. package/src/handlers/resources/team.ts +133 -0
  227. package/src/handlers/resources/templates.ts +374 -0
  228. package/src/handlers/tools/admin.ts +285 -0
  229. package/src/handlers/tools/analytics.ts +301 -0
  230. package/src/handlers/tools/backup.ts +242 -0
  231. package/src/handlers/tools/core.ts +350 -0
  232. package/src/handlers/tools/export.ts +115 -0
  233. package/src/handlers/tools/github/helpers.ts +86 -0
  234. package/src/handlers/tools/github/insights-tools.ts +119 -0
  235. package/src/handlers/tools/github/issue-tools.ts +439 -0
  236. package/src/handlers/tools/github/kanban-tools.ts +134 -0
  237. package/src/handlers/tools/github/milestone-tools.ts +392 -0
  238. package/src/handlers/tools/github/mutation-tools.ts +17 -0
  239. package/src/handlers/tools/github/read-tools.ts +328 -0
  240. package/src/handlers/tools/github/schemas.ts +369 -0
  241. package/src/handlers/tools/github.ts +36 -0
  242. package/src/handlers/tools/index.ts +144 -3325
  243. package/src/handlers/tools/relationships.ts +358 -0
  244. package/src/handlers/tools/schemas.ts +132 -0
  245. package/src/handlers/tools/search.ts +343 -0
  246. package/src/handlers/tools/team.ts +273 -0
  247. package/src/server/McpServer.ts +63 -358
  248. package/src/server/Scheduler.ts +278 -0
  249. package/src/transports/http.ts +635 -0
  250. package/src/types/entities.ts +145 -0
  251. package/src/types/filtering.ts +54 -0
  252. package/src/types/github.ts +180 -0
  253. package/src/types/index.ts +67 -375
  254. package/src/utils/error-helpers.ts +52 -0
  255. package/src/utils/logger.ts +6 -3
  256. package/src/utils/security-utils.ts +0 -52
  257. package/src/vector/VectorSearchManager.ts +9 -33
  258. package/tests/constants/icons.test.ts +1 -2
  259. package/tests/constants/server-instructions.test.ts +30 -4
  260. package/tests/database/sqlite-adapter.test.ts +91 -7
  261. package/tests/e2e/auth.spec.ts +154 -0
  262. package/tests/e2e/health.spec.ts +63 -0
  263. package/tests/e2e/protocols.spec.ts +134 -0
  264. package/tests/e2e/resources.spec.ts +103 -0
  265. package/tests/e2e/scheduler.spec.ts +79 -0
  266. package/tests/e2e/security.spec.ts +91 -0
  267. package/tests/e2e/sessions.spec.ts +95 -0
  268. package/tests/e2e/stateless.spec.ts +121 -0
  269. package/tests/e2e/tools.spec.ts +111 -0
  270. package/tests/filtering/tool-filter.test.ts +46 -0
  271. package/tests/handlers/error-path-coverage.test.ts +324 -0
  272. package/tests/handlers/github-resource-handlers.test.ts +453 -0
  273. package/tests/handlers/github-tool-handlers.test.ts +899 -0
  274. package/tests/handlers/prompt-handler-coverage.test.ts +106 -0
  275. package/tests/handlers/prompt-handlers.test.ts +40 -0
  276. package/tests/handlers/resource-handler-coverage.test.ts +181 -0
  277. package/tests/handlers/resource-handlers.test.ts +33 -9
  278. package/tests/handlers/search-tool-handlers.test.ts +272 -0
  279. package/tests/handlers/targeted-gap-closure.test.ts +387 -0
  280. package/tests/handlers/team-resource-handlers.test.ts +156 -0
  281. package/tests/handlers/team-tool-handlers.test.ts +301 -0
  282. package/tests/handlers/tool-handler-coverage.test.ts +469 -0
  283. package/tests/handlers/tool-handlers.test.ts +2 -2
  284. package/tests/security/sql-injection.test.ts +3 -54
  285. package/tests/server/mcp-server.test.ts +503 -8
  286. package/tests/server/scheduler.test.ts +400 -0
  287. package/tests/transports/http-transport.test.ts +620 -0
  288. package/tests/vector/vector-search-manager.test.ts +60 -0
  289. package/vitest.config.ts +4 -1
  290. package/.memory-journal-team.db +0 -0
  291. package/.vscode/settings.json +0 -84
@@ -0,0 +1,314 @@
1
+ /**
2
+ * Memory Journal MCP Server - GitHub Resource Definitions
3
+ *
4
+ * Resources: github/status, github/insights, github/milestones, milestones/{number}
5
+ */
6
+ import { ICON_GITHUB, ICON_ANALYTICS, ICON_MILESTONE } from '../../constants/icons.js';
7
+ /**
8
+ * Get GitHub resource definitions
9
+ */
10
+ export function getGitHubResourceDefinitions() {
11
+ return [
12
+ {
13
+ uri: 'memory://github/status',
14
+ name: 'GitHub Status',
15
+ title: 'GitHub Repository Status',
16
+ description: 'Compact GitHub status: repository, branch, CI, issues, PRs, Kanban summary',
17
+ mimeType: 'application/json',
18
+ icons: [ICON_GITHUB],
19
+ annotations: {
20
+ audience: ['assistant'],
21
+ priority: 0.7,
22
+ },
23
+ handler: async (_uri, context) => {
24
+ const lastModified = new Date().toISOString();
25
+ if (!context.github) {
26
+ return {
27
+ data: {
28
+ error: 'GitHub integration not available',
29
+ hint: 'Set GITHUB_TOKEN and GITHUB_REPO_PATH environment variables.',
30
+ },
31
+ annotations: { lastModified },
32
+ };
33
+ }
34
+ const repoInfo = await context.github.getRepoInfo();
35
+ const owner = repoInfo.owner;
36
+ const repo = repoInfo.repo;
37
+ if (!owner || !repo) {
38
+ return {
39
+ data: {
40
+ error: 'Could not detect repository',
41
+ hint: 'Set GITHUB_REPO_PATH to your git repository.',
42
+ branch: repoInfo.branch,
43
+ },
44
+ annotations: { lastModified },
45
+ };
46
+ }
47
+ // Get current commit
48
+ let commit = null;
49
+ try {
50
+ const repoContext = await context.github.getRepoContext();
51
+ commit = repoContext.commit;
52
+ }
53
+ catch {
54
+ // Ignore
55
+ }
56
+ // Get open issues (limited for token efficiency)
57
+ const issues = await context.github.getIssues(owner, repo, 'open', 5);
58
+ const openIssues = issues.map((i) => ({
59
+ number: i.number,
60
+ title: i.title.slice(0, 50),
61
+ }));
62
+ // Get open PRs (limited for token efficiency)
63
+ const prs = await context.github.getPullRequests(owner, repo, 'open', 5);
64
+ const openPrs = prs.map((pr) => ({
65
+ number: pr.number,
66
+ title: pr.title.slice(0, 50),
67
+ state: pr.state,
68
+ }));
69
+ // Get CI status from latest workflow run
70
+ const workflowRuns = await context.github.getWorkflowRuns(owner, repo, 5);
71
+ let ciStatus = 'unknown';
72
+ let latestRun = null;
73
+ if (workflowRuns.length > 0) {
74
+ const latestCompleted = workflowRuns.find((r) => r.status === 'completed');
75
+ const latest = workflowRuns[0];
76
+ latestRun = {
77
+ name: latest?.name ?? 'Unknown',
78
+ conclusion: latest?.conclusion ?? null,
79
+ headSha: latest?.headSha?.slice(0, 7) ?? '',
80
+ };
81
+ if (latestCompleted) {
82
+ switch (latestCompleted.conclusion) {
83
+ case 'success':
84
+ ciStatus = 'passing';
85
+ break;
86
+ case 'failure':
87
+ ciStatus = 'failing';
88
+ break;
89
+ case 'cancelled':
90
+ ciStatus = 'cancelled';
91
+ break;
92
+ default:
93
+ ciStatus = 'unknown';
94
+ }
95
+ }
96
+ else if (workflowRuns.some((r) => r.status !== 'completed')) {
97
+ ciStatus = 'pending';
98
+ }
99
+ }
100
+ // Get Kanban summary if project 1 exists
101
+ let kanbanSummary = null;
102
+ try {
103
+ const kanban = await context.github.getProjectKanban(owner, 1, repo);
104
+ if (kanban) {
105
+ kanbanSummary = {};
106
+ for (const col of kanban.columns) {
107
+ kanbanSummary[col.status] = col.items.length;
108
+ }
109
+ }
110
+ }
111
+ catch {
112
+ // Kanban not available
113
+ }
114
+ // Get milestone summary
115
+ let milestoneSummary = null;
116
+ try {
117
+ const milestones = await context.github.getMilestones(owner, repo, 'open', 5);
118
+ if (milestones.length > 0) {
119
+ milestoneSummary = milestones.map((ms) => {
120
+ const total = ms.openIssues + ms.closedIssues;
121
+ const pct = total > 0 ? Math.round((ms.closedIssues / total) * 100) : 0;
122
+ return {
123
+ number: ms.number,
124
+ title: ms.title,
125
+ state: ms.state,
126
+ openIssues: ms.openIssues,
127
+ closedIssues: ms.closedIssues,
128
+ completionPercentage: pct,
129
+ dueOn: ms.dueOn,
130
+ };
131
+ });
132
+ }
133
+ }
134
+ catch {
135
+ // Milestones not available
136
+ }
137
+ return {
138
+ data: {
139
+ repository: `${owner}/${repo}`,
140
+ branch: repoInfo.branch,
141
+ commit: commit?.slice(0, 7) ?? null,
142
+ ci: {
143
+ status: ciStatus,
144
+ latestRun,
145
+ },
146
+ issues: {
147
+ openCount: issues.length,
148
+ items: openIssues,
149
+ },
150
+ pullRequests: {
151
+ openCount: prs.length,
152
+ items: openPrs,
153
+ },
154
+ kanbanSummary,
155
+ milestones: milestoneSummary,
156
+ },
157
+ annotations: { lastModified },
158
+ };
159
+ },
160
+ },
161
+ // Repository insights resource
162
+ {
163
+ uri: 'memory://github/insights',
164
+ name: 'Repository Insights',
165
+ title: 'Repository Stars & Traffic Summary',
166
+ description: 'Compact repo insights: stars, forks, 14-day traffic totals (~150 tokens)',
167
+ mimeType: 'application/json',
168
+ icons: [ICON_ANALYTICS],
169
+ annotations: {
170
+ audience: ['assistant'],
171
+ priority: 0.4,
172
+ },
173
+ handler: async (_uri, context) => {
174
+ const lastModified = new Date().toISOString();
175
+ if (!context.github) {
176
+ return {
177
+ data: {
178
+ error: 'GitHub integration not available',
179
+ hint: 'Set GITHUB_TOKEN and GITHUB_REPO_PATH environment variables.',
180
+ },
181
+ annotations: { lastModified },
182
+ };
183
+ }
184
+ const repoInfo = await context.github.getRepoInfo();
185
+ const owner = repoInfo.owner;
186
+ const repo = repoInfo.repo;
187
+ if (!owner || !repo) {
188
+ return {
189
+ data: {
190
+ error: 'Could not detect repository',
191
+ hint: 'Set GITHUB_REPO_PATH to your git repository.',
192
+ },
193
+ annotations: { lastModified },
194
+ };
195
+ }
196
+ const stats = await context.github.getRepoStats(owner, repo);
197
+ let traffic = null;
198
+ try {
199
+ const trafficData = await context.github.getTrafficData(owner, repo);
200
+ if (trafficData) {
201
+ traffic = {
202
+ clones14d: trafficData.clones.total,
203
+ views14d: trafficData.views.total,
204
+ };
205
+ }
206
+ }
207
+ catch {
208
+ // Traffic data requires push access
209
+ }
210
+ return {
211
+ data: {
212
+ repository: `${owner}/${repo}`,
213
+ stars: stats?.stars ?? null,
214
+ forks: stats?.forks ?? null,
215
+ watchers: stats?.watchers ?? null,
216
+ ...(traffic ?? {}),
217
+ hint: !traffic
218
+ ? 'Traffic data requires push access to the repository.'
219
+ : undefined,
220
+ },
221
+ annotations: { lastModified },
222
+ };
223
+ },
224
+ },
225
+ // Milestone resources
226
+ {
227
+ uri: 'memory://github/milestones',
228
+ name: 'GitHub Milestones',
229
+ title: 'GitHub Repository Milestones',
230
+ description: 'Open GitHub milestones with completion percentages, due dates, and issue counts',
231
+ mimeType: 'application/json',
232
+ icons: [ICON_MILESTONE],
233
+ annotations: {
234
+ audience: ['assistant'],
235
+ priority: 0.6,
236
+ },
237
+ handler: async (_uri, context) => {
238
+ if (!context.github) {
239
+ return {
240
+ error: 'GitHub integration not available',
241
+ hint: 'Set GITHUB_TOKEN and GITHUB_REPO_PATH environment variables.',
242
+ };
243
+ }
244
+ const repoInfo = await context.github.getRepoInfo();
245
+ const owner = repoInfo.owner;
246
+ const repo = repoInfo.repo;
247
+ if (!owner || !repo) {
248
+ return {
249
+ error: 'Could not detect repository',
250
+ hint: 'Set GITHUB_REPO_PATH to your git repository.',
251
+ };
252
+ }
253
+ const milestones = await context.github.getMilestones(owner, repo, 'open', 20);
254
+ const milestonesWithProgress = milestones.map((ms) => {
255
+ const total = ms.openIssues + ms.closedIssues;
256
+ const completionPercentage = total > 0 ? Math.round((ms.closedIssues / total) * 100) : 0;
257
+ return { ...ms, completionPercentage };
258
+ });
259
+ return {
260
+ repository: `${owner}/${repo}`,
261
+ milestones: milestonesWithProgress,
262
+ count: milestonesWithProgress.length,
263
+ hint: 'Use get_github_milestones tool for state filtering. Use memory://milestones/{number} for detail.',
264
+ };
265
+ },
266
+ },
267
+ {
268
+ uri: 'memory://milestones/{number}',
269
+ name: 'Milestone Detail',
270
+ title: 'GitHub Milestone Detail',
271
+ description: 'Detailed view of a single GitHub milestone with completion progress and issue counts. Use get_github_issues with the milestone filter for individual issue details.',
272
+ mimeType: 'application/json',
273
+ icons: [ICON_MILESTONE],
274
+ annotations: {
275
+ audience: ['assistant'],
276
+ priority: 0.5,
277
+ },
278
+ handler: async (uri, context) => {
279
+ const match = /memory:\/\/milestones\/(\d+)/.exec(uri);
280
+ const milestoneNumber = match?.[1] ? parseInt(match[1], 10) : null;
281
+ if (milestoneNumber === null) {
282
+ return { error: 'Invalid milestone number' };
283
+ }
284
+ if (!context.github) {
285
+ return {
286
+ error: 'GitHub integration not available',
287
+ hint: 'Set GITHUB_TOKEN and GITHUB_REPO_PATH environment variables.',
288
+ };
289
+ }
290
+ const repoInfo = await context.github.getRepoInfo();
291
+ const owner = repoInfo.owner;
292
+ const repo = repoInfo.repo;
293
+ if (!owner || !repo) {
294
+ return {
295
+ error: 'Could not detect repository',
296
+ hint: 'Set GITHUB_REPO_PATH to your git repository.',
297
+ };
298
+ }
299
+ const milestone = await context.github.getMilestone(owner, repo, milestoneNumber);
300
+ if (!milestone) {
301
+ return { error: `Milestone #${String(milestoneNumber)} not found` };
302
+ }
303
+ const total = milestone.openIssues + milestone.closedIssues;
304
+ const completionPercentage = total > 0 ? Math.round((milestone.closedIssues / total) * 100) : 0;
305
+ return {
306
+ repository: `${owner}/${repo}`,
307
+ milestone: { ...milestone, completionPercentage },
308
+ hint: 'Use get_github_issues tool to list issues associated with this milestone.',
309
+ };
310
+ },
311
+ },
312
+ ];
313
+ }
314
+ //# sourceMappingURL=github.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github.js","sourceRoot":"","sources":["../../../src/handlers/resources/github.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAGtF;;GAEG;AACH,MAAM,UAAU,4BAA4B;IACxC,OAAO;QACH;YACI,GAAG,EAAE,wBAAwB;YAC7B,IAAI,EAAE,eAAe;YACrB,KAAK,EAAE,0BAA0B;YACjC,WAAW,EACP,4EAA4E;YAChF,QAAQ,EAAE,kBAAkB;YAC5B,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,WAAW,EAAE;gBACT,QAAQ,EAAE,CAAC,WAAW,CAAC;gBACvB,QAAQ,EAAE,GAAG;aAChB;YACD,OAAO,EAAE,KAAK,EAAE,IAAY,EAAE,OAAwB,EAA2B,EAAE;gBAC/E,MAAM,YAAY,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAA;gBAE7C,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;oBAClB,OAAO;wBACH,IAAI,EAAE;4BACF,KAAK,EAAE,kCAAkC;4BACzC,IAAI,EAAE,8DAA8D;yBACvE;wBACD,WAAW,EAAE,EAAE,YAAY,E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AC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Memory Journal MCP Server - Graph Resource Definitions
3
+ *
4
+ * Resources: graph/recent, graph/actions, actions/recent
5
+ */
6
+ import type { InternalResourceDef } from './shared.js';
7
+ /**
8
+ * Get graph resource definitions
9
+ */
10
+ export declare function getGraphResourceDefinitions(): InternalResourceDef[];
11
+ //# sourceMappingURL=graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../src/handlers/resources/graph.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAmB,MAAM,aAAa,CAAA;AAGvE;;GAEG;AACH,wBAAgB,2BAA2B,IAAI,mBAAmB,EAAE,CAgPnE"}
@@ -0,0 +1,204 @@
1
+ /**
2
+ * Memory Journal MCP Server - Graph Resource Definitions
3
+ *
4
+ * Resources: graph/recent, graph/actions, actions/recent
5
+ */
6
+ import { ICON_GRAPH, ICON_GITHUB } from '../../constants/icons.js';
7
+ import { execQuery, transformEntryRow } from './shared.js';
8
+ /**
9
+ * Get graph resource definitions
10
+ */
11
+ export function getGraphResourceDefinitions() {
12
+ return [
13
+ {
14
+ uri: 'memory://graph/recent',
15
+ name: 'Recent Relationship Graph',
16
+ title: 'Live Mermaid Diagram',
17
+ description: 'Live Mermaid diagram of recent relationships',
18
+ mimeType: 'text/plain',
19
+ icons: [ICON_GRAPH],
20
+ annotations: {
21
+ audience: ['user', 'assistant'],
22
+ priority: 0.5,
23
+ },
24
+ handler: (_uri, context) => {
25
+ const relationships = execQuery(context.db, `
26
+ SELECT
27
+ r.id, r.from_entry_id, r.to_entry_id, r.relationship_type, r.description,
28
+ e1.content as from_content,
29
+ e2.content as to_content
30
+ FROM relationships r
31
+ JOIN memory_journal e1 ON r.from_entry_id = e1.id
32
+ JOIN memory_journal e2 ON r.to_entry_id = e2.id
33
+ WHERE e1.deleted_at IS NULL AND e2.deleted_at IS NULL
34
+ ORDER BY r.created_at DESC
35
+ LIMIT 20
36
+ `);
37
+ if (relationships.length === 0) {
38
+ return {
39
+ format: 'mermaid',
40
+ diagram: 'graph TD\n NoData[No relationships found]',
41
+ message: 'No entry relationships exist yet. Use link_entries tool to create relationships.',
42
+ };
43
+ }
44
+ // Build Mermaid graph
45
+ const lines = ['graph TD'];
46
+ const seenNodes = new Set();
47
+ // Relationship type to arrow style mapping
48
+ const arrowStyles = {
49
+ references: '-->',
50
+ evolves_from: '-->',
51
+ depends_on: '-->',
52
+ implements: '==>',
53
+ resolved: '==>',
54
+ clarifies: '-..->',
55
+ caused: '-.->',
56
+ related_to: '<-->',
57
+ response_to: '<-->',
58
+ blocked_by: '--x',
59
+ };
60
+ for (const rel of relationships) {
61
+ if (!seenNodes.has(rel.from_entry_id)) {
62
+ const label = rel.from_content
63
+ .slice(0, 30)
64
+ .replace(/[\]"'`[]]/g, ' ')
65
+ .trim();
66
+ lines.push(` E${String(rel.from_entry_id)}["#${String(rel.from_entry_id)}: ${label}..."]`);
67
+ seenNodes.add(rel.from_entry_id);
68
+ }
69
+ if (!seenNodes.has(rel.to_entry_id)) {
70
+ const label = rel.to_content
71
+ .slice(0, 30)
72
+ .replace(/[\]"'`[]]/g, ' ')
73
+ .trim();
74
+ lines.push(` E${String(rel.to_entry_id)}["#${String(rel.to_entry_id)}: ${label}..."]`);
75
+ seenNodes.add(rel.to_entry_id);
76
+ }
77
+ const arrow = arrowStyles[rel.relationship_type] ?? '-->';
78
+ lines.push(` E${String(rel.from_entry_id)} ${arrow}|${rel.relationship_type}| E${String(rel.to_entry_id)}`);
79
+ }
80
+ return {
81
+ format: 'mermaid',
82
+ diagram: lines.join('\n'),
83
+ relationshipCount: relationships.length,
84
+ nodeCount: seenNodes.size,
85
+ };
86
+ },
87
+ },
88
+ {
89
+ uri: 'memory://graph/actions',
90
+ name: 'Actions Graph',
91
+ title: 'CI/CD Narrative Graph',
92
+ description: 'CI/CD narrative graph: commits → runs → failures → entries → fixes → deployments',
93
+ mimeType: 'text/plain',
94
+ icons: [ICON_GITHUB],
95
+ annotations: {
96
+ audience: ['user', 'assistant'],
97
+ priority: 0.5,
98
+ },
99
+ handler: async (_uri, context) => {
100
+ if (!context.github) {
101
+ return {
102
+ format: 'mermaid',
103
+ diagram: 'graph LR\n NoGitHub[GitHub integration not available]',
104
+ message: 'GitHub integration not configured. Set GITHUB_TOKEN and GITHUB_REPO_PATH.',
105
+ };
106
+ }
107
+ const repoInfo = await context.github.getRepoInfo();
108
+ if (!repoInfo.owner || !repoInfo.repo) {
109
+ return {
110
+ format: 'mermaid',
111
+ diagram: 'graph LR\n NoRepo[Repository not detected]',
112
+ message: 'Could not detect repository. Set GITHUB_REPO_PATH in your config.',
113
+ };
114
+ }
115
+ const workflowRuns = await context.github.getWorkflowRuns(repoInfo.owner, repoInfo.repo, 10);
116
+ if (workflowRuns.length === 0) {
117
+ return {
118
+ format: 'mermaid',
119
+ diagram: 'graph LR\n NoRuns[No workflow runs found]',
120
+ message: 'No GitHub Actions workflow runs found for this repository.',
121
+ };
122
+ }
123
+ const lines = ['graph LR'];
124
+ const statusStyles = {
125
+ success: ':::success',
126
+ failure: ':::failure',
127
+ cancelled: ':::cancelled',
128
+ skipped: ':::skipped',
129
+ };
130
+ lines.push(' classDef success fill:#28a745,color:#fff');
131
+ lines.push(' classDef failure fill:#dc3545,color:#fff');
132
+ lines.push(' classDef cancelled fill:#6c757d,color:#fff');
133
+ lines.push(' classDef skipped fill:#ffc107,color:#000');
134
+ for (const run of workflowRuns) {
135
+ const shortSha = run.headSha.slice(0, 7);
136
+ const nodeId = `R${String(run.id)}`;
137
+ const commitId = `C${shortSha}`;
138
+ const style = statusStyles[run.conclusion ?? 'skipped'] ?? '';
139
+ const statusIcon = run.conclusion === 'success'
140
+ ? '✓'
141
+ : run.conclusion === 'failure'
142
+ ? '✗'
143
+ : '○';
144
+ lines.push(` ${commitId}["${shortSha}"]`);
145
+ lines.push(` ${nodeId}["${statusIcon} ${run.name}"]${style}`);
146
+ lines.push(` ${commitId} --> ${nodeId}`);
147
+ }
148
+ return {
149
+ format: 'mermaid',
150
+ diagram: lines.join('\n'),
151
+ workflowRunCount: workflowRuns.length,
152
+ repository: `${repoInfo.owner}/${repoInfo.repo}`,
153
+ };
154
+ },
155
+ },
156
+ {
157
+ uri: 'memory://actions/recent',
158
+ name: 'Recent Actions',
159
+ title: 'Recent Workflow Runs',
160
+ description: 'Recent workflow runs with CI status',
161
+ mimeType: 'application/json',
162
+ icons: [ICON_GITHUB],
163
+ annotations: {
164
+ audience: ['assistant'],
165
+ priority: 0.5,
166
+ },
167
+ handler: async (_uri, context) => {
168
+ if (context.github) {
169
+ try {
170
+ const repoInfo = await context.github.getRepoInfo();
171
+ if (repoInfo.owner && repoInfo.repo) {
172
+ const runs = await context.github.getWorkflowRuns(repoInfo.owner, repoInfo.repo, 10);
173
+ const entries = runs.map((run) => ({
174
+ id: -1 * run.id,
175
+ entryType: 'tool_output',
176
+ content: `Workflow: ${run.name}\nStatus: ${run.status}\nConclusion: ${run.conclusion || 'pending'}\nBranch: ${run.headBranch}\nURL: ${run.url}`,
177
+ timestamp: run.createdAt,
178
+ isPersonal: false,
179
+ significanceType: null,
180
+ workflowRunId: run.id,
181
+ workflowName: run.name,
182
+ workflowStatus: run.conclusion || run.status,
183
+ }));
184
+ return { entries, count: entries.length, source: 'github_api' };
185
+ }
186
+ }
187
+ catch {
188
+ // Fallback to DB if GitHub fails
189
+ }
190
+ }
191
+ const rows = execQuery(context.db, `
192
+ SELECT * FROM memory_journal
193
+ WHERE workflow_run_id IS NOT NULL
194
+ AND deleted_at IS NULL
195
+ ORDER BY timestamp DESC
196
+ LIMIT 10
197
+ `);
198
+ const entries = rows.map(transformEntryRow);
199
+ return { entries, count: entries.length, source: 'database' };
200
+ },
201
+ },
202
+ ];
203
+ }
204
+ //# sourceMappingURL=graph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.js","sourceRoot":"","sources":["../../../src/handlers/resources/graph.ts"],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AG,EAAE;gCAC/I,SAAS,EAAE,GAAG,CAAC,SAAS;gCACxB,UAAU,EAAE,KAAK;gCACjB,gBAAgB,EAAE,IAAI;gCACtB,aAAa,EAAE,GAAG,CAAC,EAAE;gCACrB,YAAY,EAAE,GAAG,CAAC,IAAI;gCACtB,cAAc,EAAE,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,MAAM;6BAC/C,CAAC,CAAC,CAAA;4BAEH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,CAAA;wBACnE,CAAC;oBACL,CAAC;oBAAC,MAAM,CAAC;wBACL,iCAAiC;oBACrC,CAAC;gBACL,CAAC;gBAED,MAAM,IAAI,GAAG,SAAS,CAClB,OAAO,CAAC,EAAE,EACV;;;;;;iBAMH,CACA,CAAA;gBACD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA;gBAC3C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,CAAA;YACjE,CAAC;SACJ;KACJ,CAAA;AACL,CAAC"}
@@ -1,30 +1,15 @@
1
1
  /**
2
2
  * Memory Journal MCP Server - Resource Handlers
3
3
  *
4
+ * Barrel file composing resource definitions from sub-modules.
4
5
  * Exports all MCP resources with annotations following MCP 2025-11-25 spec.
5
6
  */
6
- import type { SqliteAdapter } from '../../database/SqliteAdapter.js';
7
7
  import type { VectorSearchManager } from '../../vector/VectorSearchManager.js';
8
8
  import type { ToolFilterConfig } from '../../filtering/ToolFilter.js';
9
9
  import type { GitHubIntegration } from '../../github/GitHubIntegration.js';
10
- /**
11
- * Resource context for handlers that need extended access
12
- */
13
- export interface ResourceContext {
14
- db: SqliteAdapter;
15
- vectorManager?: VectorSearchManager;
16
- filterConfig?: ToolFilterConfig | null;
17
- github?: GitHubIntegration | null;
18
- }
19
- /**
20
- * Resource handler result with optional annotations for MCP 2025-11-25
21
- */
22
- export interface ResourceResult {
23
- data: unknown;
24
- annotations?: {
25
- lastModified?: string;
26
- };
27
- }
10
+ import type { Scheduler } from '../../server/Scheduler.js';
11
+ import type { SqliteAdapter } from '../../database/SqliteAdapter.js';
12
+ export type { ResourceContext, ResourceResult, InternalResourceDef } from './shared.js';
28
13
  /**
29
14
  * Get all resource definitions for MCP list
30
15
  */
@@ -32,7 +17,7 @@ export declare function getResources(): object[];
32
17
  /**
33
18
  * Read a resource by URI - returns data and optional annotations
34
19
  */
35
- export declare function readResource(uri: string, db: SqliteAdapter, vectorManager?: VectorSearchManager, filterConfig?: ToolFilterConfig | null, github?: GitHubIntegration | null): Promise<{
20
+ export declare function readResource(uri: string, db: SqliteAdapter, vectorManager?: VectorSearchManager, filterConfig?: ToolFilterConfig | null, github?: GitHubIntegration | null, scheduler?: Scheduler | null, teamDb?: SqliteAdapter): Promise<{
36
21
  data: unknown;
37
22
  annotations?: {
38
23
  lastModified?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/handlers/resources/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAA;AACpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAA;AAC9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAGrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAA;AAmB1E;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,aAAa,CAAA;IACjB,aAAa,CAAC,EAAE,mBAAmB,CAAA;IACnC,YAAY,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAA;IACtC,MAAM,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAA;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,OAAO,CAA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