@asd412id/mcp-context-manager 1.0.0 → 1.0.2
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 +286 -80
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,33 +1,197 @@
|
|
|
1
1
|
# MCP Context Manager
|
|
2
2
|
|
|
3
|
-
MCP (Model Context Protocol) tools
|
|
3
|
+
MCP (Model Context Protocol) tools for context management in AI coding agents. Helps prevent out-of-context issues in long conversations.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- **Memory Store** - Persistent key-value storage
|
|
8
|
-
- **Context Summarizer** -
|
|
7
|
+
- **Memory Store** - Persistent key-value storage across sessions
|
|
8
|
+
- **Context Summarizer** - Summarize chat/text, extract key points, decisions, action items
|
|
9
9
|
- **Project Tracker** - Track decisions, changes, todos, notes, errors
|
|
10
10
|
- **Session Checkpoint** - Save/restore session state
|
|
11
|
-
- **Smart File Loader** - Load
|
|
11
|
+
- **Smart File Loader** - Load files with relevance filtering
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
15
|
+
Requires Node.js >= 18.0.0
|
|
16
|
+
|
|
15
17
|
```bash
|
|
18
|
+
# Run directly with npx (recommended)
|
|
19
|
+
npx @asd412id/mcp-context-manager
|
|
20
|
+
|
|
21
|
+
# Or install globally
|
|
16
22
|
npm install -g @asd412id/mcp-context-manager
|
|
17
23
|
```
|
|
18
24
|
|
|
19
|
-
|
|
25
|
+
## Configuration by Client
|
|
20
26
|
|
|
21
|
-
|
|
22
|
-
|
|
27
|
+
### Claude Desktop
|
|
28
|
+
|
|
29
|
+
**Config file location:**
|
|
30
|
+
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
31
|
+
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
32
|
+
- **Linux:** `~/.config/Claude/claude_desktop_config.json`
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"mcpServers": {
|
|
37
|
+
"context-manager": {
|
|
38
|
+
"command": "npx",
|
|
39
|
+
"args": ["-y", "@asd412id/mcp-context-manager"]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
23
43
|
```
|
|
24
44
|
|
|
25
|
-
|
|
45
|
+
### VS Code (GitHub Copilot / Claude Extension)
|
|
26
46
|
|
|
27
|
-
|
|
47
|
+
**Option 1: Workspace config** - `.vscode/mcp.json`
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"servers": {
|
|
52
|
+
"context-manager": {
|
|
53
|
+
"type": "stdio",
|
|
54
|
+
"command": "npx",
|
|
55
|
+
"args": ["-y", "@asd412id/mcp-context-manager"]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Option 2: User settings** - `settings.json`
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"mcp.servers": {
|
|
66
|
+
"context-manager": {
|
|
67
|
+
"command": "npx",
|
|
68
|
+
"args": ["-y", "@asd412id/mcp-context-manager"]
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Cursor
|
|
28
75
|
|
|
29
|
-
|
|
76
|
+
**Config file location:**
|
|
77
|
+
- **Windows:** `%APPDATA%\Cursor\mcp.json`
|
|
78
|
+
- **macOS:** `~/Library/Application Support/Cursor/mcp.json`
|
|
79
|
+
- **Linux:** `~/.config/Cursor/mcp.json`
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"mcpServers": {
|
|
84
|
+
"context-manager": {
|
|
85
|
+
"command": "npx",
|
|
86
|
+
"args": ["-y", "@asd412id/mcp-context-manager"]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Windsurf
|
|
93
|
+
|
|
94
|
+
**Config file location:**
|
|
95
|
+
- **Windows:** `%USERPROFILE%\.codeium\windsurf\mcp_config.json`
|
|
96
|
+
- **macOS:** `~/.codeium/windsurf/mcp_config.json`
|
|
97
|
+
- **Linux:** `~/.codeium/windsurf/mcp_config.json`
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"mcpServers": {
|
|
102
|
+
"context-manager": {
|
|
103
|
+
"command": "npx",
|
|
104
|
+
"args": ["-y", "@asd412id/mcp-context-manager"]
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Cline (VS Code Extension)
|
|
111
|
+
|
|
112
|
+
**Config file location:**
|
|
113
|
+
- **Windows:** `%APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json`
|
|
114
|
+
- **macOS:** `~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json`
|
|
115
|
+
- **Linux:** `~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json`
|
|
30
116
|
|
|
117
|
+
```json
|
|
118
|
+
{
|
|
119
|
+
"mcpServers": {
|
|
120
|
+
"context-manager": {
|
|
121
|
+
"command": "npx",
|
|
122
|
+
"args": ["-y", "@asd412id/mcp-context-manager"],
|
|
123
|
+
"disabled": false,
|
|
124
|
+
"alwaysAllow": []
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Continue (VS Code / JetBrains Extension)
|
|
131
|
+
|
|
132
|
+
**Config file:** `~/.continue/config.json`
|
|
133
|
+
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"mcpServers": [
|
|
137
|
+
{
|
|
138
|
+
"name": "context-manager",
|
|
139
|
+
"command": "npx",
|
|
140
|
+
"args": ["-y", "@asd412id/mcp-context-manager"]
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Or using YAML (`~/.continue/config.yaml`):
|
|
147
|
+
|
|
148
|
+
```yaml
|
|
149
|
+
mcpServers:
|
|
150
|
+
- name: context-manager
|
|
151
|
+
command: npx
|
|
152
|
+
args:
|
|
153
|
+
- "-y"
|
|
154
|
+
- "@asd412id/mcp-context-manager"
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### OpenCode
|
|
158
|
+
|
|
159
|
+
**Config file:** `opencode.json` in your project root or `~/.config/opencode/config.json`
|
|
160
|
+
|
|
161
|
+
```jsonc
|
|
162
|
+
{
|
|
163
|
+
"$schema": "https://opencode.ai/config.json",
|
|
164
|
+
"mcp": {
|
|
165
|
+
"context-manager": {
|
|
166
|
+
"type": "local",
|
|
167
|
+
"command": ["npx", "-y", "@asd412id/mcp-context-manager"],
|
|
168
|
+
"enabled": true
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Zed Editor
|
|
175
|
+
|
|
176
|
+
**Config file:** `~/.config/zed/settings.json`
|
|
177
|
+
|
|
178
|
+
```json
|
|
179
|
+
{
|
|
180
|
+
"context_servers": {
|
|
181
|
+
"context-manager": {
|
|
182
|
+
"command": "npx",
|
|
183
|
+
"args": ["-y", "@asd412id/mcp-context-manager"],
|
|
184
|
+
"env": {}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Custom Context Path
|
|
191
|
+
|
|
192
|
+
To specify a custom path for storing context data, add environment variables.
|
|
193
|
+
|
|
194
|
+
**Claude Desktop / Cursor / Windsurf / Cline:**
|
|
31
195
|
```json
|
|
32
196
|
{
|
|
33
197
|
"mcpServers": {
|
|
@@ -42,35 +206,73 @@ Tambahkan ke `claude_desktop_config.json`:
|
|
|
42
206
|
}
|
|
43
207
|
```
|
|
44
208
|
|
|
45
|
-
|
|
209
|
+
**OpenCode:**
|
|
210
|
+
```jsonc
|
|
211
|
+
{
|
|
212
|
+
"$schema": "https://opencode.ai/config.json",
|
|
213
|
+
"mcp": {
|
|
214
|
+
"context-manager": {
|
|
215
|
+
"type": "local",
|
|
216
|
+
"command": ["npx", "-y", "@asd412id/mcp-context-manager"],
|
|
217
|
+
"environment": {
|
|
218
|
+
"MCP_CONTEXT_PATH": "/path/to/your/project/.context"
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
```
|
|
46
224
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
225
|
+
**Zed:**
|
|
226
|
+
```json
|
|
227
|
+
{
|
|
228
|
+
"context_servers": {
|
|
229
|
+
"context-manager": {
|
|
230
|
+
"command": "npx",
|
|
231
|
+
"args": ["-y", "@asd412id/mcp-context-manager"],
|
|
232
|
+
"env": {
|
|
233
|
+
"MCP_CONTEXT_PATH": "/path/to/your/project/.context"
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## Prompts (Shortcut Commands)
|
|
50
241
|
|
|
51
|
-
|
|
242
|
+
| Prompt | Description |
|
|
243
|
+
|--------|-------------|
|
|
244
|
+
| `ctx-init` | Load context from previous session |
|
|
245
|
+
| `ctx-save` | Save current state to checkpoint |
|
|
246
|
+
| `ctx-remember` | Save important info to memory |
|
|
247
|
+
| `ctx-todo` | Add a todo item |
|
|
248
|
+
| `ctx-decide` | Log a decision |
|
|
249
|
+
| `ctx-status` | Show project status |
|
|
250
|
+
| `ctx-compress` | Compress long context |
|
|
251
|
+
| `ctx-recall` | Search in memory |
|
|
52
252
|
|
|
53
|
-
|
|
253
|
+
## Available Tools (25 tools)
|
|
254
|
+
|
|
255
|
+
### Memory Store
|
|
54
256
|
|
|
55
257
|
| Tool | Description |
|
|
56
258
|
|------|-------------|
|
|
57
|
-
| `memory_set` |
|
|
58
|
-
| `memory_get` |
|
|
59
|
-
| `memory_search` |
|
|
60
|
-
| `memory_delete` |
|
|
61
|
-
| `memory_list` | List
|
|
259
|
+
| `memory_set` | Store key-value in memory |
|
|
260
|
+
| `memory_get` | Retrieve value from memory |
|
|
261
|
+
| `memory_search` | Search memory by pattern/tags |
|
|
262
|
+
| `memory_delete` | Delete memory entry |
|
|
263
|
+
| `memory_list` | List all memory keys |
|
|
62
264
|
| `memory_clear` | Clear memory (all/by tags) |
|
|
63
265
|
|
|
64
|
-
### Context Summarizer
|
|
266
|
+
### Context Summarizer
|
|
65
267
|
|
|
66
268
|
| Tool | Description |
|
|
67
269
|
|------|-------------|
|
|
68
|
-
| `context_summarize` |
|
|
69
|
-
| `context_get_summary` |
|
|
70
|
-
| `context_list_summaries` | List
|
|
71
|
-
| `context_merge_summaries` |
|
|
270
|
+
| `context_summarize` | Summarize text, extract key points, decisions, action items |
|
|
271
|
+
| `context_get_summary` | Get summary by ID |
|
|
272
|
+
| `context_list_summaries` | List all summaries |
|
|
273
|
+
| `context_merge_summaries` | Merge multiple summaries |
|
|
72
274
|
|
|
73
|
-
### Project Tracker
|
|
275
|
+
### Project Tracker
|
|
74
276
|
|
|
75
277
|
| Tool | Description |
|
|
76
278
|
|------|-------------|
|
|
@@ -81,7 +283,7 @@ Tambahkan ke `claude_desktop_config.json`:
|
|
|
81
283
|
| `tracker_set_project` | Set project name |
|
|
82
284
|
| `tracker_export` | Export tracker as markdown |
|
|
83
285
|
|
|
84
|
-
### Session Checkpoint
|
|
286
|
+
### Session Checkpoint
|
|
85
287
|
|
|
86
288
|
| Tool | Description |
|
|
87
289
|
|------|-------------|
|
|
@@ -91,7 +293,7 @@ Tambahkan ke `claude_desktop_config.json`:
|
|
|
91
293
|
| `checkpoint_delete` | Delete checkpoint |
|
|
92
294
|
| `checkpoint_compare` | Compare 2 checkpoints |
|
|
93
295
|
|
|
94
|
-
### Smart File Loader
|
|
296
|
+
### Smart File Loader
|
|
95
297
|
|
|
96
298
|
| Tool | Description |
|
|
97
299
|
|------|-------------|
|
|
@@ -100,84 +302,88 @@ Tambahkan ke `claude_desktop_config.json`:
|
|
|
100
302
|
| `file_search_content` | Search pattern in file |
|
|
101
303
|
| `file_list_dir` | List directory files |
|
|
102
304
|
|
|
305
|
+
## Environment Variables
|
|
306
|
+
|
|
307
|
+
| Variable | Description | Default |
|
|
308
|
+
|----------|-------------|---------|
|
|
309
|
+
| `MCP_CONTEXT_PATH` | Path to store context data | `{cwd}/.context` |
|
|
310
|
+
|
|
103
311
|
## Usage Examples
|
|
104
312
|
|
|
105
|
-
###
|
|
313
|
+
### Session Start Workflow
|
|
106
314
|
|
|
107
315
|
```
|
|
108
|
-
|
|
109
|
-
|
|
316
|
+
User: ctx-init
|
|
317
|
+
AI: *runs checkpoint_load(), tracker_status(), memory_list()*
|
|
318
|
+
```
|
|
110
319
|
|
|
111
|
-
|
|
112
|
-
memory_get({ key: "api_base_url" })
|
|
320
|
+
### Save Important Information
|
|
113
321
|
|
|
114
|
-
|
|
115
|
-
|
|
322
|
+
```
|
|
323
|
+
User: ctx-remember what:"API endpoint at https://api.example.com"
|
|
324
|
+
AI: *saves to memory with appropriate key and tags*
|
|
116
325
|
```
|
|
117
326
|
|
|
118
|
-
###
|
|
327
|
+
### Before Ending Session
|
|
119
328
|
|
|
120
329
|
```
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
text: "..long conversation..",
|
|
124
|
-
maxLength: 2000,
|
|
125
|
-
sessionId: "session-123"
|
|
126
|
-
})
|
|
127
|
-
|
|
128
|
-
// Merge multiple summaries
|
|
129
|
-
context_merge_summaries({ ids: ["sum_1", "sum_2", "sum_3"] })
|
|
330
|
+
User: ctx-save name:"feature-login-done"
|
|
331
|
+
AI: *creates checkpoint with current state*
|
|
130
332
|
```
|
|
131
333
|
|
|
132
|
-
###
|
|
334
|
+
### When Context Gets Long
|
|
133
335
|
|
|
134
336
|
```
|
|
135
|
-
|
|
136
|
-
|
|
337
|
+
User: ctx-compress
|
|
338
|
+
AI: *summarize conversation, save checkpoint, store key info*
|
|
339
|
+
```
|
|
137
340
|
|
|
138
|
-
|
|
139
|
-
tracker_log({ type: "todo", content: "Implement user authentication" })
|
|
341
|
+
## Best Practices
|
|
140
342
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
343
|
+
1. **Session start** - Always run `ctx-init` to load previous context
|
|
344
|
+
2. **Save decisions** - Use `ctx-decide` for every important decision
|
|
345
|
+
3. **Track todos** - Use `ctx-todo` for tasks to be done
|
|
346
|
+
4. **Checkpoint regularly** - Run `ctx-save` every ~15-20 messages or after milestones
|
|
347
|
+
5. **Compress when long** - Use `ctx-compress` if chat gets too long
|
|
144
348
|
|
|
145
|
-
|
|
349
|
+
## Data Storage
|
|
146
350
|
|
|
147
|
-
|
|
148
|
-
// Save checkpoint before major changes
|
|
149
|
-
checkpoint_save({
|
|
150
|
-
name: "before-refactor",
|
|
151
|
-
description: "Completed user module, starting refactor",
|
|
152
|
-
state: { currentTask: "refactoring", completedFiles: ["user.ts"] },
|
|
153
|
-
files: ["src/user.ts", "src/auth.ts"]
|
|
154
|
-
})
|
|
351
|
+
All data is stored in `.context/` folder (default: working directory):
|
|
155
352
|
|
|
156
|
-
|
|
157
|
-
|
|
353
|
+
```
|
|
354
|
+
.context/
|
|
355
|
+
├── memory.json # Memory store
|
|
356
|
+
├── tracker.json # Project tracker
|
|
357
|
+
├── checkpoints/ # Session checkpoints
|
|
358
|
+
│ ├── index.json
|
|
359
|
+
│ └── cp_*.json
|
|
360
|
+
└── summaries/ # Context summaries
|
|
361
|
+
└── index.json
|
|
158
362
|
```
|
|
159
363
|
|
|
160
|
-
|
|
364
|
+
## Troubleshooting
|
|
161
365
|
|
|
162
|
-
|
|
163
|
-
// Read only code structure
|
|
164
|
-
file_smart_read({ path: "src/index.ts", structureOnly: true })
|
|
366
|
+
### Server not starting
|
|
165
367
|
|
|
166
|
-
|
|
167
|
-
|
|
368
|
+
1. Make sure Node.js >= 18 is installed: `node --version`
|
|
369
|
+
2. Try running manually: `npx @asd412id/mcp-context-manager`
|
|
370
|
+
3. Check if port/process conflicts exist
|
|
168
371
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
372
|
+
### Tools not appearing
|
|
373
|
+
|
|
374
|
+
1. Restart your MCP client after configuration changes
|
|
375
|
+
2. Check config file syntax (valid JSON)
|
|
376
|
+
3. Verify the config file location is correct for your client
|
|
172
377
|
|
|
173
|
-
|
|
378
|
+
### Permission issues
|
|
174
379
|
|
|
175
|
-
1.
|
|
176
|
-
2.
|
|
177
|
-
3. **Summarize conversation** secara berkala
|
|
178
|
-
4. **Track decisions** agar tidak perlu explain ulang
|
|
179
|
-
5. **Load file secara smart** - hanya bagian yang diperlukan
|
|
380
|
+
1. Ensure write access to the context path
|
|
381
|
+
2. Try setting explicit `MCP_CONTEXT_PATH` in env
|
|
180
382
|
|
|
181
383
|
## License
|
|
182
384
|
|
|
183
385
|
MIT
|
|
386
|
+
|
|
387
|
+
## Contributing
|
|
388
|
+
|
|
389
|
+
Issues and PRs welcome at [GitHub](https://github.com/asd412id/mcp-context-manager)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asd412id/mcp-context-manager",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "MCP tools for context management - summarizer, memory store, project tracker, checkpoints, and smart file loader",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|