@memstack/mcp 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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MemStack
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,150 @@
1
+ # @memstack/mcp
2
+
3
+ MCP server for MemStack — persistent AI agent memory via the Model Context Protocol.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g @memstack/mcp
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ Add to your MCP client config (~/.claude/mcp.json or .cursor/mcp.json):
14
+
15
+ ```json
16
+ {
17
+ "mcpServers": {
18
+ "memstack": {
19
+ "command": "npx",
20
+ "args": ["-y", "@memstack/mcp"],
21
+ "env": {
22
+ "MEMSTACK_STORAGE": "memory",
23
+ "OPENAI_API_KEY": "sk-..."
24
+ }
25
+ }
26
+ }
27
+ }
28
+ ```
29
+
30
+ ## Configuration
31
+
32
+ All configuration is via environment variables. No config files needed.
33
+
34
+ ### Storage backends
35
+
36
+ | Variable | Values | Default |
37
+ |---|---|---|
38
+ | `MEMSTACK_STORAGE` | memory, disk, markdown, postgres, sqlite, redis | `memory` |
39
+
40
+ **In-memory (default — testing only, data lost on restart):**
41
+ ```
42
+ MEMSTACK_STORAGE=memory
43
+ ```
44
+
45
+ **Disk (JSON file per actor):**
46
+ ```
47
+ MEMSTACK_STORAGE=disk
48
+ MEMSTACK_DIR=/Users/me/.memstack
49
+ ```
50
+
51
+ **Markdown (zero infra, human-readable):**
52
+ ```
53
+ MEMSTACK_STORAGE=markdown
54
+ MEMSTACK_DIR=/Users/me/.memstack
55
+ ```
56
+
57
+ **Postgres (production):**
58
+ ```
59
+ MEMSTACK_STORAGE=postgres
60
+ DATABASE_URL=postgresql://user:pass@localhost/memstack
61
+ ```
62
+
63
+ **Redis:**
64
+ ```
65
+ MEMSTACK_STORAGE=redis
66
+ REDIS_URL=redis://localhost:6379
67
+ ```
68
+
69
+ **SQLite:**
70
+ ```
71
+ MEMSTACK_STORAGE=sqlite
72
+ SQLITE_PATH=./memory.db
73
+ ```
74
+
75
+ ### LLM providers
76
+
77
+ | Variable | Purpose |
78
+ |---|---|
79
+ | `OPENAI_API_KEY` | OpenAI LLM (default) |
80
+ | `ANTHROPIC_API_KEY` | Anthropic (summarization) |
81
+
82
+ At least one of `OPENAI_API_KEY` or `ANTHROPIC_API_KEY` must be set. If both are set, Anthropic is preferred for summarization.
83
+
84
+ ### Embeddings (semantic search)
85
+
86
+ | Variable | Purpose |
87
+ |---|---|
88
+ | `OPENAI_API_KEY` | OpenAI embeddings |
89
+
90
+ Without embedding config, retrieval falls back to keyword + importance search.
91
+
92
+ ## Tools
93
+
94
+ The MCP server exposes these tools to the agent:
95
+
96
+ | Tool | Description |
97
+ |---|---|
98
+ | `memory_process` | Store with auto-enrichment (importance, tags) |
99
+ | `memory_store` | Store a memory |
100
+ | `memory_retrieve` | Retrieve memories by query, strategy, time range |
101
+ | `memory_compile_context` | Assemble token-budgeted LLM-ready context |
102
+ | `memory_summarize` | Compress old interactions via LLM |
103
+ | `memory_prune` | Remove stale/low-importance memories |
104
+ | `memory_purge_actor` | Delete all memories for an actor |
105
+ | `memory_merge` | Merge multiple memories into one |
106
+ | `memory_stats` | Memory diagnostics (counts, types, importance) |
107
+ | `memory_delete` | Delete a single memory |
108
+ | `memory_health` | Check storage/LLM/embedding connectivity |
109
+ | `memory_dry_run_prune` | Preview what would be pruned |
110
+
111
+ ## Resources
112
+
113
+ | URI | Description |
114
+ |---|---|
115
+ | `memory://{actorId}/context` | Compiled LLM context as markdown |
116
+ | `memory://{actorId}/stats` | Actor memory stats as JSON |
117
+
118
+ ## Prompts
119
+
120
+ | Prompt | Description |
121
+ |---|---|
122
+ | `memory_context` | Auto-injected memory context for current actor |
123
+
124
+ ## Actor persistence
125
+
126
+ By default, all memories belong to the `"default"` actor. Set `MEMSTACK_ACTOR` to identify the agent:
127
+
128
+ ```
129
+ MEMSTACK_ACTOR=my-agent
130
+ ```
131
+
132
+ This keeps memory isolated per agent. The agent can also override the actor with `actorId` in any tool call.
133
+
134
+ ## Publishing
135
+
136
+ ```bash
137
+ cd packages/mcp
138
+ pnpm build && pnpm check && pnpm test
139
+ npm publish --access public
140
+ ```
141
+
142
+ After publishing, users install with:
143
+
144
+ ```bash
145
+ npm install -g @memstack/mcp
146
+ ```
147
+
148
+ ## License
149
+
150
+ MIT
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node