simple-memory-mcp 1.1.3

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 (247) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +742 -0
  3. package/dist/cli/arg-parser.d.ts +9 -0
  4. package/dist/cli/arg-parser.d.ts.map +1 -0
  5. package/dist/cli/arg-parser.js +68 -0
  6. package/dist/cli/arg-parser.js.map +1 -0
  7. package/dist/cli/help-generator.d.ts +8 -0
  8. package/dist/cli/help-generator.d.ts.map +1 -0
  9. package/dist/cli/help-generator.js +89 -0
  10. package/dist/cli/help-generator.js.map +1 -0
  11. package/dist/cli/index.d.ts +27 -0
  12. package/dist/cli/index.d.ts.map +1 -0
  13. package/dist/cli/index.js +56 -0
  14. package/dist/cli/index.js.map +1 -0
  15. package/dist/cli/query-builder.d.ts +8 -0
  16. package/dist/cli/query-builder.d.ts.map +1 -0
  17. package/dist/cli/query-builder.js +63 -0
  18. package/dist/cli/query-builder.js.map +1 -0
  19. package/dist/cli/shortcuts-config.d.ts +26 -0
  20. package/dist/cli/shortcuts-config.d.ts.map +1 -0
  21. package/dist/cli/shortcuts-config.js +94 -0
  22. package/dist/cli/shortcuts-config.js.map +1 -0
  23. package/dist/graphql/resolvers.d.ts +101 -0
  24. package/dist/graphql/resolvers.d.ts.map +1 -0
  25. package/dist/graphql/resolvers.js +98 -0
  26. package/dist/graphql/resolvers.js.map +1 -0
  27. package/dist/graphql/schema.d.ts +13 -0
  28. package/dist/graphql/schema.d.ts.map +1 -0
  29. package/dist/graphql/schema.js +314 -0
  30. package/dist/graphql/schema.js.map +1 -0
  31. package/dist/index.d.ts +3 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +573 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/services/backup-service.d.ts +57 -0
  36. package/dist/services/backup-service.d.ts.map +1 -0
  37. package/dist/services/backup-service.js +191 -0
  38. package/dist/services/backup-service.js.map +1 -0
  39. package/dist/services/database-optimizer.d.ts +15 -0
  40. package/dist/services/database-optimizer.d.ts.map +1 -0
  41. package/dist/services/database-optimizer.js +45 -0
  42. package/dist/services/database-optimizer.js.map +1 -0
  43. package/dist/services/memory-service.d.ts +126 -0
  44. package/dist/services/memory-service.d.ts.map +1 -0
  45. package/dist/services/memory-service.js +862 -0
  46. package/dist/services/memory-service.js.map +1 -0
  47. package/dist/services/migrations.d.ts +17 -0
  48. package/dist/services/migrations.d.ts.map +1 -0
  49. package/dist/services/migrations.js +273 -0
  50. package/dist/services/migrations.js.map +1 -0
  51. package/dist/tests/backup-export-test.d.ts +2 -0
  52. package/dist/tests/backup-export-test.d.ts.map +1 -0
  53. package/dist/tests/backup-export-test.js +162 -0
  54. package/dist/tests/backup-export-test.js.map +1 -0
  55. package/dist/tests/backup-test.d.ts +14 -0
  56. package/dist/tests/backup-test.d.ts.map +1 -0
  57. package/dist/tests/backup-test.js +209 -0
  58. package/dist/tests/backup-test.js.map +1 -0
  59. package/dist/tests/export-import-test.d.ts +15 -0
  60. package/dist/tests/export-import-test.d.ts.map +1 -0
  61. package/dist/tests/export-import-test.js +227 -0
  62. package/dist/tests/export-import-test.js.map +1 -0
  63. package/dist/tests/graphql-comprehensive-test.d.ts +6 -0
  64. package/dist/tests/graphql-comprehensive-test.d.ts.map +1 -0
  65. package/dist/tests/graphql-comprehensive-test.js +342 -0
  66. package/dist/tests/graphql-comprehensive-test.js.map +1 -0
  67. package/dist/tests/graphql-performance-test.d.ts +6 -0
  68. package/dist/tests/graphql-performance-test.d.ts.map +1 -0
  69. package/dist/tests/graphql-performance-test.js +141 -0
  70. package/dist/tests/graphql-performance-test.js.map +1 -0
  71. package/dist/tests/graphql-test.d.ts +5 -0
  72. package/dist/tests/graphql-test.d.ts.map +1 -0
  73. package/dist/tests/graphql-test.js +47 -0
  74. package/dist/tests/graphql-test.js.map +1 -0
  75. package/dist/tests/memory-server-tests.d.ts +7 -0
  76. package/dist/tests/memory-server-tests.d.ts.map +1 -0
  77. package/dist/tests/memory-server-tests.js +466 -0
  78. package/dist/tests/memory-server-tests.js.map +1 -0
  79. package/dist/tests/migration-test.d.ts +2 -0
  80. package/dist/tests/migration-test.d.ts.map +1 -0
  81. package/dist/tests/migration-test.js +270 -0
  82. package/dist/tests/migration-test.js.map +1 -0
  83. package/dist/tests/performance-benchmark.d.ts +7 -0
  84. package/dist/tests/performance-benchmark.d.ts.map +1 -0
  85. package/dist/tests/performance-benchmark.js +234 -0
  86. package/dist/tests/performance-benchmark.js.map +1 -0
  87. package/dist/tests/performance-test.d.ts +3 -0
  88. package/dist/tests/performance-test.d.ts.map +1 -0
  89. package/dist/tests/performance-test.js +61 -0
  90. package/dist/tests/performance-test.js.map +1 -0
  91. package/dist/tests/time-range-test.d.ts +7 -0
  92. package/dist/tests/time-range-test.d.ts.map +1 -0
  93. package/dist/tests/time-range-test.js +169 -0
  94. package/dist/tests/time-range-test.js.map +1 -0
  95. package/dist/tools/delete-memory/cli-parser.d.ts +2 -0
  96. package/dist/tools/delete-memory/cli-parser.d.ts.map +1 -0
  97. package/dist/tools/delete-memory/cli-parser.js +13 -0
  98. package/dist/tools/delete-memory/cli-parser.js.map +1 -0
  99. package/dist/tools/delete-memory/executor.d.ts +13 -0
  100. package/dist/tools/delete-memory/executor.d.ts.map +1 -0
  101. package/dist/tools/delete-memory/executor.js +40 -0
  102. package/dist/tools/delete-memory/executor.js.map +1 -0
  103. package/dist/tools/delete-memory/index.d.ts +3 -0
  104. package/dist/tools/delete-memory/index.d.ts.map +1 -0
  105. package/dist/tools/delete-memory/index.js +24 -0
  106. package/dist/tools/delete-memory/index.js.map +1 -0
  107. package/dist/tools/export-memory/cli-parser.d.ts +2 -0
  108. package/dist/tools/export-memory/cli-parser.d.ts.map +1 -0
  109. package/dist/tools/export-memory/cli-parser.js +34 -0
  110. package/dist/tools/export-memory/cli-parser.js.map +1 -0
  111. package/dist/tools/export-memory/executor.d.ts +10 -0
  112. package/dist/tools/export-memory/executor.d.ts.map +1 -0
  113. package/dist/tools/export-memory/executor.js +41 -0
  114. package/dist/tools/export-memory/executor.js.map +1 -0
  115. package/dist/tools/export-memory/index.d.ts +4 -0
  116. package/dist/tools/export-memory/index.d.ts.map +1 -0
  117. package/dist/tools/export-memory/index.js +99 -0
  118. package/dist/tools/export-memory/index.js.map +1 -0
  119. package/dist/tools/import-memory/cli-parser.d.ts +2 -0
  120. package/dist/tools/import-memory/cli-parser.d.ts.map +1 -0
  121. package/dist/tools/import-memory/cli-parser.js +25 -0
  122. package/dist/tools/import-memory/cli-parser.js.map +1 -0
  123. package/dist/tools/import-memory/executor.d.ts +8 -0
  124. package/dist/tools/import-memory/executor.d.ts.map +1 -0
  125. package/dist/tools/import-memory/executor.js +31 -0
  126. package/dist/tools/import-memory/executor.js.map +1 -0
  127. package/dist/tools/import-memory/index.d.ts +4 -0
  128. package/dist/tools/import-memory/index.d.ts.map +1 -0
  129. package/dist/tools/import-memory/index.js +70 -0
  130. package/dist/tools/import-memory/index.js.map +1 -0
  131. package/dist/tools/index.d.ts +14 -0
  132. package/dist/tools/index.d.ts.map +1 -0
  133. package/dist/tools/index.js +48 -0
  134. package/dist/tools/index.js.map +1 -0
  135. package/dist/tools/memory-graphql/cli-parser.d.ts +6 -0
  136. package/dist/tools/memory-graphql/cli-parser.d.ts.map +1 -0
  137. package/dist/tools/memory-graphql/cli-parser.js +24 -0
  138. package/dist/tools/memory-graphql/cli-parser.js.map +1 -0
  139. package/dist/tools/memory-graphql/executor.d.ts +18 -0
  140. package/dist/tools/memory-graphql/executor.d.ts.map +1 -0
  141. package/dist/tools/memory-graphql/executor.js +53 -0
  142. package/dist/tools/memory-graphql/executor.js.map +1 -0
  143. package/dist/tools/memory-graphql/index.d.ts +3 -0
  144. package/dist/tools/memory-graphql/index.d.ts.map +1 -0
  145. package/dist/tools/memory-graphql/index.js +73 -0
  146. package/dist/tools/memory-graphql/index.js.map +1 -0
  147. package/dist/tools/memory-stats/cli-parser.d.ts +2 -0
  148. package/dist/tools/memory-stats/cli-parser.d.ts.map +1 -0
  149. package/dist/tools/memory-stats/cli-parser.js +8 -0
  150. package/dist/tools/memory-stats/cli-parser.js.map +1 -0
  151. package/dist/tools/memory-stats/executor.d.ts +4 -0
  152. package/dist/tools/memory-stats/executor.d.ts.map +1 -0
  153. package/dist/tools/memory-stats/executor.js +4 -0
  154. package/dist/tools/memory-stats/executor.js.map +1 -0
  155. package/dist/tools/memory-stats/index.d.ts +3 -0
  156. package/dist/tools/memory-stats/index.d.ts.map +1 -0
  157. package/dist/tools/memory-stats/index.js +15 -0
  158. package/dist/tools/memory-stats/index.js.map +1 -0
  159. package/dist/tools/search-memory/cli-parser.d.ts +2 -0
  160. package/dist/tools/search-memory/cli-parser.d.ts.map +1 -0
  161. package/dist/tools/search-memory/cli-parser.js +56 -0
  162. package/dist/tools/search-memory/cli-parser.js.map +1 -0
  163. package/dist/tools/search-memory/executor.d.ts +36 -0
  164. package/dist/tools/search-memory/executor.d.ts.map +1 -0
  165. package/dist/tools/search-memory/executor.js +83 -0
  166. package/dist/tools/search-memory/executor.js.map +1 -0
  167. package/dist/tools/search-memory/index.d.ts +3 -0
  168. package/dist/tools/search-memory/index.d.ts.map +1 -0
  169. package/dist/tools/search-memory/index.js +89 -0
  170. package/dist/tools/search-memory/index.js.map +1 -0
  171. package/dist/tools/store-memory/cli-parser.d.ts +2 -0
  172. package/dist/tools/store-memory/cli-parser.d.ts.map +1 -0
  173. package/dist/tools/store-memory/cli-parser.js +21 -0
  174. package/dist/tools/store-memory/cli-parser.js.map +1 -0
  175. package/dist/tools/store-memory/executor.d.ts +16 -0
  176. package/dist/tools/store-memory/executor.d.ts.map +1 -0
  177. package/dist/tools/store-memory/executor.js +100 -0
  178. package/dist/tools/store-memory/executor.js.map +1 -0
  179. package/dist/tools/store-memory/index.d.ts +3 -0
  180. package/dist/tools/store-memory/index.d.ts.map +1 -0
  181. package/dist/tools/store-memory/index.js +68 -0
  182. package/dist/tools/store-memory/index.js.map +1 -0
  183. package/dist/tools/sync-memory/cli-parser.d.ts +1 -0
  184. package/dist/tools/sync-memory/cli-parser.d.ts.map +1 -0
  185. package/dist/tools/sync-memory/cli-parser.js +2 -0
  186. package/dist/tools/sync-memory/cli-parser.js.map +1 -0
  187. package/dist/tools/sync-memory/executor.d.ts +1 -0
  188. package/dist/tools/sync-memory/executor.d.ts.map +1 -0
  189. package/dist/tools/sync-memory/executor.js +2 -0
  190. package/dist/tools/sync-memory/executor.js.map +1 -0
  191. package/dist/tools/sync-memory/index.d.ts +1 -0
  192. package/dist/tools/sync-memory/index.d.ts.map +1 -0
  193. package/dist/tools/sync-memory/index.js +2 -0
  194. package/dist/tools/sync-memory/index.js.map +1 -0
  195. package/dist/tools/update-memory/cli-parser.d.ts +2 -0
  196. package/dist/tools/update-memory/cli-parser.d.ts.map +1 -0
  197. package/dist/tools/update-memory/cli-parser.js +17 -0
  198. package/dist/tools/update-memory/cli-parser.js.map +1 -0
  199. package/dist/tools/update-memory/executor.d.ts +16 -0
  200. package/dist/tools/update-memory/executor.d.ts.map +1 -0
  201. package/dist/tools/update-memory/executor.js +59 -0
  202. package/dist/tools/update-memory/executor.js.map +1 -0
  203. package/dist/tools/update-memory/index.d.ts +3 -0
  204. package/dist/tools/update-memory/index.d.ts.map +1 -0
  205. package/dist/tools/update-memory/index.js +30 -0
  206. package/dist/tools/update-memory/index.js.map +1 -0
  207. package/dist/transports/streamable-http.d.ts +38 -0
  208. package/dist/transports/streamable-http.d.ts.map +1 -0
  209. package/dist/transports/streamable-http.js +209 -0
  210. package/dist/transports/streamable-http.js.map +1 -0
  211. package/dist/types/tools.d.ts +79 -0
  212. package/dist/types/tools.d.ts.map +1 -0
  213. package/dist/types/tools.js +3 -0
  214. package/dist/types/tools.js.map +1 -0
  215. package/dist/utils/cli-parser.d.ts +12 -0
  216. package/dist/utils/cli-parser.d.ts.map +1 -0
  217. package/dist/utils/cli-parser.js +43 -0
  218. package/dist/utils/cli-parser.js.map +1 -0
  219. package/dist/utils/config.d.ts +95 -0
  220. package/dist/utils/config.d.ts.map +1 -0
  221. package/dist/utils/config.js +176 -0
  222. package/dist/utils/config.js.map +1 -0
  223. package/dist/utils/db-integrity-check.d.ts +22 -0
  224. package/dist/utils/db-integrity-check.d.ts.map +1 -0
  225. package/dist/utils/db-integrity-check.js +69 -0
  226. package/dist/utils/db-integrity-check.js.map +1 -0
  227. package/dist/utils/debug.d.ts +25 -0
  228. package/dist/utils/debug.d.ts.map +1 -0
  229. package/dist/utils/debug.js +67 -0
  230. package/dist/utils/debug.js.map +1 -0
  231. package/dist/utils/help-generator.d.ts +18 -0
  232. package/dist/utils/help-generator.d.ts.map +1 -0
  233. package/dist/utils/help-generator.js +81 -0
  234. package/dist/utils/help-generator.js.map +1 -0
  235. package/dist/utils/json-parser.d.ts +12 -0
  236. package/dist/utils/json-parser.d.ts.map +1 -0
  237. package/dist/utils/json-parser.js +52 -0
  238. package/dist/utils/json-parser.js.map +1 -0
  239. package/dist/utils/mcp-config.d.ts +12 -0
  240. package/dist/utils/mcp-config.d.ts.map +1 -0
  241. package/dist/utils/mcp-config.js +64 -0
  242. package/dist/utils/mcp-config.js.map +1 -0
  243. package/dist/web-server.d.ts +3 -0
  244. package/dist/web-server.d.ts.map +1 -0
  245. package/dist/web-server.js +265 -0
  246. package/dist/web-server.js.map +1 -0
  247. package/package.json +75 -0
