@scitrera/memorylayer-mcp-server 0.0.3 → 0.0.5

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 (40) hide show
  1. package/README.md +115 -10
  2. package/dist/bin/memorylayer-mcp.js +19 -0
  3. package/dist/bin/memorylayer-mcp.js.map +1 -1
  4. package/dist/src/client.d.ts +153 -0
  5. package/dist/src/client.d.ts.map +1 -0
  6. package/dist/src/client.js +330 -0
  7. package/dist/src/client.js.map +1 -0
  8. package/dist/src/handlers.d.ts +33 -0
  9. package/dist/src/handlers.d.ts.map +1 -0
  10. package/dist/src/handlers.js +466 -0
  11. package/dist/src/handlers.js.map +1 -0
  12. package/dist/src/index.d.ts +15 -0
  13. package/dist/src/index.d.ts.map +1 -0
  14. package/dist/src/index.js +13 -0
  15. package/dist/src/index.js.map +1 -0
  16. package/dist/src/server.d.ts +42 -0
  17. package/dist/src/server.d.ts.map +1 -0
  18. package/dist/src/server.js +249 -0
  19. package/dist/src/server.js.map +1 -0
  20. package/dist/src/session.d.ts +68 -0
  21. package/dist/src/session.d.ts.map +1 -0
  22. package/dist/src/session.js +103 -0
  23. package/dist/src/session.js.map +1 -0
  24. package/dist/src/tools.d.ts +1977 -0
  25. package/dist/src/tools.d.ts.map +1 -0
  26. package/dist/src/tools.js +696 -0
  27. package/dist/src/tools.js.map +1 -0
  28. package/dist/src/types.d.ts +136 -0
  29. package/dist/src/types.d.ts.map +1 -0
  30. package/dist/src/types.js +7 -0
  31. package/dist/src/types.js.map +1 -0
  32. package/dist/src/workspace.d.ts +6 -0
  33. package/dist/src/workspace.d.ts.map +1 -0
  34. package/dist/src/workspace.js +35 -0
  35. package/dist/src/workspace.js.map +1 -0
  36. package/package.json +8 -9
  37. package/dist/bin/memorylayer-hook.d.ts +0 -19
  38. package/dist/bin/memorylayer-hook.d.ts.map +0 -1
  39. package/dist/bin/memorylayer-hook.js +0 -223
  40. package/dist/bin/memorylayer-hook.js.map +0 -1
