@memoryrelay/mcp-server 0.2.0 → 0.4.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.
@@ -0,0 +1,264 @@
1
+ # OpenClaw Setup Guide for MemoryRelay MCP Server
2
+
3
+ This guide walks through configuring the MemoryRelay MCP server with OpenClaw, giving your AI agent persistent memory across sessions.
4
+
5
+ ---
6
+
7
+ ## Prerequisites
8
+
9
+ - **Node.js 18+** -- Verify with `node --version`
10
+ - **npm** -- Comes with Node.js
11
+ - **OpenClaw** installed and working
12
+ - **MemoryRelay API key** -- Obtain one from <https://app.memoryrelay.ai> (format: `mem_prod_xxxxx`)
13
+
14
+ ---
15
+
16
+ ## Quick Setup
17
+
18
+ ### 1. Get Your API Key
19
+
20
+ Sign up or log in at <https://app.memoryrelay.ai> and generate an API key. The key will start with `mem_` (e.g., `mem_prod_abc123def456`).
21
+
22
+ ### 2. Configure OpenClaw
23
+
24
+ Edit your OpenClaw configuration file at `~/.openclaw/openclaw.json` and add the `memoryrelay` server:
25
+
26
+ ```json
27
+ {
28
+ "mcpServers": {
29
+ "memoryrelay": {
30
+ "command": "npx",
31
+ "args": ["-y", "@memoryrelay/mcp-server"],
32
+ "env": {
33
+ "MEMORYRELAY_API_KEY": "mem_prod_xxxxx",
34
+ "OPENCLAW_AGENT_NAME": "your-agent-name"
35
+ }
36
+ }
37
+ }
38
+ }
39
+ ```
40
+
41
+ Replace `mem_prod_xxxxx` with your actual API key and `your-agent-name` with a descriptive name for this agent (e.g., `iris`, `friday`, `code-assistant`).
42
+
43
+ ### 3. Restart OpenClaw
44
+
45
+ Restart OpenClaw to load the MCP server. The MemoryRelay tools should now appear in your tool list.
46
+
47
+ ### 4. Verify the Connection
48
+
49
+ Ask your agent to run a health check:
50
+
51
+ > "Check the memory service health."
52
+
53
+ This invokes the `memory_health` tool and confirms connectivity to the MemoryRelay API.
54
+
55
+ ---
56
+
57
+ ## Environment Variables
58
+
59
+ | Variable | Required | Default | Description |
60
+ |---|---|---|---|
61
+ | `MEMORYRELAY_API_KEY` | Yes | -- | Your API key. Must start with `mem_`. |
62
+ | `OPENCLAW_AGENT_NAME` | No | -- | Agent name auto-detected by the MCP server from the OpenClaw environment. |
63
+ | `MEMORYRELAY_AGENT_ID` | No | Auto-detected | Explicit agent identifier. Takes priority over `OPENCLAW_AGENT_NAME`. |
64
+ | `MEMORYRELAY_API_URL` | No | `https://api.memoryrelay.net` | API base URL. Only change this for custom or self-hosted deployments. |
65
+ | `MEMORYRELAY_TIMEOUT` | No | `30000` | Request timeout in milliseconds. |
66
+ | `MEMORYRELAY_LOG_LEVEL` | No | `info` | Logging verbosity. One of: `debug`, `info`, `warn`, `error`. |
67
+
68
+ ### Agent ID Priority
69
+
70
+ The MCP server determines the agent ID using the following priority order:
71
+
72
+ 1. **`MEMORYRELAY_AGENT_ID`** -- Explicit configuration, highest priority.
73
+ 2. **`OPENCLAW_AGENT_NAME`** -- Detected automatically from the OpenClaw environment.
74
+ 3. **Auto-generated** -- Built from your system username and hostname (e.g., `sparc-DESKTOP`). Truncated to 32 characters.
75
+
76
+ For most OpenClaw setups, setting `OPENCLAW_AGENT_NAME` in the config is sufficient. Use `MEMORYRELAY_AGENT_ID` only if you need to override the agent name with a specific UUID or identifier.
77
+
78
+ ---
79
+
80
+ ## Available Tools
81
+
82
+ The MCP server exposes 13 tools:
83
+
84
+ ### Memory Tools
85
+
86
+ | Tool | Description |
87
+ |---|---|
88
+ | `memory_store` | Store a new memory with optional metadata and deduplication. |
89
+ | `memory_search` | Semantic search across memories using natural language queries. |
90
+ | `memory_list` | List recent memories chronologically with pagination. |
91
+ | `memory_get` | Retrieve a specific memory by its UUID. |
92
+ | `memory_update` | Update the content or metadata of an existing memory. |
93
+ | `memory_delete` | Permanently delete a memory by its UUID. |
94
+
95
+ ### Entity Tools
96
+
97
+ | Tool | Description |
98
+ |---|---|
99
+ | `entity_create` | Create a named entity (person, place, organization, project, concept). |
100
+ | `entity_link` | Link an entity to a memory with a relationship label. |
101
+ | `entity_list` | List entities in the knowledge graph with pagination. |
102
+
103
+ ### Agent Tools
104
+
105
+ | Tool | Description |
106
+ |---|---|
107
+ | `agent_list` | List all agents with their memory counts. |
108
+ | `agent_create` | Create a new named agent (memory namespace). |
109
+ | `agent_get` | Get details of a specific agent by ID. |
110
+
111
+ ### Health
112
+
113
+ | Tool | Description |
114
+ |---|---|
115
+ | `memory_health` | Check API connectivity and server health status. |
116
+
117
+ ---
118
+
119
+ ## Configuration Examples
120
+
121
+ ### Minimal Configuration
122
+
123
+ Only the API key is strictly required. The agent ID will be auto-generated from your username and hostname:
124
+
125
+ ```json
126
+ {
127
+ "mcpServers": {
128
+ "memoryrelay": {
129
+ "command": "npx",
130
+ "args": ["-y", "@memoryrelay/mcp-server"],
131
+ "env": {
132
+ "MEMORYRELAY_API_KEY": "mem_prod_xxxxx"
133
+ }
134
+ }
135
+ }
136
+ }
137
+ ```
138
+
139
+ ### Full Configuration
140
+
141
+ All available options specified:
142
+
143
+ ```json
144
+ {
145
+ "mcpServers": {
146
+ "memoryrelay": {
147
+ "command": "npx",
148
+ "args": ["-y", "@memoryrelay/mcp-server"],
149
+ "env": {
150
+ "MEMORYRELAY_API_KEY": "mem_prod_xxxxx",
151
+ "MEMORYRELAY_AGENT_ID": "iris",
152
+ "MEMORYRELAY_API_URL": "https://api.memoryrelay.net",
153
+ "MEMORYRELAY_TIMEOUT": "30000",
154
+ "MEMORYRELAY_LOG_LEVEL": "info"
155
+ }
156
+ }
157
+ }
158
+ }
159
+ ```
160
+
161
+ ### Self-Hosted Deployment
162
+
163
+ If you are running your own MemoryRelay API instance:
164
+
165
+ ```json
166
+ {
167
+ "mcpServers": {
168
+ "memoryrelay": {
169
+ "command": "npx",
170
+ "args": ["-y", "@memoryrelay/mcp-server"],
171
+ "env": {
172
+ "MEMORYRELAY_API_KEY": "mem_dev_xxxxx",
173
+ "MEMORYRELAY_API_URL": "http://localhost:8000",
174
+ "MEMORYRELAY_AGENT_ID": "local-dev",
175
+ "MEMORYRELAY_LOG_LEVEL": "debug"
176
+ }
177
+ }
178
+ }
179
+ }
180
+ ```
181
+
182
+ ---
183
+
184
+ ## Troubleshooting
185
+
186
+ ### "API key must start with mem_"
187
+
188
+ Your API key is missing or has the wrong format. Verify that:
189
+ - The key is set in the `env` block of your OpenClaw config.
190
+ - The key begins with `mem_` (e.g., `mem_prod_abc123`).
191
+ - There are no leading or trailing spaces around the key value.
192
+
193
+ ### "Connection refused" or Timeout Errors
194
+
195
+ The MCP server cannot reach the MemoryRelay API. Check the following:
196
+ - Verify your internet connection.
197
+ - If using a custom `MEMORYRELAY_API_URL`, confirm the URL is correct and the service is running.
198
+ - Try increasing the timeout: set `MEMORYRELAY_TIMEOUT` to `60000` (60 seconds).
199
+ - Check firewall or proxy settings that may block outbound HTTPS traffic.
200
+
201
+ ### "Rate limited" (HTTP 429)
202
+
203
+ You are sending too many requests. The server handles rate limiting automatically with exponential backoff, but if you see persistent errors:
204
+ - Reduce the frequency of tool calls.
205
+ - Batch operations where possible (e.g., store multiple related facts in a single memory).
206
+ - Wait for the retry period indicated in the error message.
207
+
208
+ ### Agent ID Not Detected
209
+
210
+ If memories are not being attributed to the correct agent:
211
+ - Set `OPENCLAW_AGENT_NAME` explicitly in your config `env` block.
212
+ - Alternatively, set `MEMORYRELAY_AGENT_ID` for full control over the agent identifier.
213
+ - Run `agent_list` to see which agents exist and verify the correct one is being used.
214
+
215
+ ### Tools Not Showing Up in OpenClaw
216
+
217
+ If the MemoryRelay tools do not appear after configuration:
218
+ - Restart OpenClaw completely.
219
+ - Verify that `~/.openclaw/openclaw.json` contains valid JSON (no trailing commas, proper quoting).
220
+ - Check that the `command` field is set to `npx` and `args` includes `"-y"` and `"@memoryrelay/mcp-server"`.
221
+ - Ensure Node.js 18+ is installed and accessible from your PATH.
222
+
223
+ ### Authentication Errors (HTTP 401)
224
+
225
+ Your API key is not being accepted:
226
+ - Confirm the key is active and has not expired at <https://app.memoryrelay.ai>.
227
+ - Check for extra whitespace in the environment variable value.
228
+ - Regenerate the key if the issue persists.
229
+
230
+ ### Enabling Debug Logging
231
+
232
+ To see detailed request/response information, set the log level to `debug`:
233
+
234
+ ```json
235
+ {
236
+ "mcpServers": {
237
+ "memoryrelay": {
238
+ "command": "npx",
239
+ "args": ["-y", "@memoryrelay/mcp-server"],
240
+ "env": {
241
+ "MEMORYRELAY_API_KEY": "mem_prod_xxxxx",
242
+ "MEMORYRELAY_LOG_LEVEL": "debug"
243
+ }
244
+ }
245
+ }
246
+ }
247
+ ```
248
+
249
+ Debug logs are written to stderr and include:
250
+ - API request and response details (with API keys masked).
251
+ - Tool invocation parameters.
252
+ - Validation errors.
253
+ - Connection status and retry attempts.
254
+
255
+ ---
256
+
257
+ ## Further Resources
258
+
259
+ - [MemoryRelay MCP Server README](../README.md)
260
+ - [Security Documentation](./SECURITY.md)
261
+ - [GitHub Repository](https://github.com/memoryrelay/mcp-server)
262
+ - [Report Issues](https://github.com/memoryrelay/mcp-server/issues)
263
+ - [MemoryRelay Dashboard](https://app.memoryrelay.ai)
264
+ - [MCP Protocol Specification](https://modelcontextprotocol.io)
package/docs/SECURITY.md CHANGED
@@ -368,7 +368,7 @@ If you discover a security vulnerability:
368
368
  Monitor for security updates:
369
369
 
370
370
  - **GitHub Releases**: https://github.com/memoryrelay/mcp-server/releases
371
- - **npm Security Advisories**: `npm audit` in the project directory
371
+ - **npm Security Advisories**: `npm audit` in the `mcp/` directory
372
372
  - **Dependencies**: Regularly run `npm update` and `npm audit fix`
373
373
 
374
374
  ### Known Limitations
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "@memoryrelay/mcp-server",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "MCP server for MemoryRelay - persistent memory for AI agents",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "type": "module",
8
8
  "bin": {
9
- "memoryrelay-mcp-server": "dist/index.js",
10
- "mcp-server": "dist/index.js"
9
+ "memoryrelay-mcp": "dist/index.js"
11
10
  },
12
11
  "files": [
13
12
  "dist",
@@ -25,7 +24,8 @@
25
24
  "test:all": "npm test && npm run test:integration",
26
25
  "test:coverage": "vitest run --coverage",
27
26
  "type-check": "tsc --noEmit",
28
- "lint": "echo 'Lint not configured yet'",
27
+ "lint": "eslint src/",
28
+ "lint:fix": "eslint src/ --fix",
29
29
  "prepublishOnly": "npm run build"
30
30
  },
31
31
  "keywords": [
@@ -59,9 +59,12 @@
59
59
  "zod": "^3.25.0"
60
60
  },
61
61
  "devDependencies": {
62
+ "@eslint/js": "^10.0.1",
62
63
  "@types/node": "^22.0.0",
64
+ "eslint": "^10.0.2",
63
65
  "tsup": "^8.0.0",
64
66
  "typescript": "^5.4.0",
67
+ "typescript-eslint": "^8.56.1",
65
68
  "vitest": "^3.0.0"
66
69
  },
67
70
  "engines": {