@memoryrelay/mcp-server 0.2.0 → 0.3.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/README.md CHANGED
@@ -10,12 +10,10 @@
10
10
 
11
11
  - **Persistent Memory**: Store and retrieve memories across conversations
12
12
  - **Semantic Search**: Find relevant memories using natural language queries
13
- - **Entity Management**: Create and link entities (people, projects, concepts) for knowledge graphs
14
- - **MCP Resources**: Expose memories as readable resources for richer context injection
15
- - **MCP Prompts**: Built-in prompt templates for common memory workflows
13
+ - **Batch Operations**: Create multiple memories in a single request for optimal performance
16
14
  - **Security Hardened**: API key masking, input validation, sanitized errors
17
15
  - **MCP Compliant**: Works with Claude Desktop, OpenClaw, and any MCP client
18
- - **Fully Tested**: 102+ test cases covering all functionality
16
+ - **Fully Tested**: 169 test cases covering all functionality
19
17
 
20
18
  ---
21
19
 
@@ -53,6 +51,8 @@ Sign up at [memoryrelay.ai](https://memoryrelay.ai) to get your API key (format:
53
51
 
54
52
  #### For OpenClaw
55
53
 
54
+ > See [docs/OPENCLAW_GUIDE.md](docs/OPENCLAW_GUIDE.md) for a comprehensive setup guide.
55
+
56
56
  Edit `~/.openclaw/openclaw.json`:
57
57
 
58
58
  ```json
@@ -140,6 +140,26 @@ Try asking:
140
140
  | `MEMORYRELAY_AGENT_ID` | No | Auto-detected | Agent identifier (auto-generated if not set) |
141
141
  | `MEMORYRELAY_TIMEOUT` | No | `30000` | Request timeout in milliseconds |
142
142
  | `MEMORYRELAY_LOG_LEVEL` | No | `info` | Logging level (`debug`, `info`, `warn`, `error`) |
143
+ | `MEMORYRELAY_TOOLS` | No | `all` | Comma-separated tool groups to enable (see below) |
144
+
145
+ ### Tool Groups
146
+
147
+ Control which tools are exposed via the `MEMORYRELAY_TOOLS` environment variable:
148
+
149
+ | Group | Tools | Description |
150
+ |-------|-------|-------------|
151
+ | `core` | 16 tools | Memory CRUD, entities, agents, health |
152
+ | `sessions` | 4 tools | Session lifecycle (start, end, recall, list) |
153
+ | `decisions` | 4 tools | Decision recording and checking |
154
+ | `patterns` | 4 tools | Pattern library (create, search, adopt, suggest) |
155
+ | `projects` | 3 tools | Project registration and listing |
156
+ | `relationships` | 6 tools | Project graph (add, deps, dependents, related, impact, shared patterns) |
157
+ | `context` | 2 tools | Project context, memory promotion |
158
+
159
+ Examples:
160
+ - `MEMORYRELAY_TOOLS=all` (default) — all tools enabled
161
+ - `MEMORYRELAY_TOOLS=core,sessions` — only core + session tools
162
+ - `MEMORYRELAY_TOOLS=core,relationships,context` — core + graph tools
143
163
 
144
164
  ### Agent ID Detection
145
165
 
@@ -152,7 +172,7 @@ The server automatically detects your agent ID from:
152
172
 
153
173
  ## 🛠️ Available Tools
154
174
 
155
- The MCP server provides 9 tools for memory and entity management:
175
+ The MCP server provides 39 tools organized into groups:
156
176
 
157
177
  ### Memory Management Tools
158
178
 
@@ -160,9 +180,11 @@ The MCP server provides 9 tools for memory and entity management:
160
180
 
161
181
  Store a new memory with optional metadata.
162
182
 
183
+ > **Note**: The `agent_id` parameter is automatically injected from `MEMORYRELAY_AGENT_ID` environment variable. You don't need to include it in your request.
184
+
163
185
  **Parameters:**
164
- - `content` (string, required) - The memory content to store
165
- - `metadata` (object, optional) - Key-value metadata to attach
186
+ - `content` (string, required) - The memory content to store (1-50,000 characters)
187
+ - `metadata` (object, optional) - Key-value metadata to attach (max 10KB when serialized)
166
188
 
167
189
  **Example:**
168
190
  ```json
@@ -175,7 +197,9 @@ Store a new memory with optional metadata.
175
197
  }
176
198
  ```
177
199
 
178
- **Returns:** Memory object with `id`, `content`, `metadata`, `created_at`, `updated_at`
200
+ **Returns:** Memory object with `id`, `content`, `agent_id`, `metadata`, `created_at`, `updated_at`
201
+
202
+ **Rate Limit**: 30 requests per minute
179
203
 
180
204
  ---
181
205
 
@@ -243,10 +267,12 @@ Retrieve a specific memory by ID.
243
267
 
244
268
  Update an existing memory's content or metadata.
245
269
 
270
+ > **Note**: Metadata updates are **merged** with existing metadata, not replaced. To remove a key, explicitly set it to `null`.
271
+
246
272
  **Parameters:**
247
273
  - `id` (string, required) - Memory UUID
248
- - `content` (string, required) - New content
249
- - `metadata` (object, optional) - Updated metadata (replaces existing)
274
+ - `content` (string, required) - New content (1-50,000 characters)
275
+ - `metadata` (object, optional) - Updated metadata (merged with existing, max 10KB)
250
276
 
251
277
  **Example:**
252
278
  ```json