@@ -0,0 +1,466 @@
1
+ /**
2
+ * MCP tool handler implementations
3
+ */
4
+ export class MCPToolHandlers {
5
+ client;
6
+ sessionManager;
7
+ constructor(client, sessionManager) {
8
+ this.client = client;
9
+ this.sessionManager = sessionManager;
10
+ }
11
+ async handleMemoryRemember(args) {
12
+ const content = args.content;
13
+ if (!content) {
14
+ throw new Error("content is required");
15
+ }
16
+ const memory = await this.client.remember({
17
+ content,
18
+ type: args.type,
19
+ subtype: args.subtype,
20
+ importance: args.importance,
21
+ tags: args.tags
22
+ });
23
+ return JSON.stringify({
24
+ success: true,
25
+ memory_id: memory.id,
26
+ type: memory.type,
27
+ importance: memory.importance,
28
+ tags: memory.tags,
29
+ message: `Stored memory ${memory.id}`
30
+ }, null, 2);
31
+ }
32
+ async handleMemoryRecall(args) {
33
+ const query = args.query;
34
+ if (!query) {
35
+ throw new Error("query is required");
36
+ }
37
+ const result = await this.client.recall({
38
+ query,
39
+ types: args.types,
40
+ tags: args.tags,
41
+ limit: args.limit,
42
+ min_relevance: args.min_relevance
43
+ });
44
+ const memoriesData = result.memories.map(memory => ({
45
+ id: memory.id,
46
+ content: memory.content,
47
+ type: memory.type,
48
+ subtype: memory.subtype,
49
+ importance: memory.importance,
50
+ tags: memory.tags,
51
+ created_at: memory.created_at,
52
+ access_count: memory.access_count
53
+ }));
54
+ return JSON.stringify({
55
+ success: true,
56
+ memories: memoriesData,
57
+ total_count: result.total_count,
58
+ search_latency_ms: result.search_latency_ms,
59
+ mode_used: result.mode_used
60
+ }, null, 2);
61
+ }
62
+ async handleMemoryReflect(args) {
63
+ const query = args.query;
64
+ if (!query) {
65
+ throw new Error("query is required");
66
+ }
67
+ const result = await this.client.reflect({
68
+ query,
69
+ detail_level: args.detail_level,
70
+ include_sources: args.include_sources,
71
+ depth: args.depth
72
+ });
73
+ return JSON.stringify({
74
+ success: true,
75
+ reflection: result.reflection,
76
+ source_memories: result.source_memories,
77
+ tokens_processed: result.tokens_processed
78
+ }, null, 2);
79
+ }
80
+ async handleMemoryForget(args) {
81
+ const memoryId = args.memory_id;
82
+ if (!memoryId) {
83
+ throw new Error("memory_id is required");
84
+ }
85
+ const hard = args.hard || false;
86
+ const reason = args.reason;
87
+ const result = await this.client.forget(memoryId, hard, reason);
88
+ return JSON.stringify({
89
+ success: result.success,
90
+ memory_id: memoryId,
91
+ hard_delete: hard,
92
+ reason: reason || "No reason provided",
93
+ message: result.success
94
+ ? `Forgot memory ${memoryId}`
95
+ : `Failed to forget memory ${memoryId}`
96
+ }, null, 2);
97
+ }
98
+ async handleMemoryAssociate(args) {
99
+ const sourceId = args.source_id;
100
+ const targetId = args.target_id;
101
+ const relationship = args.relationship;
102
+ if (!sourceId || !targetId || !relationship) {
103
+ throw new Error("source_id, target_id, and relationship are required");
104
+ }
105
+ const association = await this.client.associate({
106
+ source_id: sourceId,
107
+ target_id: targetId,
108
+ relationship,
109
+ strength: args.strength
110
+ });
111
+ return JSON.stringify({
112
+ success: true,
113
+ association_id: association.id,
114
+ source_id: association.source_id,
115
+ target_id: association.target_id,
116
+ relationship: association.relationship,
117
+ strength: association.strength,
118
+ message: `Created association ${association.id}`
119
+ }, null, 2);
120
+ }
121
+ async handleMemoryBriefing(args) {
122
+ const result = await this.client.getBriefing({
123
+ timeWindowMinutes: args.time_window_minutes,
124
+ detailLevel: args.detail_level,
125
+ limit: args.limit,
126
+ includeMemories: args.include_memories,
127
+ includeContradictions: args.include_contradictions,
128
+ });
129
+ return JSON.stringify(result, null, 2);
130
+ }
131
+ async handleMemoryStatistics(args) {
132
+ const includeBreakdown = args.include_breakdown !== false;
133
+ const result = await this.client.getStatistics(includeBreakdown);
134
+ return JSON.stringify(result, null, 2);
135
+ }
136
+ async handleMemoryGraphQuery(args) {
137
+ const startMemoryId = args.start_memory_id;
138
+ if (!startMemoryId) {
139
+ throw new Error("start_memory_id is required");
140
+ }
141
+ const result = await this.client.graphQuery({
142
+ start_memory_id: startMemoryId,
143
+ relationship_types: args.relationship_types,
144
+ max_depth: args.max_depth,
145
+ direction: args.direction,
146
+ max_paths: args.max_paths
147
+ });
148
+ const pathsData = result.paths.map(path => ({
149
+ nodes: path.nodes,
150
+ edges: path.edges.map(edge => ({
151
+ from: edge.source_id,
152
+ to: edge.target_id,
153
+ relationship: edge.relationship,
154
+ strength: edge.strength
155
+ })),
156
+ total_strength: path.total_strength
157
+ }));
158
+ return JSON.stringify({
159
+ success: true,
160
+ paths: pathsData,
161
+ total_paths: result.total_paths,
162
+ unique_nodes: result.unique_nodes
163
+ }, null, 2);
164
+ }
165
+ async handleMemoryAudit(args) {
166
+ const memoryId = args.memory_id;
167
+ const autoResolve = args.auto_resolve || false;
168
+ const result = await this.client.auditMemories(memoryId, autoResolve);
169
+ return JSON.stringify(result, null, 2);
170
+ }
171
+ // TODO: handleMemoryCompress - commented out until compression logic is implemented
172
+ // async handleMemoryCompress(args: Record<string, unknown>): Promise<string> {
173
+ // const result = await this.client.compressMemories({
174
+ // olderThanDays: args.older_than_days as number | undefined,
175
+ // minAccessCount: args.min_access_count as number | undefined,
176
+ // preserveImportant: args.preserve_important as boolean | undefined,
177
+ // dryRun: args.dry_run as boolean | undefined
178
+ // });
179
+ //
180
+ // return JSON.stringify(result, null, 2);
181
+ // }
182
+ // ============================================================================
183
+ // Session Management Handlers
184
+ // ============================================================================
185
+ async handleMemorySessionStart(args) {
186
+ if (!this.sessionManager.isEnabled) {
187
+ return JSON.stringify({
188
+ success: false,
189
+ error: "Session mode is not enabled"
190
+ }, null, 2);
191
+ }
192
+ // If a session already exists, return it instead of creating a duplicate
193
+ const existing = this.sessionManager.currentSession;
194
+ if (existing) {
195
+ console.error(`Session already active: ${existing.id} (server: ${existing.serverSessionId}), reusing`);
196
+ return JSON.stringify({
197
+ success: true,
198
+ session_id: existing.id,
199
+ workspace_id: existing.workspaceId,
200
+ server_session_id: existing.serverSessionId,
201
+ created_at: existing.createdAt.toISOString(),
202
+ reused: true,
203
+ message: "Existing session reused. If resuming after context compaction, call memory_context_inspect to see existing sandbox variables."
204
+ }, null, 2);
205
+ }
206
+ // Get workspace ID from client
207
+ const workspaceId = this.client.getWorkspaceId();
208
+ // Start server-side session if client supports it
209
+ let serverSessionId;
210
+ try {
211
+ console.error(`Creating server session for workspace: ${workspaceId}`);
212
+ const serverSession = await this.client.startSession({
213
+ ttl_seconds: this.sessionManager.getTtlSeconds(),
214
+ metadata: args.metadata
215
+ });
216
+ serverSessionId = serverSession.session_id;
217
+ // Set session on SDK client so subsequent requests include X-Session-ID header,
218
+ // enabling correct workspace resolution on the server
219
+ this.client.setSessionId(serverSessionId);
220
+ console.error(`Server session created: ${serverSessionId} for workspace: ${workspaceId}`);
221
+ }
222
+ catch (error) {
223
+ // Server may not support sessions yet, continue with local-only
224
+ // This is a critical issue - without a session, workspace resolution falls back to _default!
225
+ console.error(`WARNING: Server session creation failed for workspace ${workspaceId}:`, error instanceof Error ? error.message : error);
226
+ console.error("Operations will fall back to _default workspace without a valid session!");
227
+ }
228
+ const session = this.sessionManager.startSession(workspaceId, serverSessionId);
229
+ return JSON.stringify({
230
+ success: true,
231
+ session_id: session.id,
232
+ workspace_id: session.workspaceId,
233
+ server_session_id: session.serverSessionId,
234
+ created_at: session.createdAt.toISOString(),
235
+ message: "Session started. If resuming after context compaction, call memory_context_inspect to see existing sandbox variables."
236
+ }, null, 2);
237
+ }
238
+ async handleMemorySessionEnd(args) {
239
+ if (!this.sessionManager.isEnabled) {
240
+ return JSON.stringify({
241
+ success: false,
242
+ error: "Session mode is not enabled"
243
+ }, null, 2);
244
+ }
245
+ const session = this.sessionManager.currentSession;
246
+ if (!session) {
247
+ return JSON.stringify({
248
+ success: false,
249
+ error: "No active session"
250
+ }, null, 2);
251
+ }
252
+ const commit = args.commit !== false;
253
+ const importanceThreshold = args.importance_threshold ?? 0.5;
254
+ let commitResult = {};
255
+ // If committing, send working memory to server for extraction
256
+ if (commit && session.serverSessionId) {
257
+ try {
258
+ // Gather working memory as context for extraction
259
+ const workingMemory = this.sessionManager.getAllWorkingMemory();
260
+ const contextData = workingMemory.map(entry => ({
261
+ key: entry.key,
262
+ value: entry.value,
263
+ category: entry.value?.category
264
+ }));
265
+ commitResult = await this.client.endSession(session.serverSessionId, {
266
+ commit: true,
267
+ importance_threshold: importanceThreshold,
268
+ working_memory: contextData
269
+ });
270
+ }
271
+ catch (error) {
272
+ console.error("Server session commit failed:", error);
273
+ }
274
+ }
275
+ this.sessionManager.markCommitted();
276
+ const endedSession = this.sessionManager.endSession();
277
+ // Ensure SDK client session is cleared even if server commit was skipped
278
+ this.client.clearSessionId();
279
+ return JSON.stringify({
280
+ success: true,
281
+ session_id: endedSession?.id,
282
+ committed: commit,
283
+ working_memory_count: endedSession?.workingMemory.size ?? 0,
284
+ memories_extracted: commitResult.memories_extracted ?? 0,
285
+ message: commit ? "Session ended and committed" : "Session ended without commit"
286
+ }, null, 2);
287
+ }
288
+ async handleMemorySessionCommit(args) {
289
+ if (!this.sessionManager.isEnabled) {
290
+ return JSON.stringify({
291
+ success: false,
292
+ error: "Session mode is not enabled"
293
+ }, null, 2);
294
+ }
295
+ const session = this.sessionManager.currentSession;
296
+ if (!session) {
297
+ return JSON.stringify({
298
+ success: false,
299
+ error: "No active session"
300
+ }, null, 2);
301
+ }
302
+ if (!session.serverSessionId) {
303
+ return JSON.stringify({
304
+ success: false,
305
+ error: "No server session available for commit"
306
+ }, null, 2);
307
+ }
308
+ const importanceThreshold = args.importance_threshold ?? 0.5;
309
+ const clearAfterCommit = args.clear_after_commit ?? false;
310
+ try {
311
+ const commitResult = await this.client.commitSession(session.serverSessionId, {
312
+ importance_threshold: importanceThreshold
313
+ });
314
+ // Optionally clear local working memory after commit
315
+ if (clearAfterCommit) {
316
+ this.sessionManager.clearWorkingMemory();
317
+ }
318
+ // Mark session as committed (but don't end it)
319
+ this.sessionManager.markCommitted();
320
+ return JSON.stringify({
321
+ success: true,
322
+ session_id: session.id,
323
+ server_session_id: session.serverSessionId,
324
+ memories_extracted: commitResult.memories_extracted,
325
+ memories_created: commitResult.memories_created,
326
+ working_memory_cleared: clearAfterCommit,
327
+ session_still_active: true,
328
+ message: "Working memory committed to long-term storage (session still active)"
329
+ }, null, 2);
330
+ }
331
+ catch (error) {
332
+ return JSON.stringify({
333
+ success: false,
334
+ error: `Commit failed: ${error instanceof Error ? error.message : error}`
335
+ }, null, 2);
336
+ }
337
+ }
338
+ async handleMemorySessionStatus(_args) {
339
+ if (!this.sessionManager.isEnabled) {
340
+ return JSON.stringify({
341
+ enabled: false,
342
+ message: "Session mode is not enabled"
343
+ }, null, 2);
344
+ }
345
+ const summary = this.sessionManager.getSessionSummary();
346
+ return JSON.stringify({
347
+ enabled: true,
348
+ ...summary
349
+ }, null, 2);
350
+ }
351
+ // ============================================================================
352
+ // Context Environment Handlers
353
+ // ============================================================================
354
+ ensureActiveSession() {
355
+ if (!this.sessionManager.hasActiveSession) {
356
+ throw new Error("No active session. Call memory_session_start first.");
357
+ }
358
+ }
359
+ async handleMemoryContextExec(args) {
360
+ const code = args.code;
361
+ if (!code) {
362
+ throw new Error("code is required");
363
+ }
364
+ this.ensureActiveSession();
365
+ const input = {
366
+ code,
367
+ result_var: args.result_var,
368
+ return_result: args.return_result,
369
+ max_return_chars: args.max_return_chars,
370
+ };
371
+ const result = await this.client.contextExec(input);
372
+ return JSON.stringify(result, null, 2);
373
+ }
374
+ async handleMemoryContextInspect(args) {
375
+ this.ensureActiveSession();
376
+ const input = {
377
+ variable: args.variable,
378
+ preview_chars: args.preview_chars,
379
+ };
380
+ const result = await this.client.contextInspect(input);
381
+ return JSON.stringify(result, null, 2);
382
+ }
383
+ async handleMemoryContextLoad(args) {
384
+ const varName = args.var;
385
+ const query = args.query;
386
+ if (!varName || !query) {
387
+ throw new Error("var and query are required");
388
+ }
389
+ this.ensureActiveSession();
390
+ const input = {
391
+ var: varName,
392
+ query,
393
+ limit: args.limit,
394
+ types: args.types,
395
+ tags: args.tags,
396
+ min_relevance: args.min_relevance,
397
+ include_embeddings: args.include_embeddings,
398
+ };
399
+ const result = await this.client.contextLoad(input);
400
+ return JSON.stringify(result, null, 2);
401
+ }
402
+ async handleMemoryContextInject(args) {
403
+ const key = args.key;
404
+ const value = args.value;
405
+ if (!key || value === undefined) {
406
+ throw new Error("key and value are required");
407
+ }
408
+ this.ensureActiveSession();
409
+ const input = {
410
+ key,
411
+ value,
412
+ parse_json: args.parse_json,
413
+ };
414
+ const result = await this.client.contextInject(input);
415
+ return JSON.stringify(result, null, 2);
416
+ }
417
+ async handleMemoryContextQuery(args) {
418
+ const prompt = args.prompt;
419
+ const variables = args.variables;
420
+ if (!prompt || !variables) {
421
+ throw new Error("prompt and variables are required");
422
+ }
423
+ this.ensureActiveSession();
424
+ const input = {
425
+ prompt,
426
+ variables,
427
+ max_context_chars: args.max_context_chars,
428
+ result_var: args.result_var,
429
+ };
430
+ const result = await this.client.contextQuery(input);
431
+ return JSON.stringify(result, null, 2);
432
+ }
433
+ async handleMemoryContextRlm(args) {
434
+ const goal = args.goal;
435
+ if (!goal) {
436
+ throw new Error("goal is required");
437
+ }
438
+ this.ensureActiveSession();
439
+ const input = {
440
+ goal,
441
+ memory_query: args.memory_query,
442
+ memory_limit: args.memory_limit,
443
+ max_iterations: args.max_iterations,
444
+ variables: args.variables,
445
+ result_var: args.result_var,
446
+ detail_level: args.detail_level,
447
+ };
448
+ const result = await this.client.contextRlm(input);
449
+ return JSON.stringify(result, null, 2);
450
+ }
451
+ async handleMemoryContextStatus(_args) {
452
+ this.ensureActiveSession();
453
+ const result = await this.client.contextStatus();
454
+ return JSON.stringify(result, null, 2);
455
+ }
456
+ async handleMemoryContextCheckpoint(_args) {
457
+ this.ensureActiveSession();
458
+ // Call the checkpoint endpoint on the server
459
+ await this.client.contextCheckpoint();
460
+ return JSON.stringify({
461
+ success: true,
462
+ message: "Checkpoint completed"
463
+ }, null, 2);
464
+ }
465
+ }
466
+ //# sourceMappingURL=handlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../src/handlers.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C;QAE3B,MAAM,KAAK,GAAoB;YAC3B,IAAI;YACJ,YAAY,EAAE,IAAI,CAAC,YAAkC;YACrD,YAAY,EAAE,IAAI,CAAC,YAAkC;YACrD,cAAc,EAAE,IAAI,CAAC,cAAoC;YACzD,SAAS,EAAE,IAAI,CAAC,SAAiC;YACjD,UAAU,EAAE,IAAI,CAAC,UAAgC;YACjD,YAAY,EAAE,IAAI,CAAC,YAA6D;SACnF,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACnD,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,yBAAyB,CAAC,KAA8B;QAC1D,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAE3B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;QACjD,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,6BAA6B,CAAC,KAA8B;QAC9D,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAE3B,6CAA6C;QAC7C,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QACtC,OAAO,IAAI,CAAC,SAAS,CAAC;YAClB,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,sBAAsB;SAClC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAChB,CAAC;CACJ"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Main exports for @scitrera/memorylayer-mcp-server
3
+ */
4
+ export { MCPServer, createServer } from "./server.js";
5
+ export type { MCPServerOptions } from "./server.js";
6
+ export { MemoryLayerClient } from "./client.js";
7
+ export type { ClientOptions } from "./client.js";
8
+ export { MCPToolHandlers } from "./handlers.js";
9
+ export { TOOLS, SESSION_TOOLS, TOOL_PROFILES, TOOL_NAMES, DEFAULT_PROFILE, getToolsForProfile, isToolEnabled, CORE_TOOLS, EXTENDED_TOOLS, } from "./tools.js";
10
+ export type { ToolProfile, ToolDefinition } from "./tools.js";
11
+ export { SessionManager } from "./session.js";
12
+ export type { SessionState, SessionConfig, WorkingMemoryEntry } from "./session.js";
13
+ export * from "./types.js";
14
+ export { detectWorkspaceId } from "./workspace.js";
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACtD,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EACL,KAAK,EACL,aAAa,EACb,aAAa,EACb,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,aAAa,EAEb,UAAU,EACV,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACpF,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Main exports for @scitrera/memorylayer-mcp-server
3
+ */
4
+ export { MCPServer, createServer } from "./server.js";
5
+ export { MemoryLayerClient } from "./client.js";
6
+ export { MCPToolHandlers } from "./handlers.js";
7
+ export { TOOLS, SESSION_TOOLS, TOOL_PROFILES, TOOL_NAMES, DEFAULT_PROFILE, getToolsForProfile, isToolEnabled,
8
+ // Legacy exports (deprecated)
9
+ CORE_TOOLS, EXTENDED_TOOLS, } from "./tools.js";
10
+ export { SessionManager } from "./session.js";
11
+ export * from "./types.js";
12
+ export { detectWorkspaceId } from "./workspace.js";
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EACL,KAAK,EACL,aAAa,EACb,aAAa,EACb,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,aAAa;AACb,8BAA8B;AAC9B,UAAU,EACV,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * MCP server implementation for MemoryLayer.ai
3
+ */
4
+ import { MemoryLayerClient } from "./client.js";
5
+ import { ToolProfile } from "./tools.js";
6
+ export interface MCPServerOptions {
7
+ workspaceId?: string;
8
+ /**
9
+ * Tool profile to use. Determines which tools are exposed.
10
+ *
11
+ * - "cc" (default): Claude Code profile - 9 essential tools for agent memory
12
+ * - "full": All 18 tools enabled - for power users
13
+ * - "minimal": Just remember/recall - absolute minimum
14
+ *
15
+ * Can also be set via MEMORYLAYER_TOOL_PROFILE env var.
16
+ */
17
+ toolProfile?: ToolProfile;
18
+ /** Auto-start session when MCP server connects (default: true).
19
+ * Can be disabled via MEMORYLAYER_AUTO_START_SESSION=false env var. */
20
+ autoStartSession?: boolean;
21
+ /** @deprecated Use toolProfile: "full" instead */
22
+ extendedTools?: boolean;
23
+ /** @deprecated Session mode is always enabled; use toolProfile to control session tools */
24
+ sessionMode?: boolean;
25
+ }
26
+ export declare class MCPServer {
27
+ private server;
28
+ private handlers;
29
+ private sessionManager;
30
+ private toolProfile;
31
+ private autoStartSession;
32
+ constructor(client: MemoryLayerClient, options?: MCPServerOptions);
33
+ private setupHandlers;
34
+ run(): Promise<void>;
35
+ /**
36
+ * Write session handoff file for hook to adopt the MCP-created session
37
+ */
38
+ private writeSessionHandoff;
39
+ getManifest(): Record<string, unknown>;
40
+ }
41
+ export declare function createServer(client: MemoryLayerClient, options?: MCPServerOptions): Promise<MCPServer>;
42
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAoBH,OAAO,EAAC,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAE9C,OAAO,EACH,WAAW,EAId,MAAM,YAAY,CAAC;AA+DpB,MAAM,WAAW,gBAAgB;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B;4EACwE;IACxE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAG3B,kDAAkD;IAClD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,2FAA2F;IAC3F,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,qBAAa,SAAS;IAClB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,gBAAgB,CAAU;gBAG9B,MAAM,EAAE,iBAAiB,EACzB,OAAO,GAAE,gBAAqB;IA+ClC,OAAO,CAAC,aAAa;IAyFf,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAyB1B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IA2B3B,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAazC;AAED,wBAAsB,YAAY,CAC9B,MAAM,EAAE,iBAAiB,EACzB,OAAO,GAAE,gBAAqB,GAC/B,OAAO,CAAC,SAAS,CAAC,CAEpB"}