@memextend/cursor 0.1.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 ADDED
@@ -0,0 +1,411 @@
1
+ # @memextend/cursor
2
+
3
+ > Cursor IDE adapter for memextend - persistent AI memory across sessions
4
+
5
+ ## Overview
6
+
7
+ This adapter provides memextend integration for [Cursor](https://cursor.sh/), giving Claude persistent memory capabilities within the IDE. Your AI assistant will remember past decisions, code patterns, and context across sessions.
8
+
9
+ **Status:** ⚠️ **Experimental/Untested** - This adapter was developed based on Cursor's MCP documentation but has not been tested in a production Cursor environment. Community feedback and contributions are welcome!
10
+
11
+ ## Features
12
+
13
+ - **MCP Integration**: Native Model Context Protocol server for Cursor
14
+ - **Memory Search**: Semantic and full-text search across past sessions
15
+ - **Memory Save**: Persist important decisions and patterns
16
+ - **Context Injection**: Retrieve relevant context for new sessions
17
+ - **Global Preferences**: Store cross-project preferences and patterns
18
+ - **CLI Tools**: Manual capture and injection for workflow automation
19
+
20
+ ## Quick Start
21
+
22
+ ### Prerequisites
23
+
24
+ 1. [Cursor IDE](https://cursor.sh/) installed and run at least once
25
+ 2. [memextend](https://github.com/your-repo/memextend) initialized:
26
+ ```bash
27
+ npm install -g memextend
28
+ memextend init
29
+ ```
30
+
31
+ ### Installation
32
+
33
+ ```bash
34
+ npm install @memextend/cursor
35
+ ```
36
+
37
+ ### Setup
38
+
39
+ Run the automatic setup:
40
+
41
+ ```bash
42
+ npx memextend-cursor setup
43
+ ```
44
+
45
+ This will configure Cursor's MCP settings to use the memextend server.
46
+
47
+ **Then restart Cursor** to load the new MCP server.
48
+
49
+ ### Usage
50
+
51
+ Once set up, Claude in Cursor has access to memory tools:
52
+
53
+ ```
54
+ "Search my memories for authentication patterns"
55
+ "Save this decision: Using JWT for API auth with 24h expiry"
56
+ "What did I work on in this project recently?"
57
+ ```
58
+
59
+ ## Detailed Setup
60
+
61
+ ### Automatic Setup
62
+
63
+ The `memextend-cursor setup` command will:
64
+
65
+ 1. Locate your Cursor configuration directory
66
+ 2. Add the memextend MCP server to `~/.cursor/mcp.json`
67
+ 3. Provide instructions for restarting Cursor
68
+
69
+ ### Manual Setup
70
+
71
+ If automatic setup fails, manually edit `~/.cursor/mcp.json`:
72
+
73
+ ```json
74
+ {
75
+ "mcpServers": {
76
+ "memextend": {
77
+ "command": "node",
78
+ "args": ["/path/to/node_modules/@memextend/cursor/dist/mcp/server.cjs"]
79
+ }
80
+ }
81
+ }
82
+ ```
83
+
84
+ Find the exact path with:
85
+ ```bash
86
+ npm root -g # For global install
87
+ npm root # For local install
88
+ ```
89
+
90
+ ### Configuration File Locations
91
+
92
+ Cursor stores MCP configuration in platform-specific locations:
93
+
94
+ | Platform | Path |
95
+ |----------|------|
96
+ | macOS | `~/.cursor/mcp.json` or `~/Library/Application Support/Cursor/User/mcp.json` |
97
+ | Linux | `~/.cursor/mcp.json` or `~/.config/Cursor/User/mcp.json` |
98
+ | Windows | `%USERPROFILE%\.cursor\mcp.json` or `%APPDATA%\Cursor\User\mcp.json` |
99
+
100
+ ## Available MCP Tools
101
+
102
+ When the MCP server is running, Claude has access to these tools:
103
+
104
+ ### `memextend_search`
105
+ Search through your memories using semantic and full-text search.
106
+
107
+ **Parameters:**
108
+ - `query` (required): Search query - natural language works best
109
+ - `limit` (optional): Max results (default: 5, max: 20)
110
+ - `project_only` (optional): Only search current project
111
+
112
+ **Example prompts:**
113
+ - "Search my memories for Redis caching"
114
+ - "Find past work on authentication"
115
+
116
+ ### `memextend_save`
117
+ Save a memory for the current project.
118
+
119
+ **Parameters:**
120
+ - `content` (required): Memory content to save
121
+ - `tags` (optional): Array of tags for categorization
122
+
123
+ **Example prompts:**
124
+ - "Save this: We use PostgreSQL with Prisma ORM"
125
+ - "Remember that the API rate limit is 100 req/min"
126
+
127
+ ### `memextend_save_global`
128
+ Save a preference that applies across all projects.
129
+
130
+ **Parameters:**
131
+ - `content` (required): The preference or fact
132
+ - `type` (required): One of `preference`, `pattern`, or `fact`
133
+
134
+ **Example prompts:**
135
+ - "Save global preference: I prefer functional React components"
136
+ - "Remember globally: Always use TypeScript strict mode"
137
+
138
+ ### `memextend_recall`
139
+ Get recent context for the current project.
140
+
141
+ **Parameters:**
142
+ - `days` (optional): Days to look back (default: 7)
143
+ - `include_global` (optional): Include global preferences (default: true)
144
+
145
+ **Example prompts:**
146
+ - "What have I worked on recently in this project?"
147
+ - "Recall my context for this codebase"
148
+
149
+ ### `memextend_status`
150
+ Get memextend status and statistics.
151
+
152
+ ### `memextend_forget`
153
+ Delete a specific memory by ID.
154
+
155
+ ## CLI Tools
156
+
157
+ For workflow automation or manual operations, CLI tools are available:
158
+
159
+ ### memextend-cursor
160
+
161
+ Main CLI with subcommands:
162
+
163
+ ```bash
164
+ # Configure Cursor
165
+ memextend-cursor setup
166
+
167
+ # Check status
168
+ memextend-cursor status
169
+
170
+ # Capture memory
171
+ memextend-cursor capture -c "Implemented user authentication"
172
+
173
+ # Get context
174
+ memextend-cursor inject
175
+ ```
176
+
177
+ ### memextend-cursor-capture
178
+
179
+ Capture content to memory:
180
+
181
+ ```bash
182
+ # Direct content
183
+ memextend-cursor-capture -c "Implemented Redis caching for sessions"
184
+
185
+ # From file
186
+ memextend-cursor-capture -f session-notes.txt
187
+
188
+ # From stdin (pipe from other tools)
189
+ echo "Fixed authentication bug" | memextend-cursor-capture --stdin
190
+
191
+ # With workspace context
192
+ memextend-cursor-capture -c "Added API endpoints" -w /path/to/project
193
+ ```
194
+
195
+ ### memextend-cursor-inject
196
+
197
+ Retrieve context for sessions:
198
+
199
+ ```bash
200
+ # Get context for current directory
201
+ memextend-cursor-inject
202
+
203
+ # Extended history
204
+ memextend-cursor-inject --days 30 --limit 20
205
+
206
+ # Copy to clipboard
207
+ memextend-cursor-inject --clipboard
208
+
209
+ # JSON output for scripting
210
+ memextend-cursor-inject --format json
211
+ ```
212
+
213
+ ## Cursor Integration Tips
214
+
215
+ ### Starting a Session
216
+
217
+ At the start of a Cursor session, ask Claude:
218
+
219
+ > "Recall my context for this project"
220
+
221
+ This will retrieve recent memories and preferences.
222
+
223
+ ### During Development
224
+
225
+ Save important decisions as you make them:
226
+
227
+ > "Save this decision: Using event sourcing for order processing"
228
+
229
+ Search when you need to remember:
230
+
231
+ > "Search memories for how we handle error logging"
232
+
233
+ ### Ending a Session
234
+
235
+ Before closing, save a summary:
236
+
237
+ > "Save summary: Today I implemented the payment processing module with Stripe integration"
238
+
239
+ ### Keyboard Shortcuts (Optional)
240
+
241
+ You can create Cursor tasks to run CLI commands. Add to `.cursor/tasks.json`:
242
+
243
+ ```json
244
+ {
245
+ "version": "2.0.0",
246
+ "tasks": [
247
+ {
248
+ "label": "memextend: Get Context",
249
+ "type": "shell",
250
+ "command": "memextend-cursor-inject --clipboard",
251
+ "problemMatcher": []
252
+ },
253
+ {
254
+ "label": "memextend: Quick Save",
255
+ "type": "shell",
256
+ "command": "memextend-cursor-capture -c \"${input:memory}\"",
257
+ "problemMatcher": []
258
+ }
259
+ ],
260
+ "inputs": [
261
+ {
262
+ "id": "memory",
263
+ "type": "promptString",
264
+ "description": "Memory content to save"
265
+ }
266
+ ]
267
+ }
268
+ ```
269
+
270
+ ## Limitations
271
+
272
+ ### vs Claude Code
273
+
274
+ Unlike the Claude Code adapter which has native session hooks, Cursor integration has some limitations:
275
+
276
+ 1. **No automatic session capture**: Cursor doesn't expose session lifecycle events. You must explicitly save memories or use CLI tools.
277
+
278
+ 2. **No automatic context injection**: Context isn't automatically injected at session start. Use the `memextend_recall` tool or CLI.
279
+
280
+ 3. **Workspace detection**: The MCP server uses environment variables and cwd to detect the workspace. This usually works but may be inconsistent in some setups.
281
+
282
+ ### Workarounds
283
+
284
+ - **Session capture**: Use `memextend-cursor-capture` in your development workflow
285
+ - **Context injection**: Start sessions with "Recall my context" or run `memextend-cursor-inject`
286
+ - **Automation**: Create shell scripts or Cursor tasks for common operations
287
+
288
+ ## Troubleshooting
289
+
290
+ ### "memextend not initialized"
291
+
292
+ Run:
293
+ ```bash
294
+ memextend init
295
+ ```
296
+
297
+ ### MCP server not working
298
+
299
+ 1. Check if configured:
300
+ ```bash
301
+ memextend-cursor status
302
+ ```
303
+
304
+ 2. Verify the server path exists:
305
+ ```bash
306
+ ls $(npm root)/@memextend/cursor/dist/mcp/server.cjs
307
+ ```
308
+
309
+ 3. Check Cursor's MCP config:
310
+ ```bash
311
+ cat ~/.cursor/mcp.json
312
+ ```
313
+
314
+ 4. Restart Cursor completely (not just reload window)
315
+
316
+ ### Tools not appearing in Cursor
317
+
318
+ 1. Ensure MCP is enabled in Cursor settings
319
+ 2. Restart Cursor after configuration changes
320
+ 3. Check Cursor's developer console for MCP errors
321
+
322
+ ### Workspace detection issues
323
+
324
+ Set the workspace explicitly in the MCP config:
325
+
326
+ ```json
327
+ {
328
+ "mcpServers": {
329
+ "memextend": {
330
+ "command": "node",
331
+ "args": ["/path/to/server.cjs"],
332
+ "env": {
333
+ "CURSOR_WORKSPACE_PATH": "/path/to/your/project"
334
+ }
335
+ }
336
+ }
337
+ }
338
+ ```
339
+
340
+ ## Architecture
341
+
342
+ ```
343
+ @memextend/cursor/
344
+ ├── src/
345
+ │ ├── mcp/ # MCP server for Cursor integration
346
+ │ │ ├── server.ts # Main MCP server with memory tools
347
+ │ │ └── index.ts # MCP exports
348
+ │ ├── cli/ # CLI tools for manual operations
349
+ │ │ ├── index.ts # Main CLI entry point
350
+ │ │ ├── capture.ts # Memory capture tool
351
+ │ │ └── inject.ts # Context injection tool
352
+ │ ├── utils/ # Shared utilities
353
+ │ │ └── index.ts # Common functions and constants
354
+ │ └── index.ts # Package entry point
355
+ ├── scripts/ # Build scripts
356
+ │ ├── build-mcp.js # Bundle MCP server
357
+ │ ├── build-cli.js # Bundle CLI tools
358
+ │ └── postinstall.js # Post-install helper
359
+ ├── dist/ # Built outputs
360
+ │ ├── mcp/ # MCP server (server.cjs)
361
+ │ └── cli/ # CLI tools (*.cjs)
362
+ └── README.md # This file
363
+ ```
364
+
365
+ ## Development
366
+
367
+ ### Building
368
+
369
+ ```bash
370
+ npm run build
371
+ ```
372
+
373
+ This runs:
374
+ 1. TypeScript compilation
375
+ 2. MCP server bundling (esbuild)
376
+ 3. CLI tools bundling (esbuild)
377
+
378
+ ### Testing
379
+
380
+ ```bash
381
+ npm test
382
+ ```
383
+
384
+ ### Local Development
385
+
386
+ ```bash
387
+ # Link for local testing
388
+ npm link
389
+
390
+ # In another terminal
391
+ memextend-cursor status
392
+ ```
393
+
394
+ ## Contributing
395
+
396
+ Contributions welcome! Areas that could use help:
397
+
398
+ - VS Code extension for better session detection
399
+ - Automatic context injection via Cursor's API (if/when available)
400
+ - Better workspace detection heuristics
401
+ - Windows testing and improvements
402
+
403
+ ## License
404
+
405
+ MIT - Copyright (c) 2026 ZodTTD LLC
406
+
407
+ ## See Also
408
+
409
+ - [memextend](https://github.com/your-repo/memextend) - Main project
410
+ - [@memextend/core](../core) - Core memory storage
411
+ - [@memextend/claude-code](../claude-code) - Claude Code adapter (reference implementation)