@whenmoon-afk/memory-mcp 2.2.2 → 2.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
@@ -1,512 +1,108 @@
1
- # claude-memory-mcp
1
+ # Memory MCP
2
2
 
3
3
  [![npm version](https://badge.fury.io/js/@whenmoon-afk%2Fmemory-mcp.svg)](https://www.npmjs.com/package/@whenmoon-afk/memory-mcp)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
- [![Node.js >= 18](https://img.shields.io/badge/node-%3E%3D18-brightgreen)](https://nodejs.org/)
6
5
 
7
- **Local, Persistent Memory for Any MCP-Compatible AI**
8
- A lightweight, **zero-cloud**, **token-efficient** Model Context Protocol (MCP) server that gives your AI **durable, searchable, and context-aware memory** - entirely under your control.
6
+ Local, persistent memory for Claude Desktop and MCP-compatible AI assistants.
9
7
 
10
- Built with **TypeScript**, **SQLite + FTS5**, and **minimal runtime dependencies** (MCP SDK + better-sqlite3), it runs locally and stores everything in a single, portable `.db` file.
11
-
12
- Works with **Claude Desktop**, **Cursor**, **Windsurf**, or any MCP client.
13
-
14
- 📦 **Now available on npm**: Install with `npx @whenmoon-afk/memory-mcp`
15
-
16
- ---
17
-
18
- ## Why Local Memory?
19
-
20
- | You Control | Cloud Services |
21
- |-----------|----------------|
22
- | Data never leaves your machine | Sent to remote servers |
23
- | Portable `.db` file | Locked in proprietary storage |
24
- | Full audit & backup | Opaque retention policies |
25
- | Zero recurring cost | Subscription required |
26
-
27
- ---
28
-
29
- ## Features
30
-
31
- | Feature | Benefit |
32
- |-------|--------|
33
- | **Dual-Response Pattern** | Returns *all* matches (compact index) + full *details* within token budget |
34
- | **Token Budgeting** | Auto-respects `max_tokens` (~30% index, ~70% details) |
35
- | **Hybrid Relevance Scoring** | 40% relevance, 30% importance, 20% recency, 10% frequency |
36
- | **Auto-Summarization** | Generates ≤20-word natural-language summaries |
37
- | **Entity Extraction** | Detects people, tools, concepts, preferences |
38
- | **FTS5 Full-Text Search** | Sub-10ms queries, Unicode, stemming — no embeddings |
39
- | **Provenance Tracking** | Full audit trail: source, timestamp, updates |
40
- | **Soft Deletes** | Memories preserved for debugging/rollback |
41
- | **Single-File DB** | `memory.db` — copy, backup, move freely |
42
-
43
- ---
8
+ A lightweight MCP server that gives your AI durable, searchable memory entirely on your machine. Built with TypeScript, SQLite + FTS5, and minimal dependencies.
44
9
 
45
10
  ## Installation
46
11
 
47
- ### Prerequisites
48
- - Node.js ≥ 18
49
- - An **MCP-compatible client** (Claude Desktop, Cursor, Windsurf, etc.)
12
+ Requires Node.js 18+
50
13
 
51
- ### Option 1: NPM Package with Auto-Setup (Recommended)
14
+ Run this command to automatically configure Claude Desktop:
52
15
 
53
- **Automatic installation** (configures Claude Desktop for you):
54
16
  ```bash
55
17
  npx @whenmoon-afk/memory-mcp
56
18
  ```
57
19
 
58
- This will automatically:
59
- - Detect your operating system (macOS/Windows/Linux)
60
- - Add the memory server to your Claude Desktop configuration
61
- - Create a backup of your existing config
62
- - Configure the correct command format for your platform
63
-
64
- After installation, **restart Claude Desktop completely** (quit and reopen).
65
-
66
- **Or install globally**:
67
- ```bash
68
- npm install -g @whenmoon-afk/memory-mcp
69
- memory-mcp
70
- ```
71
-
72
- ### Option 2: From Source
73
-
74
- For development or customization:
75
- ```bash
76
- git clone https://github.com/WhenMoon-afk/claude-memory-mcp.git
77
- cd claude-memory-mcp
78
- npm install
79
- npm run build
80
- ```
81
-
82
- > Output: `dist/index.js` — your memory server.
83
-
84
- ---
85
-
86
- ### Claude Code Installation
87
-
88
- For users of Claude Code (terminal-based Claude), use the `claude mcp add` command:
89
-
90
- **Recommended (user-wide installation):**
91
- ```bash
92
- claude mcp add memory --scope user -- npx -y @whenmoon-afk/memory-mcp
93
- ```
94
-
95
- **Alternative (direct node invocation, more reliable, no npx):**
96
- ```bash
97
- npm install -g @whenmoon-afk/memory-mcp
98
- claude mcp add memory --scope user -- node $(npm root -g)/@whenmoon-afk/memory-mcp/dist/index.js
99
- ```
100
-
101
- **Per-Project Memory (project-specific, stored in project directory):**
102
- ```bash
103
- claude mcp add memory -s local -e MEMORY_DB_PATH=./memory.db -- npx -y @whenmoon-afk/memory-mcp
104
- ```
105
-
106
- **Verify installation:**
107
- ```bash
108
- claude mcp list
109
- # Or within a Claude Code session:
110
- /mcp
111
- ```
112
-
113
- > **Note:** The server automatically uses platform-appropriate database location. Both Claude Desktop and Claude Code will share the same memory database by default.
114
-
115
- > **Tip:** Use `--scope user` for personal knowledge that spans projects. Use `--scope local` with `MEMORY_DB_PATH=./memory.db` for codebase-specific context that stays with the repository.
116
-
117
- ---
118
-
119
- ## Docker Deployment
120
-
121
- Run the Memory MCP server in a containerized environment with persistent storage.
122
-
123
- ### Prerequisites
124
- - Docker installed ([Get Docker](https://docs.docker.com/get-docker/))
125
- - Docker Compose (included with Docker Desktop)
126
-
127
- ### Quick Start with Docker Compose
128
-
129
- **1. Clone the repository:**
130
- ```bash
131
- git clone https://github.com/WhenMoon-afk/claude-memory-mcp.git
132
- cd claude-memory-mcp
133
- ```
134
-
135
- **2. Start the container:**
136
- ```bash
137
- docker-compose up -d
138
- ```
139
-
140
20
  This will:
141
- - Build the Docker image with Node.js 20
142
- - Create a persistent volume at `./data/` for the database
143
- - Start the MCP server in detached mode
144
-
145
- **3. View logs:**
146
- ```bash
147
- docker-compose logs -f memory-mcp
148
- ```
149
-
150
- **4. Stop the container:**
151
- ```bash
152
- docker-compose down
153
- ```
154
-
155
- ### Manual Docker Build
156
-
157
- **Build the image:**
158
- ```bash
159
- docker build -t memory-mcp:latest .
160
- ```
161
-
162
- **Run the container:**
163
- ```bash
164
- # Create data directory
165
- mkdir -p ./data
166
-
167
- # Run container with volume mount
168
- docker run -d \
169
- --name memory-mcp \
170
- -v "$(pwd)/data:/data" \
171
- -e MEMORY_DB_PATH=/data/memory.db \
172
- -e DEFAULT_TTL_DAYS=90 \
173
- memory-mcp:latest
174
- ```
175
-
176
- **Interact with the running container:**
177
- ```bash
178
- # View logs
179
- docker logs -f memory-mcp
180
-
181
- # Execute commands inside container
182
- docker exec -it memory-mcp /bin/bash
183
-
184
- # Stop container
185
- docker stop memory-mcp
21
+ - Detect your OS (macOS/Windows/Linux)
22
+ - Configure Claude Desktop with the memory server
23
+ - Create backup of existing config
24
+ - Set up platform-appropriate database location
186
25
 
187
- # Remove container
188
- docker rm memory-mcp
189
- ```
190
-
191
- ### Volume Persistence
26
+ After installation, restart Claude Desktop completely.
192
27
 
193
- The database is stored in a Docker volume mapped to `./data/` on your host:
28
+ ## Database Location
194
29
 
195
- | Location | Path |
196
- |----------|------|
197
- | **Host** | `./data/memory.db` |
198
- | **Container** | `/data/memory.db` |
30
+ Memories are stored locally:
199
31
 
200
- **To backup your database:**
201
- ```bash
202
- cp ./data/memory.db ./memory-backup-$(date +%Y%m%d).db
203
- ```
32
+ - **macOS**: `~/.claude-memories/memory.db`
33
+ - **Windows**: `%APPDATA%/claude-memories/memory.db`
34
+ - **Linux**: `~/.local/share/claude-memories/memory.db`
204
35
 
205
- **To restore from backup:**
206
- ```bash
207
- cp ./memory-backup-20250105.db ./data/memory.db
208
- docker-compose restart
209
- ```
36
+ The database is a single portable SQLite file. Back it up by copying the file.
210
37
 
211
- ### Environment Variables (Docker)
38
+ ## Tools
212
39
 
213
- Configure via `docker-compose.yml` or `-e` flags:
40
+ | Tool | Description |
41
+ |------|-------------|
42
+ | `memory_store` | Store a memory with auto-summarization and entity extraction |
43
+ | `memory_recall` | Search memories with token-aware loading |
44
+ | `memory_forget` | Soft-delete a memory (preserves audit trail) |
214
45
 
215
- | Variable | Default | Description |
216
- |----------|---------|-------------|
217
- | `MEMORY_DB_PATH` | `/data/memory.db` | Database file location inside container |
218
- | `DEFAULT_TTL_DAYS` | `90` | Default memory expiration (days) |
219
- | `MEMORY_DB_DRIVER` | `better-sqlite3` | Database driver (better-sqlite3 or sqljs) |
220
- | `NODE_ENV` | `production` | Node environment |
221
-
222
- ### Docker Notes
223
-
224
- - **No HTTP Port**: This is a stdio-based MCP server. Communication happens via stdin/stdout, not HTTP requests.
225
- - **Native Dependencies**: Uses multi-stage build to compile better-sqlite3 native bindings
226
- - **Resource Limits**: Default docker-compose.yml sets 512MB memory limit (adjustable)
227
- - **Auto-restart**: Container restarts automatically unless explicitly stopped
228
-
229
- ### Using with MCP Clients
230
-
231
- When running in Docker, you'll need to configure your MCP client to communicate with the containerized server. The exact method depends on your client:
232
-
233
- - **For local development**: Use `docker exec` to run commands
234
- - **For production**: Consider using a container orchestration platform (Kubernetes, ECS, etc.)
235
-
236
- > **Tip**: For most use cases, the **NPM package installation** (Option 1) is simpler and more suitable than Docker, since MCP servers typically run locally and communicate directly with the AI client via stdio.
237
-
238
- ---
239
-
240
- ## Integrate with Your MCP Client
241
-
242
- Add to your client's MCP config file:
243
-
244
- **Claude Desktop**:
245
- - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
246
- - Windows: `%APPDATA%\Claude\claude_desktop_config.json`
247
- - Linux: `~/.config/Claude/claude_desktop_config.json`
46
+ ## Features
248
47
 
249
- **Cursor/Windsurf**: Check your editor's MCP settings
48
+ - FTS5 full-text search (fast, no embeddings needed)
49
+ - Token budgeting for context-aware responses
50
+ - Automatic entity extraction and summarization
51
+ - Soft deletes with provenance tracking
52
+ - Hybrid relevance scoring (recency + importance + frequency)
250
53
 
251
- > **💡 Recommended**: Use the automatic installer (`npx @whenmoon-afk/memory-mcp`) which handles platform differences automatically.
54
+ ## Manual Configuration
252
55
 
253
- ### Manual Configuration (macOS/Linux)
254
- ```json
255
- {
256
- "mcpServers": {
257
- "memory": {
258
- "command": "npx",
259
- "args": ["-y", "@whenmoon-afk/memory-mcp"],
260
- "env": {
261
- "MEMORY_DB_PATH": "./memory.db"
262
- }
263
- }
264
- }
265
- }
266
- ```
56
+ If auto-setup doesn't work, add to your Claude Desktop config:
267
57
 
268
- ### Manual Configuration (Windows)
58
+ **Config locations:**
59
+ - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
60
+ - **Windows**: `%APPDATA%/Claude/claude_desktop_config.json`
61
+ - **Linux**: `~/.config/Claude/claude_desktop_config.json`
269
62
 
270
- **Windows requires the `cmd /c` wrapper** to execute npx properly:
63
+ Add this to your config (the installer does this automatically):
271
64
 
272
- ```json
273
- {
274
- "mcpServers": {
275
- "memory": {
276
- "command": "cmd",
277
- "args": ["/c", "npx", "-y", "@whenmoon-afk/memory-mcp"],
278
- "env": {
279
- "MEMORY_DB_PATH": "./memory.db"
280
- }
281
- }
282
- }
283
- }
284
- ```
285
-
286
- ### Using Global Install
287
- ```json
288
- {
289
- "mcpServers": {
290
- "memory": {
291
- "command": "memory-mcp",
292
- "env": {
293
- "MEMORY_DB_PATH": "./memory.db"
294
- }
295
- }
296
- }
297
- }
298
- ```
299
-
300
- ### From Source
301
65
  ```json
302
66
  {
303
67
  "mcpServers": {
304
68
  "memory": {
305
69
  "command": "node",
306
- "args": ["/absolute/path/to/claude-memory-mcp/dist/index.js"],
70
+ "args": ["/path/to/node_modules/@whenmoon-afk/memory-mcp/dist/index.js"],
307
71
  "env": {
308
- "MEMORY_DB_PATH": "./memory.db"
72
+ "MEMORY_DB_PATH": "/path/to/.claude-memories/memory.db"
309
73
  }
310
74
  }
311
75
  }
312
76
  }
313
77
  ```
314
78
 
315
- > Restart or reload MCP servers.
316
-
317
- ---
318
-
319
- ## MCP Tools
320
-
321
- | Tool | Input | Description |
322
- |------|-------|-----------|
323
- | `memory_store` | `{ content, type, importance?, entities?, ttl_days?, provenance? }` | Store or update memory with auto-summary |
324
- | `memory_recall` | `{ query, type?, entities?, limit?, max_tokens? }` | Search memories with token-aware loading |
325
- | `memory_forget` | `{ id, reason? }` | Soft-delete memory (preserves provenance) |
326
-
327
- ---
328
-
329
- ### Store a Preference
330
-
331
- ```json
332
- {
333
- "tool": "memory_store",
334
- "input": {
335
- "content": "User works best in focused 90-minute blocks with 15-minute breaks.",
336
- "type": "fact",
337
- "importance": 8
338
- }
339
- }
340
- ```
341
-
342
- → Auto-creates:
343
- - Summary: `"User follows 90/15 focused work cycles."`
344
- - Entities: `focused work`, `90-minute blocks`
345
- - Provenance: current session
346
-
347
- ---
348
-
349
- ### Smart Recall (Dual-Response)
350
-
351
- ```json
352
- {
353
- "tool": "memory_recall",
354
- "input": {
355
- "query": "work habits",
356
- "max_tokens": 1200
357
- }
358
- }
359
- ```
360
-
361
- **Response**:
362
- ```json
363
- {
364
- "index": [
365
- { "id": "mem_8b1", "summary": "User follows 90/15 focused work cycles.", "score": 96 },
366
- { "id": "mem_2c9", "summary": "User avoids meetings before 10 AM.", "score": 88 }
367
- ],
368
- "details": [
369
- {
370
- "id": "mem_8b1",
371
- "content": "User works best in focused 90-minute blocks with 15-minute breaks.",
372
- "entities": ["focused work", "90-minute blocks"],
373
- "provenance": { "source": "chat_2025-11-03", "created_at": "2025-11-03T14:10Z" }
374
- }
375
- ],
376
- "meta": {
377
- "tokens_used": 698,
378
- "total_matches": 2,
379
- "truncated": false
380
- }
381
- }
382
- ```
383
-
384
- Your AI **knows what it knows** — and can ask for more.
385
-
386
- ---
387
-
388
- ### Forget a Memory
389
-
390
- ```json
391
- {
392
- "tool": "memory_forget",
393
- "input": {
394
- "id": "mem_8b1",
395
- "reason": "Information no longer relevant"
396
- }
397
- }
398
- ```
399
-
400
- **Response**:
401
- ```json
402
- {
403
- "success": true,
404
- "memory_id": "mem_8b1",
405
- "message": "Memory soft-deleted successfully. Reason: Information no longer relevant"
406
- }
407
- ```
408
-
409
- > Soft-deleted memories are **preserved** in the database with full provenance trail. They won't appear in searches but remain recoverable.
410
-
411
- ---
412
-
413
- ## Dual-Response Pattern
414
-
415
- ```
416
- [index] → All matching summaries (~20 tokens each)
417
- [details] → Full content of top memories (budget-capped)
418
- [meta] → tokens_used, total_matches, truncated
419
- ```
420
-
421
- - **Index**: Always included → *discovery*
422
- - **Details**: Budget-safe → *precision*
423
- - **Follow-up**: Use `ids: [...]` to expand
424
-
425
- ---
426
-
427
- ## Database & Portability
428
-
429
- - **File**: `memory.db` (SQLite) — path via `MEMORY_DB_PATH`
430
- - **Portable**: Copy to USB, cloud sync, or new machine
431
- - **Backup**: Just copy the file
432
- - **Tip**: For extra security, store `memory.db` on a **VeraCrypt Encrypted USB drive** (adds friction, but maximum control).
433
-
434
- ---
435
-
436
- ## Dependencies
437
-
438
- This project uses minimal runtime dependencies to keep the package lightweight:
439
-
440
- | Dependency | Version | Purpose |
441
- |-----------|---------|---------|
442
- | `@modelcontextprotocol/sdk` | ^1.0.4 | Official MCP protocol implementation |
443
- | `better-sqlite3` | ^11.0.0 | Fast, native SQLite3 bindings with FTS5 support |
444
-
445
- **Why these dependencies?**
446
- - **MCP SDK**: Required for implementing the Model Context Protocol standard
447
- - **better-sqlite3**: Native performance for full-text search and database operations, essential for memory recall speed
448
-
449
- All other dependencies are dev-only (TypeScript, testing, linting).
450
-
451
- ---
452
-
453
79
  ## Environment Variables
454
80
 
455
81
  | Variable | Default | Description |
456
82
  |----------|---------|-------------|
457
- | `MEMORY_DB_PATH` | Platform-specific* | Database file location |
458
- | `MEMORY_DB_DRIVER` | `better-sqlite3` | Database driver (`better-sqlite3` or `sqljs`) |
459
- | `DEFAULT_TTL_DAYS` | `90` | Default time-to-live for memories (days) |
83
+ | `MEMORY_DB_PATH` | Platform-specific | Database file location |
84
+ | `DEFAULT_TTL_DAYS` | `90` | Default memory expiration |
460
85
 
461
- *Default database locations (when installed via `npx`):
462
- - **macOS:** `~/.claude-memories/memory.db`
463
- - **Windows:** `%APPDATA%\claude-memories\memory.db`
464
- - **Linux:** `~/.local/share/claude-memories/memory.db`
86
+ ## Troubleshooting
465
87
 
466
- ---
88
+ **Tools not appearing in Claude Desktop?**
467
89
 
468
- ### Security
90
+ 1. Restart Claude Desktop completely (quit and reopen)
91
+ 2. Verify config file syntax is valid JSON
92
+ 3. Check that Node.js 18+ is installed: `node --version`
93
+ 4. Re-run installer: `npx @whenmoon-afk/memory-mcp`
469
94
 
470
- This is a **local-only** MCP server.
471
- Data is stored in a plain SQLite file (`memory.db`).
472
- For sensitive data, use OS-level encryption (FileVault, BitLocker).
473
-
474
- ---
475
-
476
- ## Best Practices
477
-
478
- 1. **Start with `max_tokens: 1000`** — adjust per model and task.
479
- 2. **Filter by `type`** to reduce noise and improve relevance.
480
- 3. **Use entity filtering** to narrow searches to specific topics.
481
- 4. **Reference provenance**: Track source and context for audit trails.
482
- 5. **Backup `memory.db`** regularly — it's just a file!
483
-
484
- ---
485
-
486
- ## Quick Links
487
-
488
- - 📦 **NPM Package**: https://www.npmjs.com/package/@whenmoon-afk/memory-mcp
489
- - 🐙 **GitHub Repository**: https://github.com/WhenMoon-afk/claude-memory-mcp
490
- - 🐛 **Report Issues**: https://github.com/WhenMoon-afk/claude-memory-mcp/issues
491
- - 📖 **MCP Documentation**: https://modelcontextprotocol.io
492
-
493
- ---
95
+ ## Dependencies
494
96
 
495
- ## Contributing
97
+ - `@modelcontextprotocol/sdk` - MCP protocol implementation
98
+ - `better-sqlite3` - Fast native SQLite with FTS5
496
99
 
497
- Contributions are welcome! Feel free to:
498
- - Report bugs or request features via [GitHub Issues](https://github.com/WhenMoon-afk/claude-memory-mcp/issues)
499
- - Submit pull requests for improvements
500
- - Share your use cases and feedback
100
+ ## Links
501
101
 
502
- ---
102
+ - **npm**: https://www.npmjs.com/package/@whenmoon-afk/memory-mcp
103
+ - **GitHub**: https://github.com/WhenMoon-afk/claude-memory-mcp
104
+ - **Issues**: https://github.com/WhenMoon-afk/claude-memory-mcp/issues
503
105
 
504
106
  ## License
505
107
 
506
- MIT License - see [LICENSE](LICENSE) file for details.
507
-
508
- **Copyright (c) 2025 WhenMoon-afk**
509
-
510
- ---
511
-
512
- **Built with ❤️ for the MCP community**
108
+ MIT
package/dist/index.js CHANGED
@@ -53,7 +53,7 @@ const config = {
53
53
  */
54
54
  const server = new Server({
55
55
  name: '@whenmoon-afk/memory-mcp',
56
- version: '2.2.2',
56
+ version: '2.3.0',
57
57
  }, {
58
58
  capabilities: {
59
59
  tools: {},
package/install.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@whenmoon-afk/memory-mcp",
3
- "version": "2.2.2",
3
+ "version": "2.3.0",
4
4
  "description": "Brain-inspired memory for AI agents - MCP server",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "bin": {
8
- "memory-mcp": "dist/index.js"
8
+ "memory-mcp": "install.js"
9
9
  },
10
10
  "files": [
11
11
  "dist/",