@lanonasis/mem-intel-sdk 1.0.0 → 1.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/CHANGELOG.md +16 -0
- package/README.md +50 -21
- package/dist/core/client.d.ts +29 -8
- package/dist/core/client.d.ts.map +1 -1
- package/dist/core/index.cjs +251 -13
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.ts +4 -3
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +251 -13
- package/dist/core/index.js.map +1 -1
- package/dist/core/types.d.ts +36 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/index-sdk.d.ts +5 -3
- package/dist/index-sdk.d.ts.map +1 -1
- package/dist/index.cjs +251 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +251 -13
- package/dist/index.js.map +1 -1
- package/dist/node/client.d.ts +2 -2
- package/dist/node/client.d.ts.map +1 -1
- package/dist/node/index.cjs +251 -13
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.d.ts +3 -3
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +251 -13
- package/dist/node/index.js.map +1 -1
- package/dist/react/context/MemoryIntelligenceProvider.d.ts +2 -2
- package/dist/react/context/MemoryIntelligenceProvider.d.ts.map +1 -1
- package/dist/react/hooks/useMemoryIntelligence.d.ts +13 -12
- package/dist/react/hooks/useMemoryIntelligence.d.ts.map +1 -1
- package/dist/react/index.cjs +254 -19
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.ts +4 -4
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +254 -19
- package/dist/react/index.js.map +1 -1
- package/dist/server/index.cjs +272 -27
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +272 -27
- package/dist/server/index.js.map +1 -1
- package/dist/server/mcp-server.d.ts +1 -1
- package/dist/server/mcp-server.d.ts.map +1 -1
- package/dist/utils/embeddings.d.ts +1 -1
- package/dist/utils/embeddings.d.ts.map +1 -1
- package/dist/utils/formatting.d.ts +1 -1
- package/dist/utils/formatting.d.ts.map +1 -1
- package/dist/utils/http-client.d.ts +35 -0
- package/dist/utils/http-client.d.ts.map +1 -1
- package/dist/utils/index.d.ts +7 -5
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/response-adapter.d.ts +66 -0
- package/dist/utils/response-adapter.d.ts.map +1 -0
- package/dist/vue/composables/useMemoryIntelligence.d.ts +1 -1
- package/dist/vue/composables/useMemoryIntelligence.d.ts.map +1 -1
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.d.ts +3 -3
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js.map +1 -1
- package/package.json +4 -4
package/dist/server/index.js
CHANGED
|
@@ -43,12 +43,120 @@ var ValidationError = class extends MemoryIntelligenceError {
|
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
+
// src/utils/response-adapter.ts
|
|
47
|
+
function adaptEdgeFunctionResponse(httpResponse) {
|
|
48
|
+
if (httpResponse.error) {
|
|
49
|
+
return {
|
|
50
|
+
status: httpResponse.status,
|
|
51
|
+
error: httpResponse.error
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const envelope = httpResponse.data;
|
|
55
|
+
if (!envelope) {
|
|
56
|
+
return {
|
|
57
|
+
status: httpResponse.status,
|
|
58
|
+
error: {
|
|
59
|
+
message: "Empty response from server",
|
|
60
|
+
code: "EMPTY_RESPONSE"
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
if (!envelope.success && envelope.error) {
|
|
65
|
+
return {
|
|
66
|
+
status: httpResponse.status,
|
|
67
|
+
error: envelope.error,
|
|
68
|
+
usage: envelope.usage,
|
|
69
|
+
tier_info: envelope.tier_info
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
status: httpResponse.status,
|
|
74
|
+
data: envelope.data,
|
|
75
|
+
usage: envelope.usage,
|
|
76
|
+
tier_info: envelope.tier_info
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function isEdgeFunctionEnvelope(data) {
|
|
80
|
+
if (typeof data !== "object" || data === null) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
const obj = data;
|
|
84
|
+
return "success" in obj && typeof obj.success === "boolean";
|
|
85
|
+
}
|
|
86
|
+
function adaptResponse(httpResponse) {
|
|
87
|
+
if (httpResponse.error) {
|
|
88
|
+
return {
|
|
89
|
+
status: httpResponse.status,
|
|
90
|
+
error: httpResponse.error
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
const responseData = httpResponse.data;
|
|
94
|
+
if (isEdgeFunctionEnvelope(responseData)) {
|
|
95
|
+
return adaptEdgeFunctionResponse({
|
|
96
|
+
status: httpResponse.status,
|
|
97
|
+
data: responseData
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
status: httpResponse.status,
|
|
102
|
+
data: responseData
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
var ResponseCache = class {
|
|
106
|
+
cache = /* @__PURE__ */ new Map();
|
|
107
|
+
ttl;
|
|
108
|
+
constructor(ttlMs = 3e5) {
|
|
109
|
+
this.ttl = ttlMs;
|
|
110
|
+
}
|
|
111
|
+
generateKey(endpoint, params) {
|
|
112
|
+
const paramStr = params ? JSON.stringify(params) : "";
|
|
113
|
+
return `${endpoint}:${paramStr}`;
|
|
114
|
+
}
|
|
115
|
+
set(endpoint, data, params) {
|
|
116
|
+
const key = this.generateKey(endpoint, params);
|
|
117
|
+
this.cache.set(key, {
|
|
118
|
+
data,
|
|
119
|
+
timestamp: Date.now(),
|
|
120
|
+
endpoint,
|
|
121
|
+
params
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
get(endpoint, params) {
|
|
125
|
+
const key = this.generateKey(endpoint, params);
|
|
126
|
+
const entry = this.cache.get(key);
|
|
127
|
+
if (!entry) {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
if (Date.now() - entry.timestamp > this.ttl) {
|
|
131
|
+
this.cache.delete(key);
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
return entry.data;
|
|
135
|
+
}
|
|
136
|
+
clear() {
|
|
137
|
+
this.cache.clear();
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Clean up expired entries
|
|
141
|
+
*/
|
|
142
|
+
cleanup() {
|
|
143
|
+
const now = Date.now();
|
|
144
|
+
for (const [key, entry] of this.cache.entries()) {
|
|
145
|
+
if (now - entry.timestamp > this.ttl) {
|
|
146
|
+
this.cache.delete(key);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
|
|
46
152
|
// src/utils/http-client.ts
|
|
47
153
|
var HttpClient = class {
|
|
48
154
|
apiUrl;
|
|
49
155
|
apiKey;
|
|
50
156
|
timeout;
|
|
51
157
|
headers;
|
|
158
|
+
processingMode;
|
|
159
|
+
cache;
|
|
52
160
|
constructor(config) {
|
|
53
161
|
if (!config.apiKey) {
|
|
54
162
|
throw new ConfigurationError("API key is required");
|
|
@@ -61,11 +169,35 @@ var HttpClient = class {
|
|
|
61
169
|
this.apiUrl = config.apiUrl.replace(/\/$/, "");
|
|
62
170
|
this.apiKey = config.apiKey;
|
|
63
171
|
this.timeout = config.timeout || 3e4;
|
|
172
|
+
this.processingMode = config.processingMode || "api";
|
|
64
173
|
this.headers = {
|
|
65
174
|
"Content-Type": "application/json",
|
|
66
175
|
"X-API-Key": this.apiKey,
|
|
67
176
|
...config.headers
|
|
68
177
|
};
|
|
178
|
+
if (config.enableCache !== false && this.processingMode === "offline-fallback") {
|
|
179
|
+
this.cache = new ResponseCache(config.cacheTTL || 3e5);
|
|
180
|
+
} else {
|
|
181
|
+
this.cache = null;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Get the current processing mode
|
|
186
|
+
*/
|
|
187
|
+
getProcessingMode() {
|
|
188
|
+
return this.processingMode;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Check if cache is enabled
|
|
192
|
+
*/
|
|
193
|
+
isCacheEnabled() {
|
|
194
|
+
return this.cache !== null;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Clear the response cache
|
|
198
|
+
*/
|
|
199
|
+
clearCache() {
|
|
200
|
+
this.cache?.clear();
|
|
69
201
|
}
|
|
70
202
|
async request(method, endpoint, data) {
|
|
71
203
|
const url = `${this.apiUrl}${endpoint}`;
|
|
@@ -125,6 +257,43 @@ var HttpClient = class {
|
|
|
125
257
|
};
|
|
126
258
|
}
|
|
127
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* Enhanced request that handles Edge Function envelope format
|
|
262
|
+
* and supports offline-fallback caching
|
|
263
|
+
*/
|
|
264
|
+
async enhancedRequest(method, endpoint, data) {
|
|
265
|
+
const cacheKey = data ? JSON.stringify(data) : void 0;
|
|
266
|
+
const rawResponse = await this.request(method, endpoint, data);
|
|
267
|
+
if (rawResponse.error?.code === "NETWORK_ERROR" || rawResponse.error?.code === "TIMEOUT") {
|
|
268
|
+
if (this.processingMode === "offline-fallback" && this.cache) {
|
|
269
|
+
const cached = this.cache.get(endpoint, cacheKey ? JSON.parse(cacheKey) : void 0);
|
|
270
|
+
if (cached) {
|
|
271
|
+
return {
|
|
272
|
+
status: 200,
|
|
273
|
+
data: cached,
|
|
274
|
+
fromCache: true
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return {
|
|
279
|
+
status: rawResponse.status,
|
|
280
|
+
error: rawResponse.error,
|
|
281
|
+
fromCache: false
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
const adapted = adaptResponse(rawResponse);
|
|
285
|
+
if (!adapted.error && adapted.data && this.cache) {
|
|
286
|
+
this.cache.set(endpoint, adapted.data, cacheKey ? JSON.parse(cacheKey) : void 0);
|
|
287
|
+
}
|
|
288
|
+
return {
|
|
289
|
+
status: adapted.status,
|
|
290
|
+
data: adapted.data,
|
|
291
|
+
error: adapted.error,
|
|
292
|
+
usage: adapted.usage,
|
|
293
|
+
tier_info: adapted.tier_info,
|
|
294
|
+
fromCache: false
|
|
295
|
+
};
|
|
296
|
+
}
|
|
128
297
|
async get(endpoint) {
|
|
129
298
|
return this.request("GET", endpoint);
|
|
130
299
|
}
|
|
@@ -140,6 +309,22 @@ var HttpClient = class {
|
|
|
140
309
|
async delete(endpoint) {
|
|
141
310
|
return this.request("DELETE", endpoint);
|
|
142
311
|
}
|
|
312
|
+
// Enhanced methods with Edge Function envelope support
|
|
313
|
+
async getEnhanced(endpoint) {
|
|
314
|
+
return this.enhancedRequest("GET", endpoint);
|
|
315
|
+
}
|
|
316
|
+
async postEnhanced(endpoint, data) {
|
|
317
|
+
return this.enhancedRequest("POST", endpoint, data);
|
|
318
|
+
}
|
|
319
|
+
async putEnhanced(endpoint, data) {
|
|
320
|
+
return this.enhancedRequest("PUT", endpoint, data);
|
|
321
|
+
}
|
|
322
|
+
async patchEnhanced(endpoint, data) {
|
|
323
|
+
return this.enhancedRequest("PATCH", endpoint, data);
|
|
324
|
+
}
|
|
325
|
+
async deleteEnhanced(endpoint) {
|
|
326
|
+
return this.enhancedRequest("DELETE", endpoint);
|
|
327
|
+
}
|
|
143
328
|
};
|
|
144
329
|
|
|
145
330
|
// src/core/client.ts
|
|
@@ -147,20 +332,43 @@ var DEFAULT_API_URL = "https://api.lanonasis.com/api/v1";
|
|
|
147
332
|
var MemoryIntelligenceClient = class {
|
|
148
333
|
httpClient;
|
|
149
334
|
defaultResponseFormat;
|
|
335
|
+
processingMode;
|
|
150
336
|
constructor(config) {
|
|
151
337
|
if (!config.apiKey) {
|
|
152
338
|
throw new ConfigurationError(
|
|
153
339
|
"Missing required configuration: apiKey is required (format: lano_xxxxxxxxxx)"
|
|
154
340
|
);
|
|
155
341
|
}
|
|
342
|
+
this.processingMode = config.processingMode || "api";
|
|
156
343
|
this.httpClient = new HttpClient({
|
|
157
344
|
apiUrl: config.apiUrl || DEFAULT_API_URL,
|
|
158
345
|
apiKey: config.apiKey,
|
|
159
346
|
timeout: config.timeout,
|
|
160
|
-
headers: config.headers
|
|
347
|
+
headers: config.headers,
|
|
348
|
+
processingMode: this.processingMode,
|
|
349
|
+
enableCache: config.enableCache,
|
|
350
|
+
cacheTTL: config.cacheTTL
|
|
161
351
|
});
|
|
162
352
|
this.defaultResponseFormat = config.responseFormat || "markdown";
|
|
163
353
|
}
|
|
354
|
+
/**
|
|
355
|
+
* Get the current processing mode
|
|
356
|
+
*/
|
|
357
|
+
getProcessingMode() {
|
|
358
|
+
return this.processingMode;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Check if cache is enabled (for offline-fallback mode)
|
|
362
|
+
*/
|
|
363
|
+
isCacheEnabled() {
|
|
364
|
+
return this.httpClient.isCacheEnabled();
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Clear the response cache
|
|
368
|
+
*/
|
|
369
|
+
clearCache() {
|
|
370
|
+
this.httpClient.clearCache();
|
|
371
|
+
}
|
|
164
372
|
/**
|
|
165
373
|
* Get HTTP client for direct API access
|
|
166
374
|
*/
|
|
@@ -192,7 +400,7 @@ var MemoryIntelligenceClient = class {
|
|
|
192
400
|
* Analyze usage patterns and trends in memory collection
|
|
193
401
|
*/
|
|
194
402
|
async analyzePatterns(params) {
|
|
195
|
-
const response = await this.httpClient.
|
|
403
|
+
const response = await this.httpClient.postEnhanced(
|
|
196
404
|
"/intelligence/analyze-patterns",
|
|
197
405
|
{
|
|
198
406
|
...params,
|
|
@@ -202,13 +410,18 @@ var MemoryIntelligenceClient = class {
|
|
|
202
410
|
if (response.error) {
|
|
203
411
|
throw new DatabaseError(`Failed to analyze patterns: ${response.error.message}`);
|
|
204
412
|
}
|
|
205
|
-
return
|
|
413
|
+
return {
|
|
414
|
+
data: response.data,
|
|
415
|
+
usage: response.usage,
|
|
416
|
+
tier_info: response.tier_info,
|
|
417
|
+
fromCache: response.fromCache
|
|
418
|
+
};
|
|
206
419
|
}
|
|
207
420
|
/**
|
|
208
421
|
* Get AI-powered tag suggestions for a memory
|
|
209
422
|
*/
|
|
210
423
|
async suggestTags(params) {
|
|
211
|
-
const response = await this.httpClient.
|
|
424
|
+
const response = await this.httpClient.postEnhanced(
|
|
212
425
|
"/intelligence/suggest-tags",
|
|
213
426
|
{
|
|
214
427
|
...params,
|
|
@@ -218,13 +431,18 @@ var MemoryIntelligenceClient = class {
|
|
|
218
431
|
if (response.error) {
|
|
219
432
|
throw new DatabaseError(`Failed to suggest tags: ${response.error.message}`);
|
|
220
433
|
}
|
|
221
|
-
return
|
|
434
|
+
return {
|
|
435
|
+
data: response.data,
|
|
436
|
+
usage: response.usage,
|
|
437
|
+
tier_info: response.tier_info,
|
|
438
|
+
fromCache: response.fromCache
|
|
439
|
+
};
|
|
222
440
|
}
|
|
223
441
|
/**
|
|
224
442
|
* Find semantically related memories using vector similarity
|
|
225
443
|
*/
|
|
226
444
|
async findRelated(params) {
|
|
227
|
-
const response = await this.httpClient.
|
|
445
|
+
const response = await this.httpClient.postEnhanced(
|
|
228
446
|
"/intelligence/find-related",
|
|
229
447
|
{
|
|
230
448
|
...params,
|
|
@@ -234,13 +452,18 @@ var MemoryIntelligenceClient = class {
|
|
|
234
452
|
if (response.error) {
|
|
235
453
|
throw new DatabaseError(`Failed to find related memories: ${response.error.message}`);
|
|
236
454
|
}
|
|
237
|
-
return
|
|
455
|
+
return {
|
|
456
|
+
data: response.data,
|
|
457
|
+
usage: response.usage,
|
|
458
|
+
tier_info: response.tier_info,
|
|
459
|
+
fromCache: response.fromCache
|
|
460
|
+
};
|
|
238
461
|
}
|
|
239
462
|
/**
|
|
240
463
|
* Detect potential duplicate memories
|
|
241
464
|
*/
|
|
242
465
|
async detectDuplicates(params) {
|
|
243
|
-
const response = await this.httpClient.
|
|
466
|
+
const response = await this.httpClient.postEnhanced(
|
|
244
467
|
"/intelligence/detect-duplicates",
|
|
245
468
|
{
|
|
246
469
|
...params,
|
|
@@ -250,13 +473,18 @@ var MemoryIntelligenceClient = class {
|
|
|
250
473
|
if (response.error) {
|
|
251
474
|
throw new DatabaseError(`Failed to detect duplicates: ${response.error.message}`);
|
|
252
475
|
}
|
|
253
|
-
return
|
|
476
|
+
return {
|
|
477
|
+
data: response.data,
|
|
478
|
+
usage: response.usage,
|
|
479
|
+
tier_info: response.tier_info,
|
|
480
|
+
fromCache: response.fromCache
|
|
481
|
+
};
|
|
254
482
|
}
|
|
255
483
|
/**
|
|
256
484
|
* Extract insights and patterns from memories
|
|
257
485
|
*/
|
|
258
486
|
async extractInsights(params) {
|
|
259
|
-
const response = await this.httpClient.
|
|
487
|
+
const response = await this.httpClient.postEnhanced(
|
|
260
488
|
"/intelligence/extract-insights",
|
|
261
489
|
{
|
|
262
490
|
...params,
|
|
@@ -266,13 +494,18 @@ var MemoryIntelligenceClient = class {
|
|
|
266
494
|
if (response.error) {
|
|
267
495
|
throw new DatabaseError(`Failed to extract insights: ${response.error.message}`);
|
|
268
496
|
}
|
|
269
|
-
return
|
|
497
|
+
return {
|
|
498
|
+
data: response.data,
|
|
499
|
+
usage: response.usage,
|
|
500
|
+
tier_info: response.tier_info,
|
|
501
|
+
fromCache: response.fromCache
|
|
502
|
+
};
|
|
270
503
|
}
|
|
271
504
|
/**
|
|
272
505
|
* Check the health and organization quality of memories
|
|
273
506
|
*/
|
|
274
507
|
async healthCheck(params) {
|
|
275
|
-
const response = await this.httpClient.
|
|
508
|
+
const response = await this.httpClient.postEnhanced(
|
|
276
509
|
"/intelligence/health-check",
|
|
277
510
|
{
|
|
278
511
|
...params,
|
|
@@ -282,7 +515,12 @@ var MemoryIntelligenceClient = class {
|
|
|
282
515
|
if (response.error) {
|
|
283
516
|
throw new DatabaseError(`Failed to check health: ${response.error.message}`);
|
|
284
517
|
}
|
|
285
|
-
return
|
|
518
|
+
return {
|
|
519
|
+
data: response.data,
|
|
520
|
+
usage: response.usage,
|
|
521
|
+
tier_info: response.tier_info,
|
|
522
|
+
fromCache: response.fromCache
|
|
523
|
+
};
|
|
286
524
|
}
|
|
287
525
|
};
|
|
288
526
|
var ResponseFormat = {
|
|
@@ -320,7 +558,7 @@ function createMCPServer(config) {
|
|
|
320
558
|
const client = new MemoryIntelligenceClient(config);
|
|
321
559
|
const server = new McpServer({
|
|
322
560
|
name: "memory-intelligence-mcp-server",
|
|
323
|
-
version: "1.
|
|
561
|
+
version: "1.1.0"
|
|
324
562
|
});
|
|
325
563
|
server.registerTool(
|
|
326
564
|
"memory_analyze_patterns",
|
|
@@ -346,7 +584,8 @@ function createMCPServer(config) {
|
|
|
346
584
|
timeRangeDays: rawParams.time_range_days,
|
|
347
585
|
responseFormat: rawParams.response_format
|
|
348
586
|
};
|
|
349
|
-
const
|
|
587
|
+
const response = await client.analyzePatterns(params);
|
|
588
|
+
const analysis = response.data;
|
|
350
589
|
const responseText = formatResponse(
|
|
351
590
|
analysis,
|
|
352
591
|
params.responseFormat || "markdown",
|
|
@@ -436,7 +675,8 @@ function createMCPServer(config) {
|
|
|
436
675
|
includeExistingTags: rawParams.include_existing_tags,
|
|
437
676
|
responseFormat: rawParams.response_format
|
|
438
677
|
};
|
|
439
|
-
const
|
|
678
|
+
const response = await client.suggestTags(params);
|
|
679
|
+
const result = response.data;
|
|
440
680
|
const responseText = formatResponse(
|
|
441
681
|
result,
|
|
442
682
|
params.responseFormat || "markdown",
|
|
@@ -505,7 +745,8 @@ function createMCPServer(config) {
|
|
|
505
745
|
similarityThreshold: rawParams.similarity_threshold,
|
|
506
746
|
responseFormat: rawParams.response_format
|
|
507
747
|
};
|
|
508
|
-
const
|
|
748
|
+
const response = await client.findRelated(params);
|
|
749
|
+
const result = response.data;
|
|
509
750
|
const responseText = formatResponse(
|
|
510
751
|
result,
|
|
511
752
|
params.responseFormat || "markdown",
|
|
@@ -576,7 +817,8 @@ function createMCPServer(config) {
|
|
|
576
817
|
maxPairs: rawParams.max_pairs,
|
|
577
818
|
responseFormat: rawParams.response_format
|
|
578
819
|
};
|
|
579
|
-
const
|
|
820
|
+
const response = await client.detectDuplicates(params);
|
|
821
|
+
const result = response.data;
|
|
580
822
|
const responseText = formatResponse(
|
|
581
823
|
result,
|
|
582
824
|
params.responseFormat || "markdown",
|
|
@@ -649,7 +891,8 @@ function createMCPServer(config) {
|
|
|
649
891
|
maxMemories: rawParams.max_memories,
|
|
650
892
|
responseFormat: rawParams.response_format
|
|
651
893
|
};
|
|
652
|
-
const
|
|
894
|
+
const response = await client.extractInsights(params);
|
|
895
|
+
const result = response.data;
|
|
653
896
|
const responseText = formatResponse(
|
|
654
897
|
result,
|
|
655
898
|
params.responseFormat || "markdown",
|
|
@@ -670,14 +913,15 @@ ${data.summary}
|
|
|
670
913
|
`;
|
|
671
914
|
md += `## Insights
|
|
672
915
|
`;
|
|
916
|
+
const categoryIcons = {
|
|
917
|
+
pattern: "\u{1F504}",
|
|
918
|
+
learning: "\u{1F4A1}",
|
|
919
|
+
opportunity: "\u{1F680}",
|
|
920
|
+
risk: "\u26A0\uFE0F",
|
|
921
|
+
action_item: "\u2705"
|
|
922
|
+
};
|
|
673
923
|
for (const insight of data.insights) {
|
|
674
|
-
const icon = {
|
|
675
|
-
pattern: "\u{1F504}",
|
|
676
|
-
learning: "\u{1F4A1}",
|
|
677
|
-
opportunity: "\u{1F680}",
|
|
678
|
-
risk: "\u26A0\uFE0F",
|
|
679
|
-
action_item: "\u2705"
|
|
680
|
-
}[insight.category] || "\u{1F4CC}";
|
|
924
|
+
const icon = categoryIcons[insight.category] || "\u{1F4CC}";
|
|
681
925
|
md += `
|
|
682
926
|
### ${icon} ${insight.title}
|
|
683
927
|
`;
|
|
@@ -727,7 +971,8 @@ ${data.summary}
|
|
|
727
971
|
userId: rawParams.user_id,
|
|
728
972
|
responseFormat: rawParams.response_format
|
|
729
973
|
};
|
|
730
|
-
const
|
|
974
|
+
const response = await client.healthCheck(params);
|
|
975
|
+
const result = response.data;
|
|
731
976
|
const responseText = formatResponse(
|
|
732
977
|
result,
|
|
733
978
|
params.responseFormat || "markdown",
|