memorandum-mcp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/README.md +237 -0
- package/README.ru.md +237 -0
- package/dist/config.d.ts +36 -0
- package/dist/config.js +63 -0
- package/dist/config.js.map +1 -0
- package/dist/document-store.d.ts +145 -0
- package/dist/document-store.js +682 -0
- package/dist/document-store.js.map +1 -0
- package/dist/document-tools.d.ts +10 -0
- package/dist/document-tools.js +101 -0
- package/dist/document-tools.js.map +1 -0
- package/dist/document-types.d.ts +147 -0
- package/dist/document-types.js +125 -0
- package/dist/document-types.js.map +1 -0
- package/dist/embedder.d.ts +55 -0
- package/dist/embedder.js +152 -0
- package/dist/embedder.js.map +1 -0
- package/dist/embedding-queue.d.ts +66 -0
- package/dist/embedding-queue.js +152 -0
- package/dist/embedding-queue.js.map +1 -0
- package/dist/errors.d.ts +26 -0
- package/dist/errors.js +46 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +147 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +12 -0
- package/dist/logger.js +22 -0
- package/dist/logger.js.map +1 -0
- package/dist/semantic-index.d.ts +126 -0
- package/dist/semantic-index.js +427 -0
- package/dist/semantic-index.js.map +1 -0
- package/dist/semantic-tools.d.ts +10 -0
- package/dist/semantic-tools.js +80 -0
- package/dist/semantic-tools.js.map +1 -0
- package/dist/semantic-types.d.ts +161 -0
- package/dist/semantic-types.js +101 -0
- package/dist/semantic-types.js.map +1 -0
- package/dist/store.d.ts +130 -0
- package/dist/store.js +389 -0
- package/dist/store.js.map +1 -0
- package/dist/tools.d.ts +15 -0
- package/dist/tools.js +104 -0
- package/dist/tools.js.map +1 -0
- package/dist/types.d.ts +97 -0
- package/dist/types.js +88 -0
- package/dist/types.js.map +1 -0
- package/dist/vector-store.d.ts +85 -0
- package/dist/vector-store.js +241 -0
- package/dist/vector-store.js.map +1 -0
- package/package.json +50 -0
package/dist/store.js
ADDED
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { writeFile, rename, mkdir, access } from 'node:fs/promises';
|
|
3
|
+
import { dirname } from 'node:path';
|
|
4
|
+
import { LRUCache } from 'lru-cache';
|
|
5
|
+
import safeRegex from 'safe-regex2';
|
|
6
|
+
/**
|
|
7
|
+
* LRU-backed in-memory fact store with namespacing, TTL support,
|
|
8
|
+
* optional semantic indexing, and JSON file persistence.
|
|
9
|
+
*/
|
|
10
|
+
export class MemoryStore {
|
|
11
|
+
cache;
|
|
12
|
+
config;
|
|
13
|
+
storagePath;
|
|
14
|
+
logger;
|
|
15
|
+
semanticIndex = null;
|
|
16
|
+
dirty = false;
|
|
17
|
+
lastSavedAt = null;
|
|
18
|
+
constructor(config, paths, logger) {
|
|
19
|
+
this.config = config;
|
|
20
|
+
this.storagePath = paths.factsPath;
|
|
21
|
+
this.logger = logger;
|
|
22
|
+
this.cache = new LRUCache({
|
|
23
|
+
max: config.max_entries,
|
|
24
|
+
noDisposeOnSet: true,
|
|
25
|
+
dispose: (_value, key) => {
|
|
26
|
+
const parsed = MemoryStore.parseKey(key);
|
|
27
|
+
this.logger.warn({ key: parsed.key, namespace: parsed.namespace }, 'Fact evicted from memory (LRU)');
|
|
28
|
+
if (this.semanticIndex) {
|
|
29
|
+
this.semanticIndex.removeFact(parsed.key, parsed.namespace);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/** Attaches a semantic index for embedding-based fact retrieval. */
|
|
35
|
+
setSemanticIndex(index) {
|
|
36
|
+
this.semanticIndex = index;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Creates a composite cache key by joining namespace and key with a null byte.
|
|
40
|
+
* @param namespace - The namespace portion of the key.
|
|
41
|
+
* @param key - The fact key within the namespace.
|
|
42
|
+
* @returns The composite key string.
|
|
43
|
+
*/
|
|
44
|
+
static makeKey(namespace, key) {
|
|
45
|
+
return `${namespace}\0${key}`;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Splits a composite cache key back into its namespace and key parts.
|
|
49
|
+
* Falls back to the "default" namespace when no separator is found.
|
|
50
|
+
* @param compositeKey - The composite key to parse.
|
|
51
|
+
* @returns An object containing the namespace and key.
|
|
52
|
+
*/
|
|
53
|
+
static parseKey(compositeKey) {
|
|
54
|
+
const idx = compositeKey.indexOf('\0');
|
|
55
|
+
if (idx === -1)
|
|
56
|
+
return { namespace: 'default', key: compositeKey };
|
|
57
|
+
return { namespace: compositeKey.slice(0, idx), key: compositeKey.slice(idx + 1) };
|
|
58
|
+
}
|
|
59
|
+
getRemainingTtlSeconds(compositeKey) {
|
|
60
|
+
const ttlMs = this.cache.getRemainingTTL(compositeKey);
|
|
61
|
+
const hasTtl = ttlMs > 0 && ttlMs !== Infinity;
|
|
62
|
+
return hasTtl ? Math.ceil(ttlMs / 1000) : null;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Writes or updates a fact in the store.
|
|
66
|
+
* @param key - Fact identifier.
|
|
67
|
+
* @param value - The fact payload.
|
|
68
|
+
* @param namespace - Namespace to store the fact under.
|
|
69
|
+
* @param ttlSeconds - Optional time-to-live in seconds.
|
|
70
|
+
* @returns An object indicating whether a new fact was created.
|
|
71
|
+
*/
|
|
72
|
+
write(key, value, namespace, ttlSeconds) {
|
|
73
|
+
const compositeKey = MemoryStore.makeKey(namespace, key);
|
|
74
|
+
const existing = this.cache.get(compositeKey);
|
|
75
|
+
const now = Date.now();
|
|
76
|
+
const entry = {
|
|
77
|
+
value,
|
|
78
|
+
namespace,
|
|
79
|
+
createdAt: existing?.createdAt ?? now,
|
|
80
|
+
updatedAt: now,
|
|
81
|
+
};
|
|
82
|
+
const options = ttlSeconds != null ? { ttl: ttlSeconds * 1000 } : undefined;
|
|
83
|
+
this.cache.set(compositeKey, entry, options);
|
|
84
|
+
this.dirty = true;
|
|
85
|
+
const created = existing == null;
|
|
86
|
+
this.logger.debug({ key, namespace, created }, created ? 'Fact created' : 'Fact updated');
|
|
87
|
+
if (this.semanticIndex) {
|
|
88
|
+
this.semanticIndex.enqueueFact(key, namespace, value);
|
|
89
|
+
}
|
|
90
|
+
return { created };
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Reads a single fact by key and namespace.
|
|
94
|
+
* @param key - Fact identifier.
|
|
95
|
+
* @param namespace - Namespace the fact belongs to.
|
|
96
|
+
* @returns The fact metadata including TTL info, or null if not found.
|
|
97
|
+
*/
|
|
98
|
+
read(key, namespace) {
|
|
99
|
+
const compositeKey = MemoryStore.makeKey(namespace, key);
|
|
100
|
+
const entry = this.cache.get(compositeKey);
|
|
101
|
+
if (entry == null)
|
|
102
|
+
return null;
|
|
103
|
+
const ttlSeconds = this.getRemainingTtlSeconds(compositeKey);
|
|
104
|
+
return {
|
|
105
|
+
key, namespace,
|
|
106
|
+
value: entry.value,
|
|
107
|
+
createdAt: entry.createdAt,
|
|
108
|
+
updatedAt: entry.updatedAt,
|
|
109
|
+
ttl: ttlSeconds,
|
|
110
|
+
remainingTtl: ttlSeconds,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Lists facts with optional namespace filtering, glob pattern matching, and pagination.
|
|
115
|
+
* Can optionally include values and store-level statistics.
|
|
116
|
+
*/
|
|
117
|
+
list(options) {
|
|
118
|
+
const results = [];
|
|
119
|
+
let patternRegex = null;
|
|
120
|
+
if (options.pattern) {
|
|
121
|
+
const escaped = options.pattern.replace(/[.+^${}()|[\]\\]/g, '\\$&');
|
|
122
|
+
const regexStr = escaped.replace(/\*/g, '.*').replace(/\?/g, '.');
|
|
123
|
+
if (!safeRegex(`^${regexStr}$`)) {
|
|
124
|
+
throw new Error(`Unsafe pattern (potential ReDoS): ${options.pattern}`);
|
|
125
|
+
}
|
|
126
|
+
patternRegex = new RegExp(`^${regexStr}$`);
|
|
127
|
+
}
|
|
128
|
+
for (const [compositeKey, entry] of this.cache.entries()) {
|
|
129
|
+
if (results.length >= options.limit)
|
|
130
|
+
break;
|
|
131
|
+
const parsed = MemoryStore.parseKey(compositeKey);
|
|
132
|
+
if (options.namespace && parsed.namespace !== options.namespace)
|
|
133
|
+
continue;
|
|
134
|
+
if (patternRegex && !patternRegex.test(parsed.key))
|
|
135
|
+
continue;
|
|
136
|
+
const ttlSeconds = this.getRemainingTtlSeconds(compositeKey);
|
|
137
|
+
const fact = {
|
|
138
|
+
key: parsed.key, namespace: parsed.namespace,
|
|
139
|
+
createdAt: entry.createdAt, updatedAt: entry.updatedAt,
|
|
140
|
+
ttl: ttlSeconds, remainingTtl: ttlSeconds,
|
|
141
|
+
};
|
|
142
|
+
if (options.includeValues)
|
|
143
|
+
fact.value = entry.value;
|
|
144
|
+
results.push(fact);
|
|
145
|
+
}
|
|
146
|
+
const response = { facts: results };
|
|
147
|
+
if (options.includeStats) {
|
|
148
|
+
response.stats = {
|
|
149
|
+
totalFacts: this.cache.size,
|
|
150
|
+
maxEntries: this.config.max_entries,
|
|
151
|
+
namespaceCount: this.getNamespaces().length,
|
|
152
|
+
lastSavedAt: this.lastSavedAt,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
return response;
|
|
156
|
+
}
|
|
157
|
+
/** Returns all namespaces with their respective fact counts. */
|
|
158
|
+
getNamespaces() {
|
|
159
|
+
const counts = new Map();
|
|
160
|
+
for (const compositeKey of this.cache.keys()) {
|
|
161
|
+
const { namespace } = MemoryStore.parseKey(compositeKey);
|
|
162
|
+
counts.set(namespace, (counts.get(namespace) ?? 0) + 1);
|
|
163
|
+
}
|
|
164
|
+
return Array.from(counts.entries()).map(([namespace, count]) => ({ namespace, count }));
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Searches facts by regex pattern, matching against both keys and values.
|
|
168
|
+
* Validates the regex for safety against ReDoS before executing.
|
|
169
|
+
*/
|
|
170
|
+
search(options) {
|
|
171
|
+
if (!safeRegex(options.query)) {
|
|
172
|
+
throw new Error(`Unsafe regexp (potential ReDoS): ${options.query}`);
|
|
173
|
+
}
|
|
174
|
+
let regex;
|
|
175
|
+
try {
|
|
176
|
+
regex = new RegExp(options.query, 'i');
|
|
177
|
+
}
|
|
178
|
+
catch {
|
|
179
|
+
throw new Error(`Invalid regexp: ${options.query}`);
|
|
180
|
+
}
|
|
181
|
+
const results = [];
|
|
182
|
+
let totalMatches = 0;
|
|
183
|
+
for (const [compositeKey, entry] of this.cache.entries()) {
|
|
184
|
+
const parsed = MemoryStore.parseKey(compositeKey);
|
|
185
|
+
if (options.namespace && parsed.namespace !== options.namespace)
|
|
186
|
+
continue;
|
|
187
|
+
const keyMatch = regex.test(parsed.key);
|
|
188
|
+
const valueStr = JSON.stringify(entry.value);
|
|
189
|
+
const valueMatch = regex.test(valueStr);
|
|
190
|
+
if (!keyMatch && !valueMatch)
|
|
191
|
+
continue;
|
|
192
|
+
totalMatches++;
|
|
193
|
+
if (results.length < options.limit) {
|
|
194
|
+
const ttlSeconds = this.getRemainingTtlSeconds(compositeKey);
|
|
195
|
+
results.push({
|
|
196
|
+
key: parsed.key, namespace: parsed.namespace,
|
|
197
|
+
value: entry.value,
|
|
198
|
+
createdAt: entry.createdAt, updatedAt: entry.updatedAt,
|
|
199
|
+
ttl: ttlSeconds, remainingTtl: ttlSeconds,
|
|
200
|
+
match_in: keyMatch && valueMatch ? 'both' : keyMatch ? 'key' : 'value',
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return { results, total_matches: totalMatches, limit: options.limit };
|
|
205
|
+
}
|
|
206
|
+
get size() { return this.cache.size; }
|
|
207
|
+
get maxEntries() { return this.config.max_entries; }
|
|
208
|
+
/**
|
|
209
|
+
* Deletes a single fact by key and namespace.
|
|
210
|
+
* @param key - Fact identifier.
|
|
211
|
+
* @param namespace - Namespace the fact belongs to.
|
|
212
|
+
* @returns True if the fact existed and was deleted.
|
|
213
|
+
*/
|
|
214
|
+
delete(key, namespace) {
|
|
215
|
+
const compositeKey = MemoryStore.makeKey(namespace, key);
|
|
216
|
+
const existed = this.cache.has(compositeKey);
|
|
217
|
+
if (existed) {
|
|
218
|
+
this.cache.delete(compositeKey);
|
|
219
|
+
this.dirty = true;
|
|
220
|
+
}
|
|
221
|
+
return existed;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Deletes all facts within the given namespace.
|
|
225
|
+
* @param namespace - The namespace to clear.
|
|
226
|
+
* @returns The number of facts deleted.
|
|
227
|
+
*/
|
|
228
|
+
deleteNamespace(namespace) {
|
|
229
|
+
const keysToDelete = [];
|
|
230
|
+
for (const compositeKey of this.cache.keys()) {
|
|
231
|
+
if (MemoryStore.parseKey(compositeKey).namespace === namespace) {
|
|
232
|
+
keysToDelete.push(compositeKey);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
for (const key of keysToDelete)
|
|
236
|
+
this.cache.delete(key);
|
|
237
|
+
if (keysToDelete.length > 0)
|
|
238
|
+
this.dirty = true;
|
|
239
|
+
return keysToDelete.length;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Persists the cache to disk using atomic write (temp file + rename).
|
|
243
|
+
* Skips saving when no changes have been made or when the cache is empty
|
|
244
|
+
* but the file on disk still contains data (safety guard).
|
|
245
|
+
* @returns True if the save was performed successfully.
|
|
246
|
+
*/
|
|
247
|
+
async save() {
|
|
248
|
+
if (!this.dirty)
|
|
249
|
+
return false;
|
|
250
|
+
const filePath = this.storagePath;
|
|
251
|
+
if (this.cache.size === 0 && existsSync(filePath)) {
|
|
252
|
+
try {
|
|
253
|
+
const diskRaw = readFileSync(filePath, 'utf-8');
|
|
254
|
+
const diskData = JSON.parse(diskRaw);
|
|
255
|
+
if (Array.isArray(diskData) && diskData.length > 0) {
|
|
256
|
+
this.logger.warn({ diskEntries: diskData.length }, 'Skipping save: disk has data but cache is empty');
|
|
257
|
+
return false;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
catch { /* proceed */ }
|
|
261
|
+
}
|
|
262
|
+
try {
|
|
263
|
+
const dir = dirname(filePath);
|
|
264
|
+
try {
|
|
265
|
+
await access(dir);
|
|
266
|
+
}
|
|
267
|
+
catch {
|
|
268
|
+
await mkdir(dir, { recursive: true });
|
|
269
|
+
}
|
|
270
|
+
const data = JSON.stringify(this.cache.dump());
|
|
271
|
+
const tmpPath = `${filePath}.${process.pid}-${Date.now()}.tmp`;
|
|
272
|
+
await writeFile(tmpPath, data, 'utf-8');
|
|
273
|
+
await rename(tmpPath, filePath);
|
|
274
|
+
this.dirty = false;
|
|
275
|
+
this.lastSavedAt = Date.now();
|
|
276
|
+
this.logger.debug({ path: filePath, facts: this.cache.size }, 'Memory saved to disk');
|
|
277
|
+
return true;
|
|
278
|
+
}
|
|
279
|
+
catch (err) {
|
|
280
|
+
this.logger.error({ path: filePath, error: err instanceof Error ? err.message : String(err) }, 'Failed to save memory');
|
|
281
|
+
return false;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
/** Loads facts from the on-disk JSON file into the cache. Starts empty if the file is missing or corrupt. */
|
|
285
|
+
async load() {
|
|
286
|
+
const filePath = this.storagePath;
|
|
287
|
+
try {
|
|
288
|
+
if (!existsSync(filePath)) {
|
|
289
|
+
this.logger.info({ path: filePath }, 'No memory file found, starting empty');
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
const raw = readFileSync(filePath, 'utf-8');
|
|
293
|
+
const data = JSON.parse(raw);
|
|
294
|
+
this.cache.load(data);
|
|
295
|
+
this.dirty = false;
|
|
296
|
+
this.logger.debug({ path: filePath, facts: this.cache.size }, 'Memory loaded from disk');
|
|
297
|
+
}
|
|
298
|
+
catch (err) {
|
|
299
|
+
this.logger.warn({ path: filePath, error: err instanceof Error ? err.message : String(err) }, 'Failed to load memory, starting empty');
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
autosaveTimer = null;
|
|
303
|
+
/**
|
|
304
|
+
* Starts a recurring autosave timer that persists dirty state to disk.
|
|
305
|
+
* @param intervalMs - Interval between saves in milliseconds. Values <= 0 are ignored.
|
|
306
|
+
*/
|
|
307
|
+
startAutosave(intervalMs) {
|
|
308
|
+
this.stopAutosave();
|
|
309
|
+
if (intervalMs <= 0)
|
|
310
|
+
return;
|
|
311
|
+
this.autosaveTimer = setInterval(() => {
|
|
312
|
+
this.save().catch((err) => {
|
|
313
|
+
this.logger.warn({ error: err instanceof Error ? err.message : String(err) }, 'Autosave failed');
|
|
314
|
+
});
|
|
315
|
+
}, intervalMs);
|
|
316
|
+
this.autosaveTimer.unref();
|
|
317
|
+
}
|
|
318
|
+
/** Stops the autosave timer if one is running. */
|
|
319
|
+
stopAutosave() {
|
|
320
|
+
if (this.autosaveTimer) {
|
|
321
|
+
clearInterval(this.autosaveTimer);
|
|
322
|
+
this.autosaveTimer = null;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Exports all facts as a versioned JSON-serializable object.
|
|
327
|
+
* Includes TTL remaining at the time of export.
|
|
328
|
+
* @returns An export payload with version, timestamp, count, and fact data.
|
|
329
|
+
*/
|
|
330
|
+
export() {
|
|
331
|
+
const data = [];
|
|
332
|
+
for (const [compositeKey, entry] of this.cache.entries()) {
|
|
333
|
+
const parsed = MemoryStore.parseKey(compositeKey);
|
|
334
|
+
data.push({
|
|
335
|
+
key: parsed.key, namespace: parsed.namespace,
|
|
336
|
+
value: entry.value,
|
|
337
|
+
createdAt: entry.createdAt, updatedAt: entry.updatedAt,
|
|
338
|
+
ttl_seconds: this.getRemainingTtlSeconds(compositeKey),
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
return { version: 1, exported_at: Date.now(), facts_count: data.length, data };
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Imports facts from a JSON string previously produced by {@link export}.
|
|
345
|
+
* @param dataStr - JSON string containing the export payload.
|
|
346
|
+
* @param merge - When true, merges into existing data; when false, replaces all facts.
|
|
347
|
+
* @returns Summary with imported and overwritten counts.
|
|
348
|
+
*/
|
|
349
|
+
import(dataStr, merge) {
|
|
350
|
+
let parsed;
|
|
351
|
+
try {
|
|
352
|
+
parsed = JSON.parse(dataStr);
|
|
353
|
+
}
|
|
354
|
+
catch {
|
|
355
|
+
throw new Error('Invalid import data: not valid JSON');
|
|
356
|
+
}
|
|
357
|
+
if (parsed.version !== 1)
|
|
358
|
+
throw new Error(`Unsupported import format version: ${String(parsed.version)}`);
|
|
359
|
+
if (!Array.isArray(parsed.data))
|
|
360
|
+
throw new Error('Invalid import data: missing data array');
|
|
361
|
+
if (!merge)
|
|
362
|
+
this.cache.clear();
|
|
363
|
+
this.dirty = true;
|
|
364
|
+
let importedCount = 0;
|
|
365
|
+
let overwrittenCount = 0;
|
|
366
|
+
for (const item of parsed.data) {
|
|
367
|
+
const key = item.key;
|
|
368
|
+
const namespace = item.namespace;
|
|
369
|
+
if (!key || !namespace)
|
|
370
|
+
continue;
|
|
371
|
+
const compositeKey = MemoryStore.makeKey(namespace, key);
|
|
372
|
+
if (this.cache.has(compositeKey))
|
|
373
|
+
overwrittenCount++;
|
|
374
|
+
const now = Date.now();
|
|
375
|
+
const entry = {
|
|
376
|
+
value: item.value,
|
|
377
|
+
namespace,
|
|
378
|
+
createdAt: item.createdAt ?? now,
|
|
379
|
+
updatedAt: item.updatedAt ?? item.createdAt ?? now,
|
|
380
|
+
};
|
|
381
|
+
const ttlSeconds = item.ttl_seconds;
|
|
382
|
+
const options = ttlSeconds != null && ttlSeconds > 0 ? { ttl: ttlSeconds * 1000 } : undefined;
|
|
383
|
+
this.cache.set(compositeKey, entry, options);
|
|
384
|
+
importedCount++;
|
|
385
|
+
}
|
|
386
|
+
return { success: true, imported_count: importedCount, overwritten_count: overwrittenCount };
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.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E,MAAM,OAAO,GACX,UAAU,IAAI,IAAI,IAAI,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;YAEhF,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;YAC7C,aAAa,EAAE,CAAC;QAClB,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,aAAa,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IAC/F,CAAC;CACF"}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { Logger } from 'pino';
|
|
3
|
+
import { MemoryStore } from './store.js';
|
|
4
|
+
export type SyncFn = () => Promise<{
|
|
5
|
+
flushed_embeddings: number;
|
|
6
|
+
saved_stores: string[];
|
|
7
|
+
}>;
|
|
8
|
+
/**
|
|
9
|
+
* Registers memory_write, memory_read, and memory_manage tools on the MCP server.
|
|
10
|
+
* @param server - The MCP server instance to register tools on.
|
|
11
|
+
* @param store - The memory store used for reading, writing, and managing facts.
|
|
12
|
+
* @param _logger - Logger instance (reserved for future use).
|
|
13
|
+
* @param syncFn - Optional custom sync function; falls back to `store.save()` if not provided.
|
|
14
|
+
*/
|
|
15
|
+
export declare function registerMemoryTools(server: McpServer, store: MemoryStore, _logger: Logger, syncFn?: SyncFn): void;
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { toMcpErrorResponse } from './errors.js';
|
|
2
|
+
import { MemoryWriteDisplaySchema, MemoryWriteInputSchema, MemoryReadDisplaySchema, MemoryReadInputSchema, MemoryManageDisplaySchema, MemoryManageInputSchema, } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Registers memory_write, memory_read, and memory_manage tools on the MCP server.
|
|
5
|
+
* @param server - The MCP server instance to register tools on.
|
|
6
|
+
* @param store - The memory store used for reading, writing, and managing facts.
|
|
7
|
+
* @param _logger - Logger instance (reserved for future use).
|
|
8
|
+
* @param syncFn - Optional custom sync function; falls back to `store.save()` if not provided.
|
|
9
|
+
*/
|
|
10
|
+
export function registerMemoryTools(server, store, _logger, syncFn) {
|
|
11
|
+
server.registerTool('memory_write', {
|
|
12
|
+
title: 'Write Memory',
|
|
13
|
+
description: 'Write a fact to memory. The key and namespace should be meaningful.',
|
|
14
|
+
inputSchema: MemoryWriteDisplaySchema,
|
|
15
|
+
}, async (rawInput) => {
|
|
16
|
+
try {
|
|
17
|
+
const input = MemoryWriteInputSchema.parse(rawInput);
|
|
18
|
+
const result = store.write(input.key, input.value, input.namespace, input.ttl_seconds);
|
|
19
|
+
const output = { success: true, key: input.key, namespace: input.namespace, created: result.created };
|
|
20
|
+
return {
|
|
21
|
+
content: [{ type: 'text', text: JSON.stringify(output) }],
|
|
22
|
+
structuredContent: output,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
return toMcpErrorResponse(error);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
server.registerTool('memory_read', {
|
|
30
|
+
title: 'Read Memory',
|
|
31
|
+
description: 'Read a fact by key and namespace. Returns content with metadata or null if not found.',
|
|
32
|
+
inputSchema: MemoryReadDisplaySchema,
|
|
33
|
+
}, async (rawInput) => {
|
|
34
|
+
try {
|
|
35
|
+
const input = MemoryReadInputSchema.parse(rawInput);
|
|
36
|
+
const result = store.read(input.key, input.namespace);
|
|
37
|
+
const output = result ? { ...result } : { found: false };
|
|
38
|
+
return {
|
|
39
|
+
content: [{ type: 'text', text: JSON.stringify(output) }],
|
|
40
|
+
structuredContent: output,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
return toMcpErrorResponse(error);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
server.registerTool('memory_manage', {
|
|
48
|
+
title: 'Manage Memory',
|
|
49
|
+
description: 'Manage memory: delete, list, search, namespaces, export, import, sync.',
|
|
50
|
+
inputSchema: MemoryManageDisplaySchema,
|
|
51
|
+
}, async (rawInput) => {
|
|
52
|
+
try {
|
|
53
|
+
const input = MemoryManageInputSchema.parse(rawInput);
|
|
54
|
+
let output = {};
|
|
55
|
+
switch (input.action) {
|
|
56
|
+
case 'list':
|
|
57
|
+
output = store.list({
|
|
58
|
+
namespace: input.namespace, pattern: input.pattern,
|
|
59
|
+
limit: input.limit, includeValues: input.include_values, includeStats: input.include_stats,
|
|
60
|
+
});
|
|
61
|
+
break;
|
|
62
|
+
case 'namespaces':
|
|
63
|
+
output = { namespaces: store.getNamespaces() };
|
|
64
|
+
break;
|
|
65
|
+
case 'search':
|
|
66
|
+
output = store.search({ query: input.query, namespace: input.namespace, limit: input.limit });
|
|
67
|
+
break;
|
|
68
|
+
case 'delete': {
|
|
69
|
+
const deleted = store.delete(input.key, input.namespace);
|
|
70
|
+
output = { success: true, deleted };
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
case 'delete_namespace': {
|
|
74
|
+
const deletedCount = store.deleteNamespace(input.namespace);
|
|
75
|
+
output = { success: true, deleted_count: deletedCount };
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
case 'export':
|
|
79
|
+
output = store.export();
|
|
80
|
+
break;
|
|
81
|
+
case 'import':
|
|
82
|
+
output = store.import(input.data, input.merge);
|
|
83
|
+
break;
|
|
84
|
+
case 'sync':
|
|
85
|
+
if (syncFn) {
|
|
86
|
+
output = await syncFn();
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
const written = await store.save();
|
|
90
|
+
output = { flushed_embeddings: 0, saved_stores: written ? ['facts'] : [] };
|
|
91
|
+
}
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
content: [{ type: 'text', text: JSON.stringify(output) }],
|
|
96
|
+
structuredContent: output,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
return toMcpErrorResponse(error);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EACL,wBAAwB,EAAE,sBAAsB,EAChD,uBAAuB,EAAE,qBAAqB,EAC9C,yBAAyB,EAAE,uBAAuB,GACnD,MAAM,YAAY,CAAC;AAIpB;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAAiB,EACjB,KAAkB,EAClB,OAAe,EACf,MAAe;IAEf,MAAM,CAAC,YAAY,CACjB,cAAc,EACd;QACE,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,qEAAqE;QAClF,WAAW,EAAE,wBAAwB;KACtC,EACD,KAAK,EAAE,QAAQ,EAAE,EAAE;QACjB,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,sBAAsB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YACrD,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;YACvF,MAAM,MAAM,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;YACtG,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;gBACl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AK,CAAC,CAAC;oBAC/C,MAAM;gBACR,KAAK,MAAM;oBACT,IAAI,MAAM,EAAE,CAAC;wBACX,MAAM,GAAG,MAAM,MAAM,EAAE,CAAC;oBAC1B,CAAC;yBAAM,CAAC;wBACN,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;wBACnC,MAAM,GAAG,EAAE,kBAAkB,EAAE,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;oBAC7E,CAAC;oBACD,MAAM;YACV,CAAC;YAED,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;gBAClE,iBAAiB,EAAE,MAAM;aAC1B,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;QACnC,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const KEY_MAX_LEN = 256;
|
|
3
|
+
export declare const NAMESPACE_MAX_LEN = 64;
|
|
4
|
+
export declare const NAMESPACE_REGEX: RegExp;
|
|
5
|
+
export declare const DEFAULT_NAMESPACE = "default";
|
|
6
|
+
export declare const DEFAULT_LIST_LIMIT = 50;
|
|
7
|
+
export declare const DEFAULT_SEARCH_LIMIT = 20;
|
|
8
|
+
export interface FactEntry {
|
|
9
|
+
value: unknown;
|
|
10
|
+
namespace: string;
|
|
11
|
+
createdAt: number;
|
|
12
|
+
updatedAt: number;
|
|
13
|
+
}
|
|
14
|
+
export interface FactMetadata {
|
|
15
|
+
key: string;
|
|
16
|
+
namespace: string;
|
|
17
|
+
value: unknown;
|
|
18
|
+
createdAt: number;
|
|
19
|
+
updatedAt: number;
|
|
20
|
+
ttl: number | null;
|
|
21
|
+
remainingTtl: number | null;
|
|
22
|
+
}
|
|
23
|
+
export interface NamespaceInfo {
|
|
24
|
+
namespace: string;
|
|
25
|
+
count: number;
|
|
26
|
+
}
|
|
27
|
+
export interface MemoryStats {
|
|
28
|
+
totalFacts: number;
|
|
29
|
+
maxEntries: number;
|
|
30
|
+
namespaceCount: number;
|
|
31
|
+
lastSavedAt: number | null;
|
|
32
|
+
}
|
|
33
|
+
export declare const MemoryWriteDisplaySchema: z.ZodObject<{
|
|
34
|
+
key: z.ZodOptional<z.ZodString>;
|
|
35
|
+
value: z.ZodOptional<z.ZodUnknown>;
|
|
36
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
37
|
+
ttl_seconds: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
export declare const MemoryReadDisplaySchema: z.ZodObject<{
|
|
40
|
+
key: z.ZodOptional<z.ZodString>;
|
|
41
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
export declare const MemoryManageDisplaySchema: z.ZodObject<{
|
|
44
|
+
action: z.ZodOptional<z.ZodString>;
|
|
45
|
+
key: z.ZodOptional<z.ZodString>;
|
|
46
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
47
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
48
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
49
|
+
include_values: z.ZodOptional<z.ZodBoolean>;
|
|
50
|
+
include_stats: z.ZodOptional<z.ZodBoolean>;
|
|
51
|
+
query: z.ZodOptional<z.ZodString>;
|
|
52
|
+
data: z.ZodOptional<z.ZodString>;
|
|
53
|
+
merge: z.ZodOptional<z.ZodBoolean>;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
export declare const MemoryWriteInputSchema: z.ZodObject<{
|
|
56
|
+
key: z.ZodString;
|
|
57
|
+
value: z.ZodUnknown;
|
|
58
|
+
namespace: z.ZodDefault<z.ZodString>;
|
|
59
|
+
ttl_seconds: z.ZodOptional<z.ZodNumber>;
|
|
60
|
+
}, z.core.$strict>;
|
|
61
|
+
export declare const MemoryReadInputSchema: z.ZodObject<{
|
|
62
|
+
key: z.ZodString;
|
|
63
|
+
namespace: z.ZodDefault<z.ZodString>;
|
|
64
|
+
}, z.core.$strict>;
|
|
65
|
+
export declare const MemoryManageInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
66
|
+
action: z.ZodLiteral<"delete">;
|
|
67
|
+
key: z.ZodString;
|
|
68
|
+
namespace: z.ZodDefault<z.ZodString>;
|
|
69
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
70
|
+
action: z.ZodLiteral<"delete_namespace">;
|
|
71
|
+
namespace: z.ZodString;
|
|
72
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
73
|
+
action: z.ZodLiteral<"list">;
|
|
74
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
75
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
76
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
77
|
+
include_values: z.ZodDefault<z.ZodBoolean>;
|
|
78
|
+
include_stats: z.ZodDefault<z.ZodBoolean>;
|
|
79
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
80
|
+
action: z.ZodLiteral<"search">;
|
|
81
|
+
query: z.ZodString;
|
|
82
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
83
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
84
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
85
|
+
action: z.ZodLiteral<"namespaces">;
|
|
86
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
87
|
+
action: z.ZodLiteral<"export">;
|
|
88
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
89
|
+
action: z.ZodLiteral<"import">;
|
|
90
|
+
data: z.ZodString;
|
|
91
|
+
merge: z.ZodDefault<z.ZodBoolean>;
|
|
92
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
93
|
+
action: z.ZodLiteral<"sync">;
|
|
94
|
+
}, z.core.$strict>], "action">;
|
|
95
|
+
export type MemoryWriteInput = z.infer<typeof MemoryWriteInputSchema>;
|
|
96
|
+
export type MemoryReadInput = z.infer<typeof MemoryReadInputSchema>;
|
|
97
|
+
export type MemoryManageInput = z.infer<typeof MemoryManageInputSchema>;
|