@memstack/mcp 0.7.3 → 0.8.1
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 +57 -7
- package/dist/cli.js +491 -37
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +22 -2
- package/dist/index.js +387 -35
- package/dist/index.js.map +1 -1
- package/package.json +9 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @memstack/mcp
|
|
2
2
|
|
|
3
|
-
MCP server for MemStack — persistent AI agent memory via the Model Context Protocol.
|
|
3
|
+
MCP server for MemStack — persistent AI agent memory via the Model Context Protocol. Includes a harness profile that gives Claude Code and Codex one shared memory per project.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -11,11 +11,16 @@ npm install -g @memstack/mcp
|
|
|
11
11
|
Install a database driver only when selecting that storage backend:
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
npm install @memstack/mcp better-sqlite3 # SQLite
|
|
15
|
-
npm install @memstack/mcp ioredis
|
|
16
|
-
npm install @memstack/mcp postgres
|
|
14
|
+
npm install @memstack/mcp better-sqlite3@^11.10.0 # SQLite
|
|
15
|
+
npm install @memstack/mcp ioredis@^5.11.1 # Redis
|
|
16
|
+
npm install @memstack/mcp postgres@^3.4.9 # Postgres (or pg)
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
+
With `npx`, add the driver with `-p` and name the command, for example
|
|
20
|
+
`npx -y -p @memstack/mcp -p postgres@^3.4.9 memstack-mcp`. Copy-paste client
|
|
21
|
+
configs for each backend are in
|
|
22
|
+
[MCP Setup: Database backends](../../docs/MCP_SETUP.md#database-backends-sqlite-postgres-redis).
|
|
23
|
+
|
|
19
24
|
Memory, disk, and Markdown storage need only `@memstack/mcp`. SQLite requires
|
|
20
25
|
a writable database path and package lifecycle scripts. The Glama deployment
|
|
21
26
|
image is `packages/mcp/Dockerfile`; it runs the stdio MCP command directly,
|
|
@@ -40,9 +45,54 @@ Add to your MCP client config (`~/.config/opencode/`, `~/.claude/mcp.json`, or `
|
|
|
40
45
|
}
|
|
41
46
|
```
|
|
42
47
|
|
|
48
|
+
## Harness profile (Claude Code and Codex)
|
|
49
|
+
|
|
50
|
+
`memstack-mcp --profile harness` is a smaller, project-scoped server for
|
|
51
|
+
coding agents. You normally don't configure it by hand:
|
|
52
|
+
[`memstack connect`](../cli/README.md#claude-code-and-codex) registers it with
|
|
53
|
+
Claude Code and Codex.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npm install -g @memstack/cli @memstack/mcp better-sqlite3@^11.10.0
|
|
57
|
+
memstack init && memstack connect claude-code && memstack connect codex
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
| Tool | Description |
|
|
61
|
+
|---|---|
|
|
62
|
+
| `memory_store` | Save a fact, decision, preference, or rule to project memory (`scope: "global"` for every project) |
|
|
63
|
+
| `memory_retrieve` | Recall memories for a natural-language question; local keyword ranking, no LLM call |
|
|
64
|
+
| `memory_get` | Get one memory by ID |
|
|
65
|
+
| `memory_delete` | Delete a wrong or outdated memory |
|
|
66
|
+
| `memory_stats` | Show the current project and its memory count |
|
|
67
|
+
|
|
68
|
+
- **No `actorId`.** The project comes from `CLAUDE_PROJECT_DIR` (set by
|
|
69
|
+
Claude Code) or the working directory (Codex), identified by the
|
|
70
|
+
repository's first commit. One project can't read or delete another's
|
|
71
|
+
memories, and bulk or destructive tools are not exposed.
|
|
72
|
+
- **Instructions.** The server sends MCP `instructions` telling the agent to
|
|
73
|
+
recall at the start of a task and to save when asked to remember.
|
|
74
|
+
- **Tagging.** `memory_store` asks your LLM for topic tags so category
|
|
75
|
+
questions find specific memories; if tagging fails, the memory is still
|
|
76
|
+
saved.
|
|
77
|
+
- **Settings** come from `~/.memstack/config.json` (written by
|
|
78
|
+
`memstack init`) overlaid with the environment variables below. Stdio only.
|
|
79
|
+
- **`--harness <name>`** labels which agent wrote each memory.
|
|
80
|
+
|
|
81
|
+
### Session-start hook
|
|
82
|
+
|
|
83
|
+
`memstack-mcp hook session-start` prints the project's most important memories
|
|
84
|
+
(up to 15, at most 6,000 characters) as plain text. `memstack connect`
|
|
85
|
+
installs it as a `SessionStart` hook in Claude Code and Codex, so each new
|
|
86
|
+
session starts with them. It reads the harness's hook input from stdin, makes
|
|
87
|
+
no LLM call, and on any error prints nothing and exits 0, so it never blocks
|
|
88
|
+
a session.
|
|
89
|
+
|
|
43
90
|
## Configuration
|
|
44
91
|
|
|
45
|
-
|
|
92
|
+
The default profile is configured by environment variables only. The harness
|
|
93
|
+
profile also reads `~/.memstack/config.json`; any LLM variable in the
|
|
94
|
+
environment replaces the file's `llm` section, and `MEMSTACK_STORAGE` replaces
|
|
95
|
+
its `storage` section.
|
|
46
96
|
|
|
47
97
|
### Storage backends
|
|
48
98
|
|
|
@@ -108,7 +158,7 @@ Without embedding config, retrieval falls back to keyword + importance search.
|
|
|
108
158
|
|
|
109
159
|
## Tools
|
|
110
160
|
|
|
111
|
-
The
|
|
161
|
+
The default profile exposes these tools to the agent:
|
|
112
162
|
|
|
113
163
|
| Tool | Description |
|
|
114
164
|
|---|---|
|
|
@@ -169,7 +219,7 @@ HTTP mode is stateless (`sessionIdGenerator: undefined` per the MCP spec) — ea
|
|
|
169
219
|
|
|
170
220
|
## Actor persistence
|
|
171
221
|
|
|
172
|
-
|
|
222
|
+
In the default profile, all memories belong to the `"default"` actor by default. Set `MEMSTACK_ACTOR` to identify the agent:
|
|
173
223
|
|
|
174
224
|
```
|
|
175
225
|
MEMSTACK_ACTOR=my-agent
|