@@ -282,55 +308,6 @@ Permanently delete a memory.
282
308
 
283
309
  ---
284
310
 
285
- ### Entity Management Tools
286
-
287
- #### `entity_create`
288
-
289
- Create a named entity for the knowledge graph.
290
-
291
- **Parameters:**
292
- - `name` (string, required) - Entity name (1-200 characters)
293
- - `type` (enum, required) - One of: `person`, `place`, `organization`, `project`, `concept`, `other`
294
- - `metadata` (object, optional) - Key-value metadata
295
-
296
- **Example:**
297
- ```json
298
- {
299
- "name": "MemoryRelay Project",
300
- "type": "project",
301
- "metadata": {
302
- "status": "active",
303
- "started": "2026-01"
304
- }
305
- }
306
- ```
307
-
308
- **Returns:** Entity object with `id`, `name`, `type`, `metadata`, `created_at`
309
-
310
- ---
311
-
312
- #### `entity_link`
313
-
314
- Link an entity to a memory to establish relationships.
315
-
316
- **Parameters:**
317
- - `entity_id` (string, required) - Entity UUID
318
- - `memory_id` (string, required) - Memory UUID
319
- - `relationship` (string, optional, default: "mentioned_in") - Relationship type
320
-
321
- **Example:**
322
- ```json
323
- {
324
- "entity_id": "650e8400-e29b-41d4-a716-446655440001",
325
- "memory_id": "550e8400-e29b-41d4-a716-446655440000",
326
- "relationship": "relates_to"
327
- }
328
- ```
329
-
330
- **Returns:** Success confirmation with link details
331
-
332
- ---
333
-
334
311
  ### Health Check Tool
335
312
 
336
313
  #### `memory_health`
@@ -348,53 +325,6 @@ Check API connectivity and server health.
348
325
 
349
326
  ---
350
327
 
351
- ## 📚 Resources
352
-
353
- The server exposes memories as MCP resources, allowing clients to read memory data directly.
354
-
355
- ### Static Resources
356
-
357
- #### `memory:///recent`
358
-
359
- Returns the 20 most recent memories as a JSON resource.
360
-
361
- ### Resource Templates
362
-
363
- #### `memory:///{id}`
364
-
365
- Retrieve a specific memory by its UUID. Replace `{id}` with a valid memory UUID.
366
-
367
- **Example URI:** `memory:///550e8400-e29b-41d4-a716-446655440000`
368
-
369
- ---
370
-
371
- ## 💬 Prompts
372
-
373
- The server provides prompt templates that guide the AI through common memory workflows.
374
-
375
- ### `store_memory`
376
-
377
- Store information as a persistent memory with appropriate metadata.
378
-
379
- **Arguments:**
380
- - `information` (string, required) - The information to remember
381
- - `category` (string, optional) - Category tag (e.g., preference, fact, instruction)
382
-
383
- ### `recall_memories`
384
-
385
- Search for and recall relevant memories about a topic.
386
-
387
- **Arguments:**
388
- - `topic` (string, required) - The topic or question to search memories for
389
-
390
- ### `summarize_memories`
391
-
392
- List and summarize all recent memories for context.
393
-
394
- **Arguments:** None
395
-
396
- ---
397
-
398
328
  ## 🔒 Security
399
329
 
400
330
  This MCP server is designed with security best practices:
@@ -407,8 +337,8 @@ This MCP server is designed with security best practices:
407
337
  ### Input Validation
408
338
  - All inputs validated using Zod schemas before processing
409
339
  - UUIDs validated for format correctness
410
- - Entity names sanitized to prevent XSS attacks
411
- - String lengths enforced (e.g., entity names max 200 characters)
340
+ - String lengths enforced (content max 50,000 characters, metadata max 10KB)
341
+ - Memory IDs must be valid UUIDs
412
342
 
413
343
  ### Error Handling
414
344
  - Errors sanitized to prevent information leakage
