@scitrera/memorylayer-mcp-server 0.0.3 → 0.0.4

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
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  TypeScript MCP (Model Context Protocol) server for [MemoryLayer.ai](https://memorylayer.ai).
4
4
 
5
- Provides 16 memory tools for LLM agents to store, recall, synthesize, and manage information across sessions.
5
+ Provides 21 memory tools for LLM agents to store, recall, synthesize, and manage information across sessions.
6
6
 
7
7
  ## Installation
8
8
 
@@ -25,8 +25,6 @@ npx memorylayer-mcp
25
25
 
26
26
  ### Claude Code Configuration (Recommended)
27
27
 
28
- > **Detailed setup guide:** See [CLAUDE_CODE_SETUP.md](../docs/CLAUDE_CODE_SETUP.md) for step-by-step instructions.
29
-
30
28
  Claude Code runs MCP servers from the project directory, so our server auto-detects the workspace from your git repo or folder name. Add `.mcp.json` to your project root:
31
29
 
32
30
  ```json
@@ -121,7 +119,7 @@ Store a new memory for later recall.
121
119
  type: "semantic", // episodic, semantic, procedural, working
122
120
  importance: 0.8, // 0.0 - 1.0
123
121
  tags: ["preference", "typescript"],
124
- subtype: "Preference" // Optional domain classification
122
+ subtype: "preference" // Optional domain classification
125
123
  }
126
124
  ```
127
125
 
@@ -144,9 +142,9 @@ Synthesize insights across multiple memories.
144
142
  ```typescript
145
143
  {
146
144
  query: "What patterns have we seen with database performance?",
147
- max_tokens: 500,
145
+ detail_level: "overview", // "abstract", "overview", or "full"
148
146
  include_sources: true,
149
- depth: 2 // Association traversal depth
147
+ depth: 2 // Association traversal depth
150
148
  }
151
149
  ```
152
150
 
@@ -217,7 +215,7 @@ Find contradictions and inconsistencies.
217
215
  }
218
216
  ```
219
217
 
220
- ### Session Management Tools (3)
218
+ ### Session Management Tools (4)
221
219
 
222
220
  These tools enable working memory that persists across tool calls within a session.
223
221
 
@@ -240,13 +238,116 @@ End the current session and optionally commit working memory.
240
238
  }
241
239
  ```
242
240
 
243
- #### 12. `memory_session_status`
241
+ #### 12. `memory_session_commit`
242
+ Checkpoint working memory mid-session without ending it.
243
+
244
+ ```typescript
245
+ {
246
+ importance_threshold: 0.5, // Min importance for extracted memories
247
+ clear_after_commit: false // Clear working memory after commit
248
+ }
249
+ ```
250
+
251
+ #### 13. `memory_session_status`
244
252
  Get current session status including working memory summary.
245
253
 
246
254
  ```typescript
247
255
  {} // No parameters required
248
256
  ```
249
257
 
