engram-mcp-server 1.2.0 → 1.2.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 +57 -139
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/index.js +7 -0
- package/dist/installer.d.ts +2 -0
- package/dist/installer.js +141 -0
- package/package.json +3 -2
- package/src/constants.ts +1 -1
- package/src/index.ts +9 -0
- package/src/installer.ts +160 -0
package/README.md
CHANGED
|
@@ -210,209 +210,128 @@ See total sessions, changes, decisions, most-changed files, layer distribution,
|
|
|
210
210
|
|
|
211
211
|
---
|
|
212
212
|
|
|
213
|
-
##
|
|
213
|
+
## Quickstart
|
|
214
214
|
|
|
215
|
-
|
|
216
|
-
- Node.js 18+ installed
|
|
217
|
-
- npm or yarn
|
|
215
|
+
Engram is published to the npm registry. **You do not need to download or compile any code.**
|
|
218
216
|
|
|
219
|
-
|
|
217
|
+
As long as you have Node.js installed, your IDE will download and run the latest version of Engram automatically using `npx`.
|
|
220
218
|
|
|
221
|
-
|
|
222
|
-
# Clone the repository
|
|
223
|
-
git clone git@github.com:keggan-std/Engram.git
|
|
224
|
-
cd Engram
|
|
225
|
-
|
|
226
|
-
# Install dependencies
|
|
227
|
-
npm install
|
|
228
|
-
|
|
229
|
-
# Build
|
|
230
|
-
npm run build
|
|
231
|
-
|
|
232
|
-
# (Optional) Install git hooks for automatic change tracking
|
|
233
|
-
npm run install-hooks
|
|
234
|
-
```
|
|
219
|
+
### Option 1: The Magic Installer (Zero Config)
|
|
235
220
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
Run this after building to automatically add Engram to all supported IDEs detected on your machine:
|
|
221
|
+
Run this single command in your terminal. It will automatically detect your IDEs (Cursor, VS Code, Visual Studio, Cline, Windsurf, Antigravity) and inject the correct configuration for you:
|
|
239
222
|
|
|
240
223
|
```bash
|
|
241
|
-
|
|
224
|
+
npx -y engram-mcp-server --install
|
|
242
225
|
```
|
|
243
226
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
To preview which IDEs were detected before installing:
|
|
227
|
+
*(You can also run `npx -y engram-mcp-server --list` to see what IDEs it detects before installing)*
|
|
247
228
|
|
|
248
|
-
|
|
249
|
-
npm run install-mcp:list
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
To add to a specific IDE only:
|
|
253
|
-
|
|
254
|
-
```bash
|
|
255
|
-
node scripts/install-mcp.js --ide antigravity
|
|
256
|
-
node scripts/install-mcp.js --ide cursor
|
|
257
|
-
node scripts/install-mcp.js --ide vscode
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
### Verify it works
|
|
261
|
-
|
|
262
|
-
```bash
|
|
263
|
-
# Test with MCP Inspector
|
|
264
|
-
npm run inspect
|
|
265
|
-
```
|
|
229
|
+
Restart your IDE, and Engram is ready!
|
|
266
230
|
|
|
267
231
|
---
|
|
268
232
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
> [!TIP]
|
|
272
|
-
> **Quickest way**: Run `npm run install-mcp` after building — it auto-detects your IDEs and writes the config for you. Restart your IDE after.
|
|
233
|
+
### Option 2: Manual Configuration
|
|
273
234
|
|
|
274
235
|
If you prefer to configure manually, find your IDE below and paste the config snippet.
|
|
275
236
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
1. Click the **`...`** menu at the top of the Agent panel
|
|
279
|
-
2. Select **MCP Servers → Manage MCP Servers**
|
|
280
|
-
3. Click **"View raw config"**
|
|
281
|
-
4. Add the `engram` block inside `"mcpServers"`:
|
|
282
|
-
|
|
237
|
+
#### Cline / Roo Code
|
|
238
|
+
In the extension settings → MCP Servers:
|
|
283
239
|
```json
|
|
284
240
|
{
|
|
285
241
|
"mcpServers": {
|
|
286
242
|
"engram": {
|
|
287
|
-
"command": "
|
|
288
|
-
"args": ["
|
|
289
|
-
"env": {}
|
|
243
|
+
"command": "npx",
|
|
244
|
+
"args": ["-y", "engram-mcp-server"]
|
|
290
245
|
}
|
|
291
246
|
}
|
|
292
247
|
}
|
|
293
248
|
```
|
|
294
249
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
Add to `~/.claude.json` or your project's `.claude/settings.json`:
|
|
250
|
+
#### Cursor
|
|
251
|
+
1. Go to **Cursor Settings** → **Features** → **MCP**
|
|
252
|
+
2. Click **+ Add new MCP server**
|
|
253
|
+
3. Select **command** type
|
|
254
|
+
4. Name: `engram`
|
|
255
|
+
5. Command: `npx -y engram-mcp-server`
|
|
302
256
|
|
|
257
|
+
#### Claude Desktop
|
|
258
|
+
Add to your `claude_desktop_config.json`:
|
|
303
259
|
```json
|
|
304
260
|
{
|
|
305
261
|
"mcpServers": {
|
|
306
262
|
"engram": {
|
|
307
|
-
"command": "
|
|
308
|
-
"args": ["
|
|
263
|
+
"command": "npx",
|
|
264
|
+
"args": ["-y", "engram-mcp-server"]
|
|
309
265
|
}
|
|
310
266
|
}
|
|
311
267
|
}
|
|
312
268
|
```
|
|
313
269
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
In Cursor Settings → Features → MCP Servers, add:
|
|
317
|
-
|
|
318
|
-
```json
|
|
319
|
-
{
|
|
320
|
-
"engram": {
|
|
321
|
-
"command": "node",
|
|
322
|
-
"args": ["/absolute/path/to/Engram/dist/index.js"]
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
### VS Code (with GitHub Copilot)
|
|
328
|
-
|
|
270
|
+
#### VS Code (with GitHub Copilot)
|
|
329
271
|
Create `.vscode/mcp.json` in your project root:
|
|
330
|
-
|
|
331
272
|
```json
|
|
332
273
|
{
|
|
333
274
|
"servers": {
|
|
334
275
|
"engram": {
|
|
335
276
|
"type": "stdio",
|
|
336
|
-
"command": "
|
|
337
|
-
"args": ["
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
Or add to your user `settings.json` to make Engram available across all workspaces:
|
|
344
|
-
|
|
345
|
-
```json
|
|
346
|
-
{
|
|
347
|
-
"mcp": {
|
|
348
|
-
"servers": {
|
|
349
|
-
"engram": {
|
|
350
|
-
"type": "stdio",
|
|
351
|
-
"command": "node",
|
|
352
|
-
"args": ["/absolute/path/to/Engram/dist/index.js"]
|
|
353
|
-
}
|
|
277
|
+
"command": "npx",
|
|
278
|
+
"args": ["-y", "engram-mcp-server"]
|
|
354
279
|
}
|
|
355
280
|
}
|
|
356
281
|
}
|
|
357
282
|
```
|
|
283
|
+
Or add to your user `settings.json` to make it available across all workspaces.
|
|
358
284
|
|
|
359
|
-
|
|
360
|
-
|
|
285
|
+
#### Visual Studio 2022/2026
|
|
361
286
|
Create `.vs/mcp.json` in your solution root:
|
|
362
|
-
|
|
363
287
|
```json
|
|
364
288
|
{
|
|
365
289
|
"servers": {
|
|
366
290
|
"engram": {
|
|
367
291
|
"type": "stdio",
|
|
368
|
-
"command": "
|
|
369
|
-
"args": ["
|
|
292
|
+
"command": "npx",
|
|
293
|
+
"args": ["-y", "engram-mcp-server"]
|
|
370
294
|
}
|
|
371
295
|
}
|
|
372
296
|
}
|
|
373
297
|
```
|
|
298
|
+
Or create a global config at `%USERPROFILE%\.mcp.json`. Note: Server names in Visual Studio must not contain spaces.
|
|
374
299
|
|
|
375
|
-
|
|
376
|
-
|
|
300
|
+
#### Windsurf
|
|
301
|
+
In Settings → MCP:
|
|
377
302
|
```json
|
|
378
303
|
{
|
|
379
|
-
"
|
|
304
|
+
"mcpServers": {
|
|
380
305
|
"engram": {
|
|
381
|
-
"
|
|
382
|
-
"
|
|
383
|
-
"args": ["/absolute/path/to/Engram/dist/index.js"]
|
|
306
|
+
"command": "npx",
|
|
307
|
+
"args": ["-y", "engram-mcp-server"]
|
|
384
308
|
}
|
|
385
309
|
}
|
|
386
310
|
}
|
|
387
311
|
```
|
|
388
312
|
|
|
389
|
-
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
### 2. Auto-Updates
|
|
316
|
+
Because the configuration uses `npx -y engram-mcp-server`, your agent will **automatically fetch the latest version** of Engram from the npm registry every time it starts. You never have to manually update or run `git pull` again!
|
|
390
317
|
|
|
391
|
-
|
|
318
|
+
---
|
|
392
319
|
|
|
393
|
-
|
|
320
|
+
### 3. Optional: Build from Source
|
|
321
|
+
If you prefer to run Engram locally instead of fetching it via `npx` (e.g. for contributing to the repository):
|
|
394
322
|
|
|
323
|
+
```bash
|
|
324
|
+
git clone https://github.com/keggan-std/Engram.git
|
|
325
|
+
cd Engram
|
|
326
|
+
npm install
|
|
327
|
+
npm run build
|
|
328
|
+
```
|
|
329
|
+
Then, point your MCP configuration to the local `dist/index.js` file instead of using `npx`:
|
|
395
330
|
```json
|
|
396
331
|
{
|
|
397
332
|
"engram": {
|
|
398
333
|
"command": "node",
|
|
399
|
-
"args": ["/absolute/path/to/Engram/dist/index.js"]
|
|
400
|
-
"disabled": false
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
```
|
|
404
|
-
|
|
405
|
-
### Windsurf
|
|
406
|
-
|
|
407
|
-
In Settings → MCP:
|
|
408
|
-
|
|
409
|
-
```json
|
|
410
|
-
{
|
|
411
|
-
"mcpServers": {
|
|
412
|
-
"engram": {
|
|
413
|
-
"command": "node",
|
|
414
|
-
"args": ["/absolute/path/to/Engram/dist/index.js"]
|
|
415
|
-
}
|
|
334
|
+
"args": ["/absolute/path/to/Engram/dist/index.js"]
|
|
416
335
|
}
|
|
417
336
|
}
|
|
418
337
|
```
|
|
@@ -473,15 +392,14 @@ New machine:
|
|
|
473
392
|
|
|
474
393
|
---
|
|
475
394
|
|
|
476
|
-
## Migration from v1.0.0
|
|
395
|
+
## Migration from v1.0.0 (sql.js)
|
|
396
|
+
|
|
397
|
+
If you're upgrading from the original `sql.js` version (v1.0.0) to native SQLite:
|
|
477
398
|
|
|
478
|
-
|
|
399
|
+
1. Follow the **Quickstart** above to update your agent's MCP config to use `npx -y engram-mcp-server`
|
|
400
|
+
2. Restart your IDE
|
|
479
401
|
|
|
480
|
-
|
|
481
|
-
2. **Run `npm install` to get the new dependencies** (better-sqlite3 replaces sql.js)
|
|
482
|
-
3. **Run `npm run build`**
|
|
483
|
-
4. The migration system will automatically upgrade your schema on first startup — adding FTS5 indexes, config table, and composite indexes
|
|
484
|
-
5. Your existing data is preserved and immediately searchable via FTS5
|
|
402
|
+
**That's it.** Your existing `.engram/memory.db` files are fully compatible. The migration system will automatically upgrade your schema on first startup — adding FTS5 indexes, the config table, composite indexes, and the new scheduled events tables. Your existing data is preserved and instantly searchable.
|
|
485
403
|
|
|
486
404
|
---
|
|
487
405
|
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const SERVER_NAME = "engram-mcp-server";
|
|
2
|
-
export declare const SERVER_VERSION = "1.2.
|
|
2
|
+
export declare const SERVER_VERSION = "1.2.2";
|
|
3
3
|
export declare const TOOL_PREFIX = "engram";
|
|
4
4
|
export declare const DB_DIR_NAME = ".engram";
|
|
5
5
|
export declare const DB_FILE_NAME = "memory.db";
|
package/dist/constants.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Engram MCP Server — Constants
|
|
3
3
|
// ============================================================================
|
|
4
4
|
export const SERVER_NAME = "engram-mcp-server";
|
|
5
|
-
export const SERVER_VERSION = "1.2.
|
|
5
|
+
export const SERVER_VERSION = "1.2.2";
|
|
6
6
|
export const TOOL_PREFIX = "engram";
|
|
7
7
|
// Database
|
|
8
8
|
export const DB_DIR_NAME = ".engram";
|
package/dist/index.js
CHANGED
|
@@ -17,6 +17,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
17
17
|
import { SERVER_NAME, SERVER_VERSION } from "./constants.js";
|
|
18
18
|
import { initDatabase } from "./database.js";
|
|
19
19
|
import { findProjectRoot } from "./utils.js";
|
|
20
|
+
import { runInstaller } from "./installer.js";
|
|
20
21
|
// Tool registrations
|
|
21
22
|
import { registerSessionTools } from "./tools/sessions.js";
|
|
22
23
|
import { registerMemoryTools } from "./tools/memory.js";
|
|
@@ -26,6 +27,12 @@ import { registerMaintenanceTools } from "./tools/maintenance.js";
|
|
|
26
27
|
import { registerSchedulerTools } from "./tools/scheduler.js";
|
|
27
28
|
// ─── Initialize ───────────────────────────────────────────────────────
|
|
28
29
|
async function main() {
|
|
30
|
+
const args = process.argv.slice(2);
|
|
31
|
+
// ─── Auto-Installer ───────────────────────────────────────────────────
|
|
32
|
+
if (args.includes("install") || args.includes("--install") || args.includes("--list")) {
|
|
33
|
+
runInstaller(args);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
29
36
|
// Detect project root
|
|
30
37
|
const projectRoot = findProjectRoot();
|
|
31
38
|
console.error(`[Engram] Project root: ${projectRoot}`);
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import os from "os";
|
|
4
|
+
const HOME = os.homedir();
|
|
5
|
+
const APPDATA = process.env.APPDATA || path.join(HOME, ".config");
|
|
6
|
+
// ─── IDE Config Locations ────────────────────────────────────────────
|
|
7
|
+
const IDE_CONFIGS = {
|
|
8
|
+
antigravity: {
|
|
9
|
+
name: "Antigravity IDE",
|
|
10
|
+
paths: [
|
|
11
|
+
path.join(HOME, ".gemini", "antigravity", "mcp_config.json"),
|
|
12
|
+
],
|
|
13
|
+
format: "mcpServers",
|
|
14
|
+
},
|
|
15
|
+
cursor: {
|
|
16
|
+
name: "Cursor",
|
|
17
|
+
paths: [
|
|
18
|
+
path.join(HOME, ".cursor", "mcp.json"),
|
|
19
|
+
path.join(APPDATA, "Cursor", "mcp.json"),
|
|
20
|
+
],
|
|
21
|
+
format: "mcpServers",
|
|
22
|
+
},
|
|
23
|
+
vscode: {
|
|
24
|
+
name: "VS Code (Copilot)",
|
|
25
|
+
paths: [
|
|
26
|
+
path.join(APPDATA, "Code", "User", "mcp.json"),
|
|
27
|
+
path.join(HOME, ".vscode", "mcp.json"),
|
|
28
|
+
],
|
|
29
|
+
format: "servers",
|
|
30
|
+
},
|
|
31
|
+
cline: {
|
|
32
|
+
name: "Cline / Roo Code",
|
|
33
|
+
paths: [
|
|
34
|
+
path.join(APPDATA, "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"),
|
|
35
|
+
path.join(HOME, ".cline", "mcp_settings.json"),
|
|
36
|
+
],
|
|
37
|
+
format: "mcpServers",
|
|
38
|
+
},
|
|
39
|
+
windsurf: {
|
|
40
|
+
name: "Windsurf",
|
|
41
|
+
paths: [
|
|
42
|
+
path.join(HOME, ".codeium", "windsurf", "mcp_config.json"),
|
|
43
|
+
path.join(APPDATA, "Windsurf", "mcp.json"),
|
|
44
|
+
],
|
|
45
|
+
format: "mcpServers",
|
|
46
|
+
},
|
|
47
|
+
visualstudio: {
|
|
48
|
+
name: "Visual Studio 2022",
|
|
49
|
+
paths: [
|
|
50
|
+
path.join(HOME, ".mcp.json"), // Global config for Visual Studio
|
|
51
|
+
],
|
|
52
|
+
format: "servers",
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
// ─── Engram Entry ────────────────────────────────────────────────────
|
|
56
|
+
function makeEngramEntry(format) {
|
|
57
|
+
const entry = {
|
|
58
|
+
command: "npx",
|
|
59
|
+
args: ["-y", "engram-mcp-server"],
|
|
60
|
+
};
|
|
61
|
+
if (format === "servers") {
|
|
62
|
+
// VS Code uses a slightly different shape
|
|
63
|
+
return { type: "stdio", ...entry };
|
|
64
|
+
}
|
|
65
|
+
return entry;
|
|
66
|
+
}
|
|
67
|
+
// ─── Config Manipulation ─────────────────────────────────────────────
|
|
68
|
+
function readJson(filePath) {
|
|
69
|
+
try {
|
|
70
|
+
return JSON.parse(fs.readFileSync(filePath, "utf-8"));
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function writeJson(filePath, data) {
|
|
77
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
78
|
+
fs.writeFileSync(filePath, JSON.stringify(data, null, 2) + "\n", "utf-8");
|
|
79
|
+
}
|
|
80
|
+
function addToConfig(configPath, format) {
|
|
81
|
+
let config = readJson(configPath) || {};
|
|
82
|
+
const key = format; // "mcpServers" or "servers"
|
|
83
|
+
if (!config[key])
|
|
84
|
+
config[key] = {};
|
|
85
|
+
if (config[key].engram) {
|
|
86
|
+
// Already exists — update to use npx
|
|
87
|
+
config[key].engram = makeEngramEntry(format);
|
|
88
|
+
writeJson(configPath, config);
|
|
89
|
+
return "updated";
|
|
90
|
+
}
|
|
91
|
+
config[key].engram = makeEngramEntry(format);
|
|
92
|
+
writeJson(configPath, config);
|
|
93
|
+
return "added";
|
|
94
|
+
}
|
|
95
|
+
// ─── Main ────────────────────────────────────────────────────────────
|
|
96
|
+
export function runInstaller(args) {
|
|
97
|
+
if (args.includes("--list")) {
|
|
98
|
+
console.log("\nEngram can be auto-installed into these IDEs:\n");
|
|
99
|
+
for (const [id, ide] of Object.entries(IDE_CONFIGS)) {
|
|
100
|
+
const found = ide.paths.find((p) => fs.existsSync(p) || fs.existsSync(path.dirname(p)));
|
|
101
|
+
console.log(` ${id.padEnd(15)} ${ide.name} ${found ? "✅ detected" : "❌ not found"}`);
|
|
102
|
+
}
|
|
103
|
+
process.exit(0);
|
|
104
|
+
}
|
|
105
|
+
// Specific IDE requested?
|
|
106
|
+
const ideFlagIdx = args.indexOf("--ide");
|
|
107
|
+
const targetIde = ideFlagIdx >= 0 ? args[ideFlagIdx + 1] : null;
|
|
108
|
+
const idesToProcess = targetIde
|
|
109
|
+
? (IDE_CONFIGS[targetIde] ? { [targetIde]: IDE_CONFIGS[targetIde] } : null)
|
|
110
|
+
: IDE_CONFIGS;
|
|
111
|
+
if (!idesToProcess) {
|
|
112
|
+
console.error(`Unknown IDE: "${targetIde}". Options: ${Object.keys(IDE_CONFIGS).join(", ")}`);
|
|
113
|
+
process.exit(1);
|
|
114
|
+
}
|
|
115
|
+
console.log("\n🧠 Engram MCP Installer\n");
|
|
116
|
+
let installed = 0;
|
|
117
|
+
for (const [id, ide] of Object.entries(idesToProcess)) {
|
|
118
|
+
const configPath = ide.paths.find((p) => fs.existsSync(p)) || ide.paths[0];
|
|
119
|
+
try {
|
|
120
|
+
const result = addToConfig(configPath, ide.format);
|
|
121
|
+
console.log(`\n ✅ ${ide.name}`);
|
|
122
|
+
console.log(` Config: ${configPath}`);
|
|
123
|
+
console.log(` Status: ${result === "added" ? "Engram added" : "Engram config updated to use npx"}`);
|
|
124
|
+
installed++;
|
|
125
|
+
}
|
|
126
|
+
catch (e) {
|
|
127
|
+
console.log(`\n ⚠️ ${ide.name}`);
|
|
128
|
+
console.log(` Could not write to: ${configPath}`);
|
|
129
|
+
console.log(` Reason: ${e.message}`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (installed === 0) {
|
|
133
|
+
console.log("\n No supported IDEs were found on this machine.");
|
|
134
|
+
console.log(" Run 'npx -y engram-mcp-server --list' to see what was detected.\n");
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
console.log(`\n✅ Done! Engram configured in ${installed} IDE(s).`);
|
|
138
|
+
console.log(" Restart your IDE(s) to load Engram.\n");
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=installer.js.map
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "engram-mcp-server",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "Engram — Persistent Memory Cortex for AI coding agents. Gives agents session continuity, change tracking, decision logging, and project intelligence across sessions.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"bin": {
|
|
8
|
-
"engram": "dist/index.js"
|
|
8
|
+
"engram": "dist/index.js",
|
|
9
|
+
"engram-mcp-server": "dist/index.js"
|
|
9
10
|
},
|
|
10
11
|
"scripts": {
|
|
11
12
|
"build": "tsc",
|
package/src/constants.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// ============================================================================
|
|
4
4
|
|
|
5
5
|
export const SERVER_NAME = "engram-mcp-server";
|
|
6
|
-
export const SERVER_VERSION = "1.2.
|
|
6
|
+
export const SERVER_VERSION = "1.2.2";
|
|
7
7
|
export const TOOL_PREFIX = "engram";
|
|
8
8
|
|
|
9
9
|
// Database
|
package/src/index.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
18
18
|
import { SERVER_NAME, SERVER_VERSION } from "./constants.js";
|
|
19
19
|
import { initDatabase, getProjectRoot } from "./database.js";
|
|
20
20
|
import { findProjectRoot } from "./utils.js";
|
|
21
|
+
import { runInstaller } from "./installer.js";
|
|
21
22
|
|
|
22
23
|
// Tool registrations
|
|
23
24
|
import { registerSessionTools } from "./tools/sessions.js";
|
|
@@ -30,6 +31,14 @@ import { registerSchedulerTools } from "./tools/scheduler.js";
|
|
|
30
31
|
// ─── Initialize ───────────────────────────────────────────────────────
|
|
31
32
|
|
|
32
33
|
async function main(): Promise<void> {
|
|
34
|
+
const args = process.argv.slice(2);
|
|
35
|
+
|
|
36
|
+
// ─── Auto-Installer ───────────────────────────────────────────────────
|
|
37
|
+
if (args.includes("install") || args.includes("--install") || args.includes("--list")) {
|
|
38
|
+
runInstaller(args);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
33
42
|
// Detect project root
|
|
34
43
|
const projectRoot = findProjectRoot();
|
|
35
44
|
console.error(`[Engram] Project root: ${projectRoot}`);
|
package/src/installer.ts
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import os from "os";
|
|
4
|
+
|
|
5
|
+
const HOME = os.homedir();
|
|
6
|
+
const APPDATA = process.env.APPDATA || path.join(HOME, ".config");
|
|
7
|
+
|
|
8
|
+
// ─── IDE Config Locations ────────────────────────────────────────────
|
|
9
|
+
|
|
10
|
+
const IDE_CONFIGS: Record<string, any> = {
|
|
11
|
+
antigravity: {
|
|
12
|
+
name: "Antigravity IDE",
|
|
13
|
+
paths: [
|
|
14
|
+
path.join(HOME, ".gemini", "antigravity", "mcp_config.json"),
|
|
15
|
+
],
|
|
16
|
+
format: "mcpServers",
|
|
17
|
+
},
|
|
18
|
+
cursor: {
|
|
19
|
+
name: "Cursor",
|
|
20
|
+
paths: [
|
|
21
|
+
path.join(HOME, ".cursor", "mcp.json"),
|
|
22
|
+
path.join(APPDATA, "Cursor", "mcp.json"),
|
|
23
|
+
],
|
|
24
|
+
format: "mcpServers",
|
|
25
|
+
},
|
|
26
|
+
vscode: {
|
|
27
|
+
name: "VS Code (Copilot)",
|
|
28
|
+
paths: [
|
|
29
|
+
path.join(APPDATA, "Code", "User", "mcp.json"),
|
|
30
|
+
path.join(HOME, ".vscode", "mcp.json"),
|
|
31
|
+
],
|
|
32
|
+
format: "servers",
|
|
33
|
+
},
|
|
34
|
+
cline: {
|
|
35
|
+
name: "Cline / Roo Code",
|
|
36
|
+
paths: [
|
|
37
|
+
path.join(APPDATA, "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"),
|
|
38
|
+
path.join(HOME, ".cline", "mcp_settings.json"),
|
|
39
|
+
],
|
|
40
|
+
format: "mcpServers",
|
|
41
|
+
},
|
|
42
|
+
windsurf: {
|
|
43
|
+
name: "Windsurf",
|
|
44
|
+
paths: [
|
|
45
|
+
path.join(HOME, ".codeium", "windsurf", "mcp_config.json"),
|
|
46
|
+
path.join(APPDATA, "Windsurf", "mcp.json"),
|
|
47
|
+
],
|
|
48
|
+
format: "mcpServers",
|
|
49
|
+
},
|
|
50
|
+
visualstudio: {
|
|
51
|
+
name: "Visual Studio 2022",
|
|
52
|
+
paths: [
|
|
53
|
+
path.join(HOME, ".mcp.json"), // Global config for Visual Studio
|
|
54
|
+
],
|
|
55
|
+
format: "servers",
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// ─── Engram Entry ────────────────────────────────────────────────────
|
|
60
|
+
|
|
61
|
+
function makeEngramEntry(format: string) {
|
|
62
|
+
const entry = {
|
|
63
|
+
command: "npx",
|
|
64
|
+
args: ["-y", "engram-mcp-server"],
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
if (format === "servers") {
|
|
68
|
+
// VS Code uses a slightly different shape
|
|
69
|
+
return { type: "stdio", ...entry };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return entry;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// ─── Config Manipulation ─────────────────────────────────────────────
|
|
76
|
+
|
|
77
|
+
function readJson(filePath: string) {
|
|
78
|
+
try {
|
|
79
|
+
return JSON.parse(fs.readFileSync(filePath, "utf-8"));
|
|
80
|
+
} catch {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function writeJson(filePath: string, data: any) {
|
|
86
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
87
|
+
fs.writeFileSync(filePath, JSON.stringify(data, null, 2) + "\n", "utf-8");
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function addToConfig(configPath: string, format: string) {
|
|
91
|
+
let config = readJson(configPath) || {};
|
|
92
|
+
const key = format; // "mcpServers" or "servers"
|
|
93
|
+
|
|
94
|
+
if (!config[key]) config[key] = {};
|
|
95
|
+
|
|
96
|
+
if (config[key].engram) {
|
|
97
|
+
// Already exists — update to use npx
|
|
98
|
+
config[key].engram = makeEngramEntry(format);
|
|
99
|
+
writeJson(configPath, config);
|
|
100
|
+
return "updated";
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
config[key].engram = makeEngramEntry(format);
|
|
104
|
+
writeJson(configPath, config);
|
|
105
|
+
return "added";
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// ─── Main ────────────────────────────────────────────────────────────
|
|
109
|
+
|
|
110
|
+
export function runInstaller(args: string[]) {
|
|
111
|
+
if (args.includes("--list")) {
|
|
112
|
+
console.log("\nEngram can be auto-installed into these IDEs:\n");
|
|
113
|
+
for (const [id, ide] of Object.entries(IDE_CONFIGS)) {
|
|
114
|
+
const found = ide.paths.find((p: string) => fs.existsSync(p) || fs.existsSync(path.dirname(p)));
|
|
115
|
+
console.log(` ${id.padEnd(15)} ${ide.name} ${found ? "✅ detected" : "❌ not found"}`);
|
|
116
|
+
}
|
|
117
|
+
process.exit(0);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Specific IDE requested?
|
|
121
|
+
const ideFlagIdx = args.indexOf("--ide");
|
|
122
|
+
const targetIde = ideFlagIdx >= 0 ? args[ideFlagIdx + 1] : null;
|
|
123
|
+
|
|
124
|
+
const idesToProcess = targetIde
|
|
125
|
+
? (IDE_CONFIGS[targetIde] ? { [targetIde]: IDE_CONFIGS[targetIde] } : null)
|
|
126
|
+
: IDE_CONFIGS;
|
|
127
|
+
|
|
128
|
+
if (!idesToProcess) {
|
|
129
|
+
console.error(`Unknown IDE: "${targetIde}". Options: ${Object.keys(IDE_CONFIGS).join(", ")}`);
|
|
130
|
+
process.exit(1);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
console.log("\n🧠 Engram MCP Installer\n");
|
|
134
|
+
|
|
135
|
+
let installed = 0;
|
|
136
|
+
|
|
137
|
+
for (const [id, ide] of Object.entries(idesToProcess)) {
|
|
138
|
+
const configPath = ide.paths.find((p: string) => fs.existsSync(p)) || ide.paths[0];
|
|
139
|
+
|
|
140
|
+
try {
|
|
141
|
+
const result = addToConfig(configPath, ide.format);
|
|
142
|
+
console.log(`\n ✅ ${ide.name}`);
|
|
143
|
+
console.log(` Config: ${configPath}`);
|
|
144
|
+
console.log(` Status: ${result === "added" ? "Engram added" : "Engram config updated to use npx"}`);
|
|
145
|
+
installed++;
|
|
146
|
+
} catch (e: any) {
|
|
147
|
+
console.log(`\n ⚠️ ${ide.name}`);
|
|
148
|
+
console.log(` Could not write to: ${configPath}`);
|
|
149
|
+
console.log(` Reason: ${e.message}`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (installed === 0) {
|
|
154
|
+
console.log("\n No supported IDEs were found on this machine.");
|
|
155
|
+
console.log(" Run 'npx -y engram-mcp-server --list' to see what was detected.\n");
|
|
156
|
+
} else {
|
|
157
|
+
console.log(`\n✅ Done! Engram configured in ${installed} IDE(s).`);
|
|
158
|
+
console.log(" Restart your IDE(s) to load Engram.\n");
|
|
159
|
+
}
|
|
160
|
+
}
|