@@ -474,24 +404,31 @@ npm run type-check
474
404
  ```
475
405
  mcp-server/
476
406
  ├── src/
477
- │ ├── index.ts # Entry point
478
- │ ├── server.ts # MCP server implementation
407
+ │ ├── index.ts # Entry point with CLI routing
408
+ │ ├── server.ts # MCP server implementation (39 tools)
479
409
  │ ├── client.ts # MemoryRelay API client
480
- │ ├── config.ts # Configuration loader
481
- │ ├── logger.ts # Logging utilities
482
- └── types.ts # TypeScript types
410
+ │ ├── config.ts # Configuration loader + tool groups
411
+ │ ├── logger.ts # Security-hardened logging
412
+ ├── types.ts # TypeScript types
413
+ │ └── cli/
414
+ │ ├── setup.ts # Interactive setup wizard
415
+ │ └── test.ts # Connection test command
483
416
  ├── tests/
484
417
  │ ├── server.test.ts # Server tests
485
418
  │ ├── client.test.ts # Client tests
486
419
  │ ├── config.test.ts # Config tests
487
420
  │ ├── security.test.ts # Security tests
421
+ │ ├── entity.test.ts # Entity tests
422
+ │ ├── e2e-protocol.test.ts # MCP protocol e2e tests
488
423
  │ └── integration.test.ts # Integration tests
489
424
  ├── docs/
490
- └── SECURITY.md # Security documentation
425
+ ├── SECURITY.md # Security documentation
426
+ │ └── OPENCLAW_GUIDE.md # OpenClaw setup guide
491
427
  ├── package.json
492
428
  ├── tsconfig.json
493
429
  ├── tsup.config.ts
494
430
  ├── vitest.config.ts
431
+ ├── eslint.config.js
495
432
  ├── CHANGELOG.md
496
433
  ├── LICENSE
497
434
  └── README.md
@@ -540,7 +477,7 @@ mcp-server/
540
477
 
541
478
  ### Windows: `npx` Fails with Scoped Package
542
479
 
543
- **Problem:** `'memoryrelay-mcp-server' is not recognized` when using `npx` on Windows
480
+ **Problem:** `'memoryrelay-mcp' is not recognized` when using `npx` on Windows
544
481
 
545
482
  **Solutions:**
546
483
  1. Install globally instead of using `npx`:
@@ -614,7 +551,7 @@ Debug logs go to stderr and include:
614
551
 
615
552
  The project has comprehensive test coverage:
616
553
 
617
- - **102+ test cases** covering all functionality
554
+ - **169 test cases** covering all functionality
618
555
  - Unit tests for each component
619
556
  - Integration tests against live API
620
557
  - Security-focused tests for API key masking and input validation
@@ -664,28 +601,19 @@ Contributions welcome! Please open an issue or pull request on [GitHub](https://
664
601
 
665
602
  ## 📝 Changelog
666
603
 
667
- ### v0.2.0 (2026-02-15)
668
-
669
- - **CRITICAL FIX**: All memory API endpoints now use correct paths (store, search, list, get, update, delete all work)
670
- - Fix health check endpoint path
671
- - Config examples now use `MemoryRelay` display name for Claude Desktop
672
-
673
- ### v0.1.9 (2026-02-15)
674
-
675
- - Add Windows-specific Claude Desktop setup instructions (global install + `node` command)
676
- - Add Windows `npx` scoped package troubleshooting guide
677
- - Fix project structure diagram, broken links, and missing files in README
678
-
679
- ### v0.1.8 (2026-02-15)
604
+ ### v0.2.0 (2026-03-04)
680
605
 
681
- - Add MCP resources: `memory:///recent` and `memory:///{id}` for direct memory access
682
- - Add MCP prompts: `store_memory`, `recall_memories`, `summarize_memories` templates
683
- - Fix `npx @memoryrelay/mcp-server` execution for scoped packages
684
- - Fix server version reporting (was hardcoded as 0.1.0)
685
- - Implement `OPENCLAW_AGENT_NAME` environment variable support
686
- - Fix error help URL to point to current repository
687
- - Fix GitHub Release install commands to use scoped package name
688
- - Fix TypeScript strict mode errors
606
+ - **39 tools** across 7 configurable tool groups (up from 9)
607
+ - **Session tools**: `session_start`, `session_end`, `session_recall`, `session_list` — track development sessions with automatic memory linking
608
+ - **Decision tools**: `decision_record`, `decision_list`, `decision_supersede`, `decision_check` log architectural decisions with semantic search
609
+ - **Pattern tools**: `pattern_create`, `pattern_search`, `pattern_adopt`, `pattern_suggest` share and reuse conventions across projects
610
+ - **Project tools**: `project_register`, `project_list`, `project_info`, `project_context` — manage project namespaces and load full context
611
+ - **Relationship tools**: `project_add_relationship`, `project_dependencies`, `project_dependents`, `project_related`, `project_impact`, `project_shared_patterns` — map project dependencies and analyze impact
612
+ - **Context tools**: `memory_promote` manage memory importance tiers (hot/warm/cold)
613
+ - **Tool group configuration**: `MEMORYRELAY_TOOLS` env var to selectively enable tool groups
614
+ - **Session-aware descriptions**: Tool descriptions dynamically show active session context
615
+ - **Server instructions**: Recommended workflow guidance via MCP protocol instructions field
616
+ - 169 test cases with full coverage
689
617
 
690
618
  ### v0.1.0 (2026-02-12)
691
619
 
@@ -694,7 +622,7 @@ Contributions welcome! Please open an issue or pull request on [GitHub](https://
694
622
  - Semantic search with configurable thresholds
695
623
  - Entity linking for knowledge graphs
696
624
  - Security hardened with API key masking and input validation
697
- - 102+ test cases with full coverage
625
+ - 102 test cases with full coverage
698
626
  - Support for OpenClaw and Claude Desktop
699
627
 
700
628
  ---