258
+ ### Context Environment Tools (8)
259
+
260
+ Server-side Python sandbox for code execution, memory analysis, and LLM-powered queries over loaded data.
261
+
262
+ #### 14. `memory_context_exec`
263
+ Execute Python code in the server-side sandbox. Variables persist between calls.
264
+
265
+ ```typescript
266
+ {
267
+ code: "import pandas as pd\ndf = pd.DataFrame(memories)",
268
+ result_var: "df", // Optional: store result in variable
269
+ return_result: true, // Return output to caller
270
+ max_return_chars: 10000 // Truncate large outputs
271
+ }
272
+ ```
273
+
274
+ #### 15. `memory_context_inspect`
275
+ Inspect sandbox variables (overview or detailed view of specific variable).
276
+
277
+ ```typescript
278
+ {
279
+ variable: "df", // Optional: specific variable to inspect
280
+ preview_chars: 200 // Characters in value previews
281
+ }
282
+ ```
283
+
284
+ #### 16. `memory_context_load`
285
+ Load memories into sandbox via semantic search.
286
+
287
+ ```typescript
288
+ {
289
+ var: "relevant_memories",
290
+ query: "authentication bugs",
291
+ limit: 50,
292
+ types: ["semantic", "episodic"],
293
+ tags: ["bug-fix"],
294
+ min_relevance: 0.6,
295
+ include_embeddings: false
296
+ }
297
+ ```
298
+
299
+ #### 17. `memory_context_inject`
300
+ Inject data directly into sandbox as a variable.
301
+
302
+ ```typescript
303
+ {
304
+ key: "config",
305
+ value: '{"api_url": "https://api.example.com"}',
306
+ parse_json: true // Parse as JSON before storing
307
+ }
308
+ ```
309
+
310
+ #### 18. `memory_context_query`
311
+ Ask server-side LLM a question using sandbox variables as context.
312
+
313
+ ```typescript
314
+ {
315
+ prompt: "Summarize the key patterns in these memories",
316
+ variables: ["relevant_memories", "df"],
317
+ max_context_chars: 50000, // Optional limit
318
+ result_var: "summary" // Optional: store response
319
+ }
320
+ ```
321
+
322
+ #### 19. `memory_context_rlm`
323
+ Run Recursive Language Model loop for iterative reasoning.
324
+
325
+ ```typescript
326
+ {
327
+ goal: "Identify root causes of authentication failures",
328
+ memory_query: "authentication errors", // Optional: pre-load memories
329
+ memory_limit: 100,
330
+ max_iterations: 10,
331
+ variables: ["error_logs"],
332
+ result_var: "analysis",
333
+ detail_level: "detailed" // "brief", "standard", or "detailed"
334
+ }
335
+ ```
336
+
337
+ #### 20. `memory_context_status`
338
+ Get sandbox environment status and resource usage.
339
+
340
+ ```typescript
341
+ {} // No parameters required
342
+ ```
343
+
344
+ #### 21. `memory_context_checkpoint`
345
+ Checkpoint sandbox state for persistence (enterprise deployments).
346
+
347
+ ```typescript
348
+ {} // No parameters required
349
+ ```
350
+
250
351
  ## Environment Variables
251
352
 
252
353
  | Variable | Description | Default |
@@ -255,6 +356,9 @@ Get current session status including working memory summary.
255
356
  | `MEMORYLAYER_API_KEY` | API key for authentication | (none) |
256
357
  | `MEMORYLAYER_WORKSPACE_ID` | Workspace ID (overrides auto-detection) | (auto-detected) |
257
358
  | `MEMORYLAYER_AUTO_WORKSPACE` | Set to `false` to disable auto-detection | `true` |
359
+ | `MEMORYLAYER_TOOL_PROFILE` | Tool profile: `cc`, `full`, or `minimal` | `cc` |
360
+ | `MEMORYLAYER_AUTO_START_SESSION` | Auto-start session on MCP connection | `true` |
361
+ | `MEMORYLAYER_SESSION_MODE` | Enable session mode | `true` |
258
362
 
259
363
  ## Memory Types
260
364
 
@@ -287,9 +391,10 @@ The MCP server wraps the `@scitrera/memorylayer-sdk` TypeScript SDK, providing a
287
391
  memorylayer-mcp-typescript/
288
392
  ├── src/
289
393
  │ ├── types.ts # TypeScript types for MCP tools
290
- │ ├── tools.ts # MCP tool definitions (12 tools)
394
+ │ ├── tools.ts # MCP tool definitions (21 tools)
291
395
  │ ├── client.ts # Wrapper around @scitrera/memorylayer-sdk
292
396
  │ ├── session.ts # Local session state management
397
+ │ ├── workspace.ts # Workspace ID auto-detection
293
398
  │ ├── handlers.ts # Tool handler implementations
294
399
  │ ├── server.ts # MCP server using @modelcontextprotocol/sdk
295
400
  │ └── index.ts # Main exports