@@ -0,0 +1,98 @@
1
+ /**
2
+ * GraphQL resolvers for simple-memory
3
+ * Maps GraphQL operations to MemoryService methods
4
+ */
5
+ /**
6
+ * Convert MemoryEntry to GraphQL Memory type with computed fields
7
+ */
8
+ function toGraphQLMemory(entry, previewLength = 100) {
9
+ const content = entry.content || '';
10
+ const firstLine = content.split('\n')[0] || '';
11
+ const title = firstLine.length > 80 ? firstLine.slice(0, 77) + '...' : firstLine;
12
+ return {
13
+ hash: entry.hash,
14
+ content: entry.content,
15
+ title,
16
+ // preview is a function that takes length arg
17
+ preview: (args) => {
18
+ const len = args?.length ?? previewLength;
19
+ return content.length > len ? content.slice(0, len) + '...' : content;
20
+ },
21
+ tags: entry.tags || [],
22
+ createdAt: entry.createdAt,
23
+ relevance: entry.relevance
24
+ };
25
+ }
26
+ /**
27
+ * Create resolvers bound to a MemoryService instance
28
+ */
29
+ export function createResolvers(memoryService) {
30
+ return {
31
+ Query: {
32
+ memories: (_, args) => {
33
+ const limit = args.limit ?? 10;
34
+ const previewLength = args.previewLength ?? 100;
35
+ const results = memoryService.search(args.query, args.tags, limit, args.daysAgo, args.startDate, args.endDate, args.minRelevance);
36
+ return results.map(entry => toGraphQLMemory(entry, previewLength));
37
+ },
38
+ memory: (_, args) => {
39
+ const entry = memoryService.getByHash(args.hash);
40
+ return entry ? toGraphQLMemory(entry) : null;
41
+ },
42
+ related: (_, args) => {
43
+ const limit = args.limit ?? 10;
44
+ const results = memoryService.getRelated(args.hash, limit);
45
+ return results.map(entry => toGraphQLMemory(entry));
46
+ },
47
+ stats: () => {
48
+ return memoryService.stats();
49
+ }
50
+ },
51
+ Mutation: {
52
+ store: (_, args) => {
53
+ try {
54
+ const hash = memoryService.store(args.content, args.tags || []);
55
+ return { success: true, hash };
56
+ }
57
+ catch (error) {
58
+ return { success: false, error: error.message };
59
+ }
60
+ },
61
+ update: (_, args) => {
62
+ try {
63
+ const newHash = memoryService.update(args.hash, args.content, args.tags);
64
+ if (newHash) {
65
+ return { success: true, newHash };
66
+ }
67
+ return { success: false, error: `Memory not found: ${args.hash}` };
68
+ }
69
+ catch (error) {
70
+ return { success: false, error: error.message };
71
+ }
72
+ },
73
+ delete: (_, args) => {
74
+ try {
75
+ if (!args.hash && !args.tag) {
76
+ return { success: false, deletedCount: 0, error: 'Either hash or tag must be provided' };
77
+ }
78
+ if (args.hash && args.tag) {
79
+ return { success: false, deletedCount: 0, error: 'Provide either hash or tag, not both' };
80
+ }
81
+ if (args.hash) {
82
+ const deleted = memoryService.delete(args.hash);
83
+ return { success: deleted, deletedCount: deleted ? 1 : 0 };
84
+ }
85
+ if (args.tag) {
86
+ const count = memoryService.deleteByTag(args.tag);
87
+ return { success: count > 0, deletedCount: count };
88
+ }
89
+ return { success: false, deletedCount: 0 };
90
+ }
91
+ catch (error) {
92
+ return { success: false, deletedCount: 0, error: error.message };
93
+ }
94
+ }
95
+ }
96
+ };
97
+ }
98
+ //# sourceMappingURL=resolvers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolvers.js","sourceRoot":"","sources":["../../src/graphql/resolvers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,SAAS,eAAe,CAAC,KAAkB,EAAE,gBAAwB,GAAG;IACtE,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC;IACpC,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC/C,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAEjF,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,KAAK;QACL,8CAA8C;QAC9C,OAAO,EAAE,CAAC,IAA0B,EAAE,EAAE;YACtC,MAAM,GAAG,GAAG,IAAI,EAAE,MAAM,IAAI,aAAa,CAAC;YAC1C,OAAO,OAAO,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;QACxE,CAAC;QACD,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,EAAE;QACtB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,SAAS,EAAE,KAAK,CAAC,SAAS;KAC3B,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,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,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;wBAC1B,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE,KAAK,EAAE,sCAAsC,EAAE,CAAC;oBAC5F,CAAC;oBAED,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;wBACd,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;wBAChD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;oBAC7D,CAAC;oBAED,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;wBACb,MAAM,KAAK,GAAG,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;wBAClD,OAAO,EAAE,OAAO,EAAE,KAAK,GAAG,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;oBACrD,CAAC;oBAED,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC;gBAC7C,CAAC;gBAAC,OAAO,KAAU,EAAE,CAAC;oBACpB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;gBACnE,CAAC;YACH,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * GraphQL schema for simple-memory
3
+ * Replaces 7 MCP tools with 1 GraphQL endpoint
4
+ *
5
+ * Each type is defined separately for readability and easy modification.
6
+ */
7
+ export declare const typeDefs: string;
8
+ /**
9
+ * Schema description for the MCP tool definition.
10
+ * This is embedded in the tool description so LLMs know the full API.
11
+ */
12
+ export declare const schemaDescription = "\nExecute GraphQL queries against the memory database. This single tool replaces multiple memory tools with a unified, flexible interface.\n\n\uD83E\uDDE0 PROACTIVE USAGE: Search memories at the START of conversations or when relevant topics arise to provide personalized, context-aware responses.\n\n\uD83D\uDCBE AUTO-CAPTURE: Use store mutation proactively to capture important information WITHOUT waiting for explicit requests.\n\u2713 Preferences, decisions, facts about people/projects, learnings, action items\n\u2717 Skip: greetings, temporary info, transactional exchanges\nStore SILENTLY - don't announce saves.\n\nSCHEMA:\n Query {\n memories(query: String, tags: [String], limit: Int, summaryOnly: Boolean, previewLength: Int): [Memory!]!\n memory(hash: String!): Memory\n related(hash: String!, limit: Int): [Memory!]!\n stats: Stats!\n }\n \n Mutation {\n store(content: String!, tags: [String]): StoreResult!\n update(hash: String!, content: String!, tags: [String]): UpdateResult!\n delete(hash: String, tag: String): DeleteResult!\n }\n \n Memory { hash, content, title, preview, tags, createdAt, relevance }\n Stats { version, totalMemories, totalRelationships, dbSize, schemaVersion }\n\nEXAMPLES:\n # Search with summaries (efficient)\n { memories(query: \"typescript\", summaryOnly: true) { hash title tags } }\n \n # Get full content by hash\n { memory(hash: \"abc123...\") { content tags } }\n \n # Store new memory\n mutation { store(content: \"Remember this\", tags: [\"note\"]) { success hash } }\n \n # Batch operations in ONE call\n {\n search: memories(query: \"mcp\", limit: 3) { hash title }\n recent: memories(limit: 5) { hash createdAt }\n stats { totalMemories }\n }\n\nTIPS:\n \u26A0\uFE0F TOKEN COST: Full content = 500-2000 tokens/memory, summaries = ~20 tokens\n \u2022 Use summaryOnly: true for search, then memory(hash) for full content\n \u2022 Request only fields you need (e.g., { hash title } not { hash content title tags createdAt })\n \u2022 Batch related queries to reduce round-trips\n";
13
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/graphql/schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAkQH,eAAO,MAAM,QAAQ,QAUT,CAAC;AAEb;;;GAGG;AACH,eAAO,MAAM,iBAAiB,4iEAiD7B,CAAC"}
@@ -0,0 +1,314 @@
1
+ /**
2
+ * GraphQL schema for simple-memory
3
+ * Replaces 7 MCP tools with 1 GraphQL endpoint
4
+ *
5
+ * Each type is defined separately for readability and easy modification.
6
+ */
7
+ // =============================================================================
8
+ // CORE TYPES
9
+ // =============================================================================
10
+ const MemoryType = `#graphql
11
+ """A stored memory with content, tags, and metadata"""
12
+ type Memory {
13
+ """Unique MD5 hash of content"""
14
+ hash: String!
15
+
16
+ """Full content of the memory"""
17
+ content: String!
18
+
19
+ """First line of content (max 80 chars) - useful for summaries"""
20
+ title: String!
21
+
22
+ """Preview of content (configurable length)"""
23
+ preview(length: Int = 100): String!
24
+
25
+ """Tags associated with this memory"""
26
+ tags: [String!]!
27
+
28
+ """ISO timestamp when memory was created"""
29
+ createdAt: String!
30
+
31
+ """BM25 relevance score (0-1), only present for search results"""
32
+ relevance: Float
33
+ }
34
+ `;
35
+ const MemorySummaryType = `#graphql
36
+ """Compact memory summary for list views"""
37
+ type MemorySummary {
38
+ hash: String!
39
+ title: String!
40
+ preview: String!
41
+ tags: [String!]!
42
+ createdAt: String!
43
+ relevance: Float
44
+ }
45
+ `;
46
+ const MCPConfigPathType = `#graphql
47
+ """MCP configuration file location"""
48
+ type MCPConfigPath {
49
+ """Name of the MCP client (e.g., 'VS Code', 'Claude Desktop')"""
50
+ name: String!
51
+
52
+ """Absolute path to the config file"""
53
+ path: String!
54
+
55
+ """Whether the config file exists"""
56
+ exists: Boolean!
57
+
58
+ """Whether simple-memory is configured in this file"""
59
+ hasSimpleMemory: Boolean
60
+ }
61
+ `;
62
+ const StatsType = `#graphql
63
+ """Database statistics"""
64
+ type Stats {
65
+ """simple-memory-mcp version"""
66
+ version: String!
67
+
68
+ """Total number of stored memories"""
69
+ totalMemories: Int!
70
+
71
+ """Total number of relationships between memories"""
72
+ totalRelationships: Int!
73
+
74
+ """Database file size in bytes"""
75
+ dbSize: Int!
76
+
77
+ """Path to database file"""
78
+ dbPath: String!
79
+
80
+ """Schema version"""
81
+ schemaVersion: Int!
82
+
83
+ """Path to config.json file"""
84
+ configPath: String
85
+
86
+ """Whether automatic backup is enabled"""
87
+ backupEnabled: Boolean
88
+
89
+ """Path to backup directory"""
90
+ backupPath: String
91
+
92
+ """Number of backup files"""
93
+ backupCount: Int
94
+
95
+ """Minutes since last backup"""
96
+ lastBackupAge: Int
97
+
98
+ """Minutes until next backup (-1 = will backup on next write)"""
99
+ nextBackupIn: Int
100
+
101
+ """Known MCP config file locations"""
102
+ mcpConfigPaths: [MCPConfigPath!]
103
+ }
104
+ `;
105
+ // =============================================================================
106
+ // RESULT TYPES
107
+ // =============================================================================
108
+ const DeleteResultType = `#graphql
109
+ """Result of a delete operation"""
110
+ type DeleteResult {
111
+ """Whether the operation succeeded"""
112
+ success: Boolean!
113
+
114
+ """Number of memories deleted"""
115
+ deletedCount: Int!
116
+
117
+ """Error message if operation failed"""
118
+ error: String
119
+ }
120
+ `;
121
+ const StoreResultType = `#graphql
122
+ """Result of a store operation"""
123
+ type StoreResult {
124
+ """Whether the operation succeeded"""
125
+ success: Boolean!
126
+
127
+ """Hash of the stored memory"""
128
+ hash: String
129
+
130
+ """Error message if operation failed"""
131
+ error: String
132
+ }
133
+ `;
134
+ const UpdateResultType = `#graphql
135
+ """Result of an update operation"""
136
+ type UpdateResult {
137
+ """Whether the operation succeeded"""
138
+ success: Boolean!
139
+
140
+ """New hash after update (content hash changes)"""
141
+ newHash: String
142
+
143
+ """Error message if operation failed"""
144
+ error: String
145
+ }
146
+ `;
147
+ // =============================================================================
148
+ // QUERIES
149
+ // =============================================================================
150
+ const QueryType = `#graphql
151
+ type Query {
152
+ """
153
+ Search memories by content or tags.
154
+ If no parameters provided, returns recent memories.
155
+ """
156
+ memories(
157
+ """Full-text search query"""
158
+ query: String
159
+
160
+ """Filter by tags"""
161
+ tags: [String!]
162
+
163
+ """Maximum results to return (default: 10)"""
164
+ limit: Int = 10
165
+
166
+ """Filter to memories from last N days"""
167
+ daysAgo: Int
168
+
169
+ """Filter memories created on or after this date (ISO format)"""
170
+ startDate: String
171
+
172
+ """Filter memories created on or before this date (ISO format)"""
173
+ endDate: String
174
+
175
+ """Minimum relevance score (0-1)"""
176
+ minRelevance: Float
177
+
178
+ """Return compact summaries instead of full content"""
179
+ summaryOnly: Boolean = false
180
+
181
+ """Preview length when summaryOnly=true (default: 100)"""
182
+ previewLength: Int = 100
183
+ ): [Memory!]!
184
+
185
+ """Get a single memory by its hash"""
186
+ memory(hash: String!): Memory
187
+
188
+ """Get related memories for a given hash"""
189
+ related(
190
+ """Hash of the memory to find relations for"""
191
+ hash: String!
192
+
193
+ """Maximum related memories to return"""
194
+ limit: Int = 10
195
+ ): [Memory!]!
196
+
197
+ """Get database statistics"""
198
+ stats: Stats!
199
+ }
200
+ `;
201
+ // =============================================================================
202
+ // MUTATIONS
203
+ // =============================================================================
204
+ const MutationType = `#graphql
205
+ type Mutation {
206
+ """
207
+ Store a new memory with optional tags.
208
+ Returns the hash of the stored memory.
209
+ """
210
+ store(
211
+ """Content to store"""
212
+ content: String!
213
+
214
+ """Tags to associate with this memory"""
215
+ tags: [String!] = []
216
+ ): StoreResult!
217
+
218
+ """
219
+ Update an existing memory by hash.
220
+ Returns the new hash (content changes = hash changes).
221
+ """
222
+ update(
223
+ """Hash of the memory to update"""
224
+ hash: String!
225
+
226
+ """New content"""
227
+ content: String!
228
+
229
+ """New tags (replaces existing if provided)"""
230
+ tags: [String!]
231
+ ): UpdateResult!
232
+
233
+ """
234
+ Delete a memory by hash or all memories with a tag.
235
+ Exactly one of hash or tag must be provided.
236
+ """
237
+ delete(
238
+ """Hash of the memory to delete"""
239
+ hash: String
240
+
241
+ """Delete all memories with this tag"""
242
+ tag: String
243
+ ): DeleteResult!
244
+ }
245
+ `;
246
+ // =============================================================================
247
+ // COMBINED SCHEMA EXPORT
248
+ // =============================================================================
249
+ export const typeDefs = [
250
+ MemoryType,
251
+ MemorySummaryType,
252
+ MCPConfigPathType,
253
+ StatsType,
254
+ DeleteResultType,
255
+ StoreResultType,
256
+ UpdateResultType,
257
+ QueryType,
258
+ MutationType,
259
+ ].join('\n');
260
+ /**
261
+ * Schema description for the MCP tool definition.
262
+ * This is embedded in the tool description so LLMs know the full API.
263
+ */
264
+ export const schemaDescription = `
265
+ Execute GraphQL queries against the memory database. This single tool replaces multiple memory tools with a unified, flexible interface.
266
+
267
+ 🧠 PROACTIVE USAGE: Search memories at the START of conversations or when relevant topics arise to provide personalized, context-aware responses.
268
+
269
+ 💾 AUTO-CAPTURE: Use store mutation proactively to capture important information WITHOUT waiting for explicit requests.
270
+ ✓ Preferences, decisions, facts about people/projects, learnings, action items
271
+ ✗ Skip: greetings, temporary info, transactional exchanges
272
+ Store SILENTLY - don't announce saves.
273
+
274
+ SCHEMA:
275
+ Query {
276
+ memories(query: String, tags: [String], limit: Int, summaryOnly: Boolean, previewLength: Int): [Memory!]!
277
+ memory(hash: String!): Memory
278
+ related(hash: String!, limit: Int): [Memory!]!
279
+ stats: Stats!
280
+ }
281
+
282
+ Mutation {
283
+ store(content: String!, tags: [String]): StoreResult!
284
+ update(hash: String!, content: String!, tags: [String]): UpdateResult!
285
+ delete(hash: String, tag: String): DeleteResult!
286
+ }
287
+
288
+ Memory { hash, content, title, preview, tags, createdAt, relevance }
289
+ Stats { version, totalMemories, totalRelationships, dbSize, schemaVersion }
290
+
291
+ EXAMPLES:
292
+ # Search with summaries (efficient)
293
+ { memories(query: "typescript", summaryOnly: true) { hash title tags } }
294
+
295
+ # Get full content by hash
296
+ { memory(hash: "abc123...") { content tags } }
297
+
298
+ # Store new memory
299
+ mutation { store(content: "Remember this", tags: ["note"]) { success hash } }
300
+
301
+ # Batch operations in ONE call
302
+ {
303
+ search: memories(query: "mcp", limit: 3) { hash title }
304
+ recent: memories(limit: 5) { hash createdAt }
305
+ stats { totalMemories }
306
+ }
307
+
308
+ TIPS:
309
+ ⚠️ TOKEN COST: Full content = 500-2000 tokens/memory, summaries = ~20 tokens
310
+ • Use summaryOnly: true for search, then memory(hash) for full content
311
+ • Request only fields you need (e.g., { hash title } not { hash content title tags createdAt })
312
+ • Batch related queries to reduce round-trips
313
+ `;
314
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/graphql/schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,gFAAgF;AAChF,aAAa;AACb,gFAAgF;AAEhF,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;;CAwBlB,CAAC;AAEF,MAAM,iBAAiB,GAAG;;;;;;;;;;CAUzB,CAAC;AAEF,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;CAezB,CAAC;AAEF,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CjB,CAAC;AAEF,gFAAgF;AAChF,eAAe;AACf,gFAAgF;AAEhF,MAAM,gBAAgB,GAAG;;;;;;;;;;;;CAYxB,CAAC;AAEF,MAAM,eAAe,GAAG;;;;;;;;;;;;CAYvB,CAAC;AAEF,MAAM,gBAAgB,GAAG;;;;;;;;;;;;CAYxB,CAAC;AAEF,gFAAgF;AAChF,UAAU;AACV,gFAAgF;AAEhF,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDjB,CAAC;AAEF,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCpB,CAAC;AAEF,gFAAgF;AAChF,yBAAyB;AACzB,gFAAgF;AAEhF,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,UAAU;IACV,iBAAiB;IACjB,iBAAiB;IACjB,SAAS;IACT,gBAAgB;IAChB,eAAe;IACf,gBAAgB;IAChB,SAAS;IACT,YAAY;CACb,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb;;;GAGG;AACH,MAAM,CAAC,MAA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