@xultrax-web/agent-memory-mcp 0.6.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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +367 -0
  3. package/dist/index.js +1245 -0
  4. package/package.json +71 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 xultrax-web
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,367 @@
1
+ # agent-memory-mcp
2
+
3
+ > Markdown memory for AI agents. Your data is just files.
4
+
5
+ [![CI](https://github.com/xultrax-web/agent-memory-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/xultrax-web/agent-memory-mcp/actions/workflows/ci.yml)
6
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
7
+ [![Node](https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg)](https://nodejs.org)
8
+ [![MCP](https://img.shields.io/badge/MCP-server-blueviolet)](https://modelcontextprotocol.io)
9
+
10
+ **The only MCP memory server that isn't a database.** Every other option asks you to trust a knowledge graph, a vector DB, Postgres + pgvector, DuckDB, or Neo4j. This one writes plain markdown files to a directory.
11
+
12
+ You can `cat` your memory. You can `grep` it. You can edit it in vim. You can commit it to git. You can move it between machines with `scp`. If the AI gets it wrong, you fix it in a text editor and save. No migration scripts. No vendor lock-in. No "just trust the embedding."
13
+
14
+ ---
15
+
16
+ ## What you get
17
+
18
+ ```text
19
+ .agent-memory/
20
+ ├── MEMORY.md # auto-managed index
21
+ ├── user-prefers-tabs.md
22
+ ├── feedback-no-emoji-in-code.md
23
+ ├── project-q3-launch-frozen.md
24
+ └── reference-postgres-runbook.md
25
+ ```
26
+
27
+ A memory file is just markdown with YAML frontmatter:
28
+
29
+ ```markdown
30
+ ---
31
+ name: feedback-no-emoji-in-code
32
+ description: User wants zero emoji in commits, comments, or output
33
+ type: feedback
34
+ ---
35
+
36
+ Hard rule. No emoji anywhere user-facing.
37
+
38
+ **Why:** prior contractor flooded the repo with them; user spent a
39
+ weekend removing them.
40
+
41
+ **How to apply:** scrub before commit; reject any tool output that
42
+ adds them automatically.
43
+ ```
44
+
45
+ That's the whole format. No magic. Read it, edit it, ship it.
46
+
47
+ ---
48
+
49
+ ## Why this exists
50
+
51
+ Most MCP clients have no persistent memory. The ones that do (Claude Code) store it where only that client can see it. The official `server-memory` and every community alternative use opaque structured backends. That's fine for some workflows — but it puts your data behind a layer you can't read with `cat`.
52
+
53
+ We chose markdown because:
54
+
55
+ - **Universal.** Every developer can read markdown. Every editor handles it. Every diff tool understands it.
56
+ - **Portable.** Memories travel with the project (per-project default) or with you (global mode). Move them, copy them, fork them — they're just files.
57
+ - **Inspectable.** You can audit what your AI assistant "knows" by opening a folder.
58
+ - **Repairable.** When a memory is wrong, you fix it the way you fix any text file. No SDK, no API, no SQL.
59
+ - **Versionable.** Git understands every change. No JSON merge conflicts. No binary blobs.
60
+
61
+ If you want vector similarity search, semantic recall, or auto-relation extraction — use one of the database-backed memory MCPs. They're great at that. If you want memory that you can still read after a power outage, this is for you.
62
+
63
+ ---
64
+
65
+ ## Install
66
+
67
+ ### Quick start (works today, no npm needed)
68
+
69
+ ```bash
70
+ npx -y github:xultrax-web/agent-memory-mcp
71
+ ```
72
+
73
+ ### From npm (once published — landing v0.4.0)
74
+
75
+ ```bash
76
+ npx -y @xultrax-web/agent-memory-mcp
77
+ ```
78
+
79
+ ### Build locally
80
+
81
+ ```bash
82
+ git clone https://github.com/xultrax-web/agent-memory-mcp
83
+ cd agent-memory-mcp
84
+ npm install
85
+ npm run build
86
+ node dist/index.js
87
+ ```
88
+
89
+ The server speaks MCP over stdio. You don't run it directly — your MCP client launches it.
90
+
91
+ ---
92
+
93
+ ## Client configuration
94
+
95
+ Same JSON, slightly different paths per client.
96
+
97
+ ### Cursor
98
+
99
+ `~/.cursor/mcp.json` (or `.cursor/mcp.json` in your project):
100
+
101
+ ```json
102
+ {
103
+ "mcpServers": {
104
+ "agent-memory": {
105
+ "command": "npx",
106
+ "args": ["-y", "github:xultrax-web/agent-memory-mcp"]
107
+ }
108
+ }
109
+ }
110
+ ```
111
+
112
+ ### Cline (VS Code extension)
113
+
114
+ Cline → MCP Servers → Add:
115
+
116
+ ```json
117
+ {
118
+ "agent-memory": {
119
+ "command": "npx",
120
+ "args": ["-y", "github:xultrax-web/agent-memory-mcp"]
121
+ }
122
+ }
123
+ ```
124
+
125
+ ### Claude Desktop
126
+
127
+ `%APPDATA%\Claude\claude_desktop_config.json` (Windows) or `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS):
128
+
129
+ ```json
130
+ {
131
+ "mcpServers": {
132
+ "agent-memory": {
133
+ "command": "npx",
134
+ "args": ["-y", "github:xultrax-web/agent-memory-mcp"]
135
+ }
136
+ }
137
+ }
138
+ ```
139
+
140
+ > **Windows note:** if `npx` doesn't resolve cleanly, wrap with `cmd /c`:
141
+ >
142
+ > ```json
143
+ > { "command": "cmd", "args": ["/c", "npx", "-y", "github:xultrax-web/agent-memory-mcp"] }
144
+ > ```
145
+
146
+ ### Continue.dev
147
+
148
+ `~/.continue/config.json`:
149
+
150
+ ```json
151
+ {
152
+ "experimental": {
153
+ "modelContextProtocolServers": [
154
+ {
155
+ "transport": {
156
+ "type": "stdio",
157
+ "command": "npx",
158
+ "args": ["-y", "github:xultrax-web/agent-memory-mcp"]
159
+ }
160
+ }
161
+ ]
162
+ }
163
+ }
164
+ ```
165
+
166
+ ### Storage scope
167
+
168
+ Per-project (default): memories live in `./.agent-memory/` relative to wherever the client launched the server. Usually that's the project root.
169
+
170
+ Personal / global pool:
171
+
172
+ ```json
173
+ "env": { "AGENT_MEMORY_SCOPE": "global" }
174
+ ```
175
+
176
+ Global memories live at `~/.agent-memory/`.
177
+
178
+ Custom path:
179
+
180
+ ```json
181
+ "env": { "AGENT_MEMORY_DIR": "/abs/path/to/memory" }
182
+ ```
183
+
184
+ ---
185
+
186
+ ## Tools
187
+
188
+ | Tool | Purpose |
189
+ | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
190
+ | `save_memory` | Create or update a memory. Atomic write + locked. Validates name + type. Updates the index. |
191
+ | `search_memories` | Fuzzy search (Fuse.js · typo-tolerant, word-order tolerant, partial matches). Returns top N with relevance 0-100 + body snippet. |
192
+ | `relevant_memories` | Same matching as search, but returns full memory bodies as one markdown doc. Built for LLM auto-context. |
193
+ | `get_memory` | Fetch one memory by name. Returns frontmatter + body. |
194
+ | `list_memories` | List memories. Optional `type` filter. Paginated (default 50/page). |
195
+ | `delete_memory` | Soft delete: moves the memory to `.trash/<ts>-<name>.md`. Recoverable until you empty `.trash/` by hand. |
196
+ | `restore_memory` | Restore a soft-deleted memory from `.trash/`. Picks the most recent trash entry for the name. |
197
+ | `doctor` | Storage integrity check. Reports orphans, dangling index entries, unreadable files. Pass `rebuild-index=true` to repair `MEMORY.md` from disk. |
198
+ | `stats` | Dashboard: counts per type, total size, largest memory, audit-log size, trash count. |
199
+ | `log_events` | Read recent entries from the audit event log. Optional `tail` (default 20) + `action` filter. |
200
+
201
+ ### Memory types
202
+
203
+ Four built-in types, matching the Claude Code convention:
204
+
205
+ - **user** — facts about the person (role, preferences, expertise level)
206
+ - **feedback** — rules the assistant should follow (do this, don't do that)
207
+ - **project** — current-state context that isn't in the code (deadlines, in-flight work)
208
+ - **reference** — pointers to external systems (Linear board URL, monitoring dashboard)
209
+
210
+ ---
211
+
212
+ ## CLI
213
+
214
+ The same binary is also a command-line tool. Useful in shell scripts, git hooks, cron, or just for quick lookups outside your editor.
215
+
216
+ ```bash
217
+ agent-memory save user-likes-tabs --type user --description "Prefers tabs" --content "Always use tabs in new files."
218
+ agent-memory list
219
+ agent-memory list --type feedback
220
+ agent-memory search "tabs" # fuzzy, top 10 by relevance
221
+ agent-memory search "depoy" --limit 5 # typo-tolerant ("depoy" → "deploy")
222
+ agent-memory relevant "deployment" --max 3 # full memory bodies, LLM-ready
223
+ agent-memory get user-likes-tabs
224
+ agent-memory list --limit 20 --offset 40 # pagination
225
+ agent-memory delete user-likes-tabs # soft delete — moves to .trash/
226
+ agent-memory restore user-likes-tabs # restore the most recent trash entry
227
+ agent-memory doctor # check integrity
228
+ agent-memory doctor --rebuild-index # repair MEMORY.md from disk
229
+ agent-memory stats # dashboard: counts, sizes, audit/trash
230
+ agent-memory log # last 20 entries from the audit log
231
+ agent-memory log --tail 50 --action delete # filter by action, tail size
232
+ ```
233
+
234
+ ### Audit log + structured logging
235
+
236
+ Every mutation appends one JSON line to `.agent-memory/.events.jsonl`:
237
+
238
+ ```jsonl
239
+ {"ts":"2026-05-22T04:02:38.536Z","action":"save","name":"first-mem","type":"user","update":false,"bytes":6}
240
+ {"ts":"2026-05-22T04:02:39.414Z","action":"delete","name":"second-mem","trash":"1779422559413-second-mem.md"}
241
+ {"ts":"2026-05-22T04:02:39.712Z","action":"restore","name":"second-mem","binnedAt":"2026-05-22T04:02:39.413Z"}
242
+ ```
243
+
244
+ Read it any way you want: `cat`, `jq`, the `log` / `log_events` tool, or a sidecar that ships it to your observability stack.
245
+
246
+ Operational logging is separate. Set `AGENT_MEMORY_LOG=debug|info|warn|error` (default `info`) and structured lines stream to stderr — won't pollute the MCP stdio channel.
247
+
248
+ Color output is on by default in TTYs. Set `NO_COLOR=1` to disable, `FORCE_COLOR=1` to force-enable in pipes.
249
+
250
+ Multi-line content can come from a file or stdin:
251
+
252
+ ```bash
253
+ agent-memory save my-handoff --type project --description "Q3 handoff notes" --content-file handoff.md
254
+ cat conversation.txt | agent-memory save extracted-prefs --type user --description "Pulled from chat" --stdin
255
+ ```
256
+
257
+ ### Importing from Claude Code
258
+
259
+ If you've been using Claude Code's built-in memory, bring it over:
260
+
261
+ ```bash
262
+ # See what would be imported (dry run, no writes)
263
+ agent-memory import-claude-code --dry-run
264
+
265
+ # Filter to one project by substring match (case-insensitive)
266
+ agent-memory import-claude-code --project prefixcheck --dry-run
267
+
268
+ # Do the import
269
+ agent-memory import-claude-code --project prefixcheck
270
+
271
+ # Replace existing memories with the same names
272
+ agent-memory import-claude-code --project prefixcheck --overwrite
273
+ ```
274
+
275
+ The importer walks `~/.claude/projects/*/memory/`, parses each memory's YAML frontmatter (tolerantly — malformed files don't kill the run), flattens Claude Code's `metadata.type` field to top-level `type`, and writes to your current store. Existing memories with the same name are skipped unless you pass `--overwrite`.
276
+
277
+ ---
278
+
279
+ ## How it compares
280
+
281
+ The memory MCP landscape, as of May 2026:
282
+
283
+ | Server | Backend | Hand-editable? | Greppable? | Git-friendly? |
284
+ | ------------------------------------------------ | ---------------------- | -------------- | ---------- | -------------- |
285
+ | **agent-memory-mcp (this)** | **Markdown files** | **Yes** | **Yes** | **Yes** |
286
+ | `@modelcontextprotocol/server-memory` (official) | Knowledge graph (JSON) | No (raw JSON) | Limited | Painful merges |
287
+ | memory-graph/memory-graph | Graph DB | No | No | No |
288
+ | IzumiSy/mcp-duckdb-memory-server | DuckDB | No | No | No |
289
+ | sdimitrov/mcp-memory | Postgres + pgvector | No | No | No |
290
+ | JovanHsu/mcp-neo4j-memory-server | Neo4j | No | No | No |
291
+
292
+ **The trade you're making:** you give up native semantic similarity search and structured entity-relation queries. You get a memory store that survives every tool change, every machine swap, every "wait, what was that AI telling me about this codebase six months ago?"
293
+
294
+ For most workflows that's a good trade. For some it isn't. Pick the right tool.
295
+
296
+ ---
297
+
298
+ ## Operator-grade by design
299
+
300
+ This server is built to be used daily, not to demo well once.
301
+
302
+ **Shipped in v0.3:**
303
+
304
+ - **Atomic writes** — tmp-file + rename pattern. Power-loss never leaves a half-written file.
305
+ - **File locking** — `proper-lockfile` around every mutation. Concurrent MCP server + CLI access can't corrupt the index.
306
+ - **Soft delete** — `delete_memory` moves to `.trash/<timestamp>-<name>.md`. `restore_memory` brings it back.
307
+ - **Index recovery** — `agent-memory doctor` reports orphan files, dangling entries, and parse errors. `--rebuild-index` rewrites `MEMORY.md` from disk.
308
+ - **Schema versioning** — every memory file gets a `schema: 1` field so future format changes can migrate cleanly.
309
+ - **Spec-compliant Resources** — `agent-memory://index` + `agent-memory://memory/{name}`; clients can pin them as always-visible context.
310
+
311
+ **Shipped in v0.4:**
312
+
313
+ - **Append-only event log** at `.events.jsonl` — every mutation timestamped + JSON-structured for audit.
314
+ - **`agent-memory stats`** — dashboard of counts per type, total/avg/largest size, audit + trash counts.
315
+ - **`agent-memory log`** — paginated browser of the event log, filterable by action.
316
+ - **Structured stderr logging** — `AGENT_MEMORY_LOG=debug|info|warn|error`; safe to use alongside MCP stdio.
317
+ - **Color output** — auto-detected via TTY, respects `NO_COLOR` / `FORCE_COLOR`.
318
+
319
+ **Shipped in v0.5:**
320
+
321
+ - **Fuse.js fuzzy search** with field weights (name×3, description×2, body×1). Typo, partial, and word-order tolerant.
322
+ - **Snippet highlighting** — body-context excerpts shown under each match with `...` markers.
323
+ - **Relevance scoring** — Fuse score inverted + scaled to 0-100 for human readability.
324
+ - **`relevant_memories(query, max=5)`** — sister tool to search that returns FULL memory bodies as a single markdown doc, built for LLM auto-context loading.
325
+ - **Pagination** — `offset` + `limit` on `list_memories` and `limit` on `search_memories`.
326
+
327
+ **Shipped in v0.6:**
328
+
329
+ - **Vitest test suite** — 20+ blackbox tests covering CLI + MCP server paths.
330
+ - **GitHub Actions CI** — runs tests on every push/PR across Node 18/20/22.
331
+ - **[COMPATIBILITY.md](COMPATIBILITY.md)** — known-working client matrix + quirks.
332
+
333
+ **Landing in v0.7:**
334
+
335
+ - Read-only mode (`AGENT_MEMORY_READ_ONLY=1`)
336
+ - Live multi-client verification (Cursor, Cline, Claude Desktop, Continue)
337
+ - Demo GIF / screencast
338
+
339
+ ---
340
+
341
+ ## Roadmap
342
+
343
+ - **v0.2** — MCP Resources support, Claude Code import script (`agent-memory import-claude-code`), CLI mode
344
+ - **v0.3** — Atomic writes, soft delete, schema versioning, doctor command
345
+ - **v0.4** — Structured event log, stats command, color output
346
+ - **v0.5** — Fuzzy search (Fuse.js), BM25 ranking, snippet highlighting
347
+ - **v0.7** — Comprehensive test suite, multi-client compatibility matrix
348
+ - **v0.9** — npm publish + MCP Registry submission
349
+ - **v1.0** — Public launch
350
+
351
+ Beyond v1.0: sync backends (git remote, S3), web UI, team mode, browser extension, optional embeddings sidecar.
352
+
353
+ Open an issue if you want one of these before I get to it.
354
+
355
+ ---
356
+
357
+ ## License
358
+
359
+ MIT. Use it for whatever.
360
+
361
+ ---
362
+
363
+ ## Author
364
+
365
+ [@xultrax-web](https://github.com/xultrax-web) · built for the cross-client memory problem I kept running into. Part of [PrefixCheck Labs](https://prefixcheck.com/labs/).
366
+
367
+ Inspired by the file-based memory system in Anthropic's Claude Code.