@@ -340,7 +445,7 @@ const memory = await client.remember("Important fact", {
340
445
 
341
446
  ## License
342
447
 
343
- Apache 2.0 License - see LICENSE file for details.
448
+ Apache 2.0 License -- see [LICENSE](../LICENSE) for details.
344
449
 
345
450
  ## Links
346
451
 
@@ -12,6 +12,9 @@
12
12
  * MEMORYLAYER_AUTO_WORKSPACE - Set to "false" to disable auto-detection
13
13
  * MEMORYLAYER_SESSION_MODE - Set to "false" to disable session/working memory (default: true)
14
14
  */
15
+ import { existsSync, unlinkSync } from "fs";
16
+ import { join } from "path";
17
+ import { tmpdir } from "os";
15
18
  import { MemoryLayerClient } from "../src/client.js";
16
19
  import { createServer } from "../src/server.js";
17
20
  import { detectWorkspaceId } from "../src/workspace.js";
@@ -48,13 +51,29 @@ async function main() {
48
51
  console.error("MemoryLayer MCP Server Manifest:", JSON.stringify(server.getManifest(), null, 2));
49
52
  await server.run();
50
53
  }
54
+ /**
55
+ * Clean up session handoff file on shutdown
56
+ */
57
+ function cleanupHandoff() {
58
+ try {
59
+ const handoffFile = join(tmpdir(), "memorylayer", `session-${process.ppid}.json`);
60
+ if (existsSync(handoffFile)) {
61
+ unlinkSync(handoffFile);
62
+ }
63
+ }
64
+ catch {
65
+ // Ignore cleanup errors
66
+ }
67
+ }
51
68
  // Handle errors and signals
52
69
  process.on("SIGINT", () => {
53
70
  console.error("Received SIGINT, shutting down gracefully");
71
+ cleanupHandoff();
54
72
  process.exit(0);
55
73
  });
56
74
  process.on("SIGTERM", () => {
57
75
  console.error("Received SIGTERM, shutting down gracefully");
76
+ cleanupHandoff();
58
77
  process.exit(0);
59
78
  });
60
79
  process.on("uncaughtException", (error) => {
@@ -1 +1 @@
1
- {"version":3,"file":"memorylayer-mcp.js","sourceRoot":"","sources":["../../bin/memorylayer-mcp.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,iBAAiB,EAAE,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AE,CAAC,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE;IACxC,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC;IAC5C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,MAAM,EAAE,EAAE;IAC1C,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC;IAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,153 @@
1
+ /**
2
+ * MCP-compatible adapter for the MemoryLayer SDK
3
+ *
4
+ * This module provides a thin compatibility layer between the MCP server's expectations
5
+ * and the SDK's API surface. All operations are delegated to the SDK client.
6
+ */
7
+ import type { Memory, RecallResult, Association, Session } from "@scitrera/memorylayer-sdk";
8
+ import type { RememberInput, RecallInput, ReflectInput, AssociateInput, GraphQueryInput, GraphQueryResult, ToolResponse, ReflectResult, ContextExecInput, ContextInspectInput, ContextLoadInput, ContextInjectInput, ContextQueryInput, ContextRlmInput } from "./types.js";
9
+ export interface ClientOptions {
10
+ baseUrl?: string;
11
+ apiKey?: string;
12
+ workspaceId?: string;
13
+ timeout?: number;
14
+ }
15
+ /**
16
+ * MCP-compatible client that wraps the SDK client
17
+ */
18
+ export declare class MemoryLayerClient {
19
+ private sdk;
20
+ private workspaceId;
21
+ private baseUrl;
22
+ private apiKey?;
23
+ private timeout;
24
+ constructor(options?: ClientOptions);
25
+ remember(input: RememberInput): Promise<Memory>;
26
+ recall(input: RecallInput): Promise<RecallResult>;
27
+ reflect(input: ReflectInput): Promise<ReflectResult>;
28
+ forget(memoryId: string, hard?: boolean, reason?: string): Promise<ToolResponse>;
29
+ associate(input: AssociateInput): Promise<Association>;
30
+ getMemory(memoryId: string): Promise<Memory>;
31
+ getBriefing(options?: {
32
+ timeWindowMinutes?: number;
33
+ detailLevel?: string;
34
+ limit?: number;
35
+ includeMemories?: boolean;
36
+ includeContradictions?: boolean;
37
+ }): Promise<ToolResponse>;
38
+ getStatistics(includeBreakdown?: boolean): Promise<{
39
+ success: boolean;
40
+ total_memories: number;
41
+ total_associations: number;
42
+ breakdown?: {
43
+ by_type: Record<string, number>;
44
+ by_subtype: Record<string, number>;
45
+ };
46
+ }>;
47
+ graphQuery(input: GraphQueryInput): Promise<GraphQueryResult>;
48
+ auditMemories(_memoryId?: string, _autoResolve?: boolean): Promise<ToolResponse>;
49
+ /**
50
+ * Get the workspace ID this client is configured for.
51
+ */
52
+ getWorkspaceId(): string;
53
+ /**
54
+ * Get the current session ID from the SDK client.
55
+ */
56
+ getSessionId(): string | undefined;
57
+ /**
58
+ * Set the active session ID on the SDK client.
59
+ * This will include the X-Session-ID header in subsequent requests.
60
+ */
61
+ setSessionId(sessionId: string): void;
62
+ /**
63
+ * Clear the active session ID from the SDK client.
64
+ */
65
+ clearSessionId(): void;
66
+ /**
67
+ * Start a server-side session for working memory tracking.
68
+ *
69
+ * The workspace is auto-created if it doesn't exist (OSS "just works" pattern).
70
+ * The SDK's createSession automatically sets the session ID for subsequent requests.
71
+ */
72
+ startSession(options?: {
73
+ ttl_seconds?: number;
74
+ context_id?: string;
75
+ metadata?: Record<string, unknown>;
76
+ }): Promise<{
77
+ session_id: string;
78
+ session: Session;
79
+ }>;
80
+ /**
81
+ * End a server-side session, optionally committing working memory.
82
+ */
83
+ endSession(sessionId: string, options?: {
84
+ commit?: boolean;
85
+ importance_threshold?: number;
86
+ working_memory?: Array<{
87
+ key: string;
88
+ value: unknown;
89
+ category?: string;
90
+ }>;
91
+ }): Promise<{
92
+ memories_extracted?: number;
93
+ memories_created?: number;
94
+ }>;
95
+ /**
96
+ * Commit working memory to long-term storage WITHOUT ending the session.
97
+ * Use this for checkpoints during long sessions.
98
+ */
99
+ commitSession(sessionId: string, options?: {
100
+ importance_threshold?: number;
101
+ clear_after_commit?: boolean;
102
+ }): Promise<{
103
+ memories_extracted: number;
104
+ memories_created: number;
105
+ }>;
106
+ /**
107
+ * Set working memory on the server-side session.
108
+ */
109
+ setWorkingMemory(sessionId: string, key: string, value: unknown): Promise<void>;
110
+ /**
111
+ * Get working memory from the server-side session.
112
+ */
113
+ getWorkingMemory(sessionId: string, key?: string): Promise<Record<string, unknown>>;
114
+ /**
115
+ * Touch session to extend its TTL.
116
+ */
117
+ touchSession(sessionId: string): Promise<{
118
+ expires_at: string;
119
+ }>;
120
+ /**
121
+ * Execute Python code in the server-side sandbox.
122
+ */
123
+ contextExec(input: ContextExecInput): Promise<Record<string, unknown>>;
124
+ /**
125
+ * Inspect variables in the server-side sandbox.
126
+ */
127
+ contextInspect(input: ContextInspectInput): Promise<Record<string, unknown>>;
128
+ /**
129
+ * Load memories into a sandbox variable via semantic search.
130
+ */
131
+ contextLoad(input: ContextLoadInput): Promise<Record<string, unknown>>;
132
+ /**
133
+ * Inject a value directly into the sandbox as a named variable.
134
+ */
135
+ contextInject(input: ContextInjectInput): Promise<Record<string, unknown>>;
136
+ /**
137
+ * Query the server-side LLM using sandbox variables as context.
138
+ */
139
+ contextQuery(input: ContextQueryInput): Promise<Record<string, unknown>>;
140
+ /**
141
+ * Run a Recursive Language Model (RLM) loop on the server.
142
+ */
143
+ contextRlm(input: ContextRlmInput): Promise<Record<string, unknown>>;
144
+ /**
145
+ * Get context environment status.
146
+ */
147
+ contextStatus(): Promise<Record<string, unknown>>;
148
+ /**
149
+ * Checkpoint the sandbox state for persistence.
150
+ */
151
+ contextCheckpoint(): Promise<void>;
152
+ }
153
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {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