@engramprotocol/mcp-server 0.10.1 → 0.10.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/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +120 -0
- package/dist/cli.js.map +1 -0
- package/dist/http-client.d.ts +33 -0
- package/dist/http-client.d.ts.map +1 -0
- package/dist/http-client.js +106 -0
- package/dist/http-client.js.map +1 -0
- package/dist/server.d.ts +18 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +18 -0
- package/dist/server.js.map +1 -0
- package/dist/setup/_helpers.d.ts +71 -0
- package/dist/setup/_helpers.d.ts.map +1 -0
- package/dist/setup/_helpers.js +275 -0
- package/dist/setup/_helpers.js.map +1 -0
- package/dist/setup/index.d.ts +2 -0
- package/dist/setup/index.d.ts.map +1 -0
- package/dist/setup/index.js +83 -0
- package/dist/setup/index.js.map +1 -0
- package/dist/setup/install.d.ts +2 -0
- package/dist/setup/install.d.ts.map +1 -0
- package/dist/setup/install.js +241 -0
- package/dist/setup/install.js.map +1 -0
- package/dist/setup/uninstall.d.ts +2 -0
- package/dist/setup/uninstall.d.ts.map +1 -0
- package/dist/setup/uninstall.js +120 -0
- package/dist/setup/uninstall.js.map +1 -0
- package/dist/setup/update.d.ts +2 -0
- package/dist/setup/update.d.ts.map +1 -0
- package/dist/setup/update.js +130 -0
- package/dist/setup/update.js.map +1 -0
- package/dist/tools/_helpers.d.ts +18 -0
- package/dist/tools/_helpers.d.ts.map +1 -0
- package/dist/tools/_helpers.js +37 -0
- package/dist/tools/_helpers.js.map +1 -0
- package/dist/tools/boot.d.ts +4 -0
- package/dist/tools/boot.d.ts.map +1 -0
- package/dist/tools/boot.js +16 -0
- package/dist/tools/boot.js.map +1 -0
- package/dist/tools/decide.d.ts +13 -0
- package/dist/tools/decide.d.ts.map +1 -0
- package/dist/tools/decide.js +59 -0
- package/dist/tools/decide.js.map +1 -0
- package/dist/tools/entity.d.ts +11 -0
- package/dist/tools/entity.d.ts.map +1 -0
- package/dist/tools/entity.js +55 -0
- package/dist/tools/entity.js.map +1 -0
- package/dist/tools/get.d.ts +4 -0
- package/dist/tools/get.d.ts.map +1 -0
- package/dist/tools/get.js +21 -0
- package/dist/tools/get.js.map +1 -0
- package/dist/tools/index.d.ts +26 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +67 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/list.d.ts +4 -0
- package/dist/tools/list.d.ts.map +1 -0
- package/dist/tools/list.js +38 -0
- package/dist/tools/list.js.map +1 -0
- package/dist/tools/note.d.ts +15 -0
- package/dist/tools/note.d.ts.map +1 -0
- package/dist/tools/note.js +50 -0
- package/dist/tools/note.js.map +1 -0
- package/dist/tools/projects.d.ts +9 -0
- package/dist/tools/projects.d.ts.map +1 -0
- package/dist/tools/projects.js +65 -0
- package/dist/tools/projects.js.map +1 -0
- package/dist/tools/recall.d.ts +4 -0
- package/dist/tools/recall.d.ts.map +1 -0
- package/dist/tools/recall.js +18 -0
- package/dist/tools/recall.js.map +1 -0
- package/dist/tools/set-status.d.ts +13 -0
- package/dist/tools/set-status.d.ts.map +1 -0
- package/dist/tools/set-status.js +48 -0
- package/dist/tools/set-status.js.map +1 -0
- package/dist/tools/show.d.ts +11 -0
- package/dist/tools/show.d.ts.map +1 -0
- package/dist/tools/show.js +25 -0
- package/dist/tools/show.js.map +1 -0
- package/dist/tools/stats.d.ts +11 -0
- package/dist/tools/stats.d.ts.map +1 -0
- package/dist/tools/stats.js +21 -0
- package/dist/tools/stats.js.map +1 -0
- package/dist/tools/track-task.d.ts +10 -0
- package/dist/tools/track-task.d.ts.map +1 -0
- package/dist/tools/track-task.js +56 -0
- package/dist/tools/track-task.js.map +1 -0
- package/dist/tools/update.d.ts +4 -0
- package/dist/tools/update.d.ts.map +1 -0
- package/dist/tools/update.js +25 -0
- package/dist/tools/update.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Setup-mode uninstall flow. Implements v0.10.0-PROPOSAL C.5 §Uninstall flow.
|
|
3
|
+
//
|
|
4
|
+
// Removes all engramprotocol-managed entries from Claude Code config and removes
|
|
5
|
+
// the hook scripts. User's non-EML hooks, permissions, and settings remain untouched.
|
|
6
|
+
// ~/.eml/config is kept by default (user data — confirmed before delete).
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
+
var ownKeys = function(o) {
|
|
25
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
+
var ar = [];
|
|
27
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
+
return ar;
|
|
29
|
+
};
|
|
30
|
+
return ownKeys(o);
|
|
31
|
+
};
|
|
32
|
+
return function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.runUninstall = runUninstall;
|
|
42
|
+
const fs = __importStar(require("fs"));
|
|
43
|
+
const _helpers_1 = require("./_helpers");
|
|
44
|
+
function log(msg) {
|
|
45
|
+
process.stderr.write(msg + '\n');
|
|
46
|
+
}
|
|
47
|
+
const MCP_PERMISSION = `mcp__${_helpers_1.MCP_SERVER_NAME}__*`;
|
|
48
|
+
const BASH_PERMISSION = `Bash(npx @engramprotocol/mcp-server setup *)`;
|
|
49
|
+
async function runUninstall(_argv) {
|
|
50
|
+
log('Engram Protocol — Setup (uninstall)\n');
|
|
51
|
+
log('Will remove:');
|
|
52
|
+
log(` • Hook entries in ${_helpers_1.CLAUDE_SETTINGS} that reference ${_helpers_1.EML_HOOKS_DIR}`);
|
|
53
|
+
log(` • Permission entries: ${MCP_PERMISSION}, ${BASH_PERMISSION}`);
|
|
54
|
+
log(` • MCP server registration "${_helpers_1.MCP_SERVER_NAME}" (via \`claude mcp remove\`)`);
|
|
55
|
+
log(` • ${_helpers_1.EML_HOOKS_DIR} (hook scripts)`);
|
|
56
|
+
log(` • ${_helpers_1.EML_CONFIG} (only after explicit confirmation — contains token)`);
|
|
57
|
+
log('');
|
|
58
|
+
const ok = await (0, _helpers_1.promptConfirm)('Proceed?', false);
|
|
59
|
+
if (!ok) {
|
|
60
|
+
log('\nCancelled. No changes made.');
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
// --- 1. settings.json — backup + remove managed entries -------------------
|
|
64
|
+
if (fs.existsSync(_helpers_1.CLAUDE_SETTINGS)) {
|
|
65
|
+
const backupPath = (0, _helpers_1.backupSettings)();
|
|
66
|
+
log(`\n ℹ Backup: ${backupPath}`);
|
|
67
|
+
const settings = (0, _helpers_1.readSettings)();
|
|
68
|
+
const hooksRemoved = (0, _helpers_1.removeHooksByCommandPrefix)(settings, _helpers_1.EML_HOOKS_DIR);
|
|
69
|
+
log(` ✓ Removed ${hooksRemoved} hook entr${hooksRemoved === 1 ? 'y' : 'ies'}`);
|
|
70
|
+
const permsRemoved = (0, _helpers_1.removePermissions)(settings, (e) => e === MCP_PERMISSION || e === BASH_PERMISSION);
|
|
71
|
+
log(` ✓ Removed ${permsRemoved} permission entr${permsRemoved === 1 ? 'y' : 'ies'}`);
|
|
72
|
+
(0, _helpers_1.writeSettings)(settings);
|
|
73
|
+
log(` ✓ ${_helpers_1.CLAUDE_SETTINGS} updated`);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
log(` ℹ ${_helpers_1.CLAUDE_SETTINGS} not found — nothing to clean there`);
|
|
77
|
+
}
|
|
78
|
+
// --- 2. claude mcp remove -------------------------------------------------
|
|
79
|
+
const remove = (0, _helpers_1.claudeCli)(['mcp', 'remove', _helpers_1.MCP_SERVER_NAME]);
|
|
80
|
+
if (remove.status === 0) {
|
|
81
|
+
log(` ✓ MCP server "${_helpers_1.MCP_SERVER_NAME}" removed`);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
log(` ℹ \`claude mcp remove ${_helpers_1.MCP_SERVER_NAME}\` returned non-zero (likely already absent)`);
|
|
85
|
+
}
|
|
86
|
+
// --- 3. ~/.eml/hooks/ -----------------------------------------------------
|
|
87
|
+
if (fs.existsSync(_helpers_1.EML_HOOKS_DIR)) {
|
|
88
|
+
fs.rmSync(_helpers_1.EML_HOOKS_DIR, { recursive: true, force: true });
|
|
89
|
+
log(` ✓ Removed ${_helpers_1.EML_HOOKS_DIR}`);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
log(` ℹ ${_helpers_1.EML_HOOKS_DIR} not found — already gone`);
|
|
93
|
+
}
|
|
94
|
+
// --- 4. ~/.eml/config — confirm before delete -----------------------------
|
|
95
|
+
if (fs.existsSync(_helpers_1.EML_CONFIG)) {
|
|
96
|
+
log('');
|
|
97
|
+
const deleteConfig = await (0, _helpers_1.promptConfirm)(`Delete ${_helpers_1.EML_CONFIG} (contains your API token)?`, false);
|
|
98
|
+
if (deleteConfig) {
|
|
99
|
+
fs.rmSync(_helpers_1.EML_CONFIG);
|
|
100
|
+
log(` ✓ Removed ${_helpers_1.EML_CONFIG}`);
|
|
101
|
+
// ~/.eml/ — remove if empty
|
|
102
|
+
try {
|
|
103
|
+
if (fs.readdirSync(_helpers_1.EML_DIR).length === 0) {
|
|
104
|
+
fs.rmdirSync(_helpers_1.EML_DIR);
|
|
105
|
+
log(` ✓ Removed empty ${_helpers_1.EML_DIR}`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
catch { /* logs subdir or similar exists — leave as-is */ }
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
log(` ℹ Kept ${_helpers_1.EML_CONFIG}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
log(`
|
|
115
|
+
✅ Uninstall complete.
|
|
116
|
+
|
|
117
|
+
Restart Claude Code for the changes to take full effect.
|
|
118
|
+
`);
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=uninstall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../src/setup/uninstall.ts"],"names":[],"mappings":";AAAA,8EAA8E;AAC9E,EAAE;AACF,iFAAiF;AACjF,sFAAsF;AACtF,0EAA0E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyB1E,oCAiFC;AAxGD,uCAAwB;AACxB,yCAamB;AAEnB,SAAS,GAAG,CAAC,GAAW;IACtB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC,CAAA;AAClC,CAAC;AAED,MAAM,cAAc,GAAG,QAAQ,0BAAe,KAAK,CAAA;AACnD,MAAM,eAAe,GAAG,8CAA8C,CAAA;AAE/D,KAAK,UAAU,YAAY,CAAC,K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,EAAE,CAAC,WAAW,CAAC,kBAAO,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;oBACzC,EAAE,CAAC,SAAS,CAAC,kBAAO,CAAC,CAAA;oBACrB,GAAG,CAAC,qBAAqB,kBAAO,EAAE,CAAC,CAAA;gBACrC,CAAC;YACH,CAAC;YAAC,MAAM,CAAC,CAAC,iDAAiD,CAAC,CAAC;QAC/D,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,YAAY,qBAAU,EAAE,CAAC,CAAA;QAC/B,CAAC;IACH,CAAC;IAED,GAAG,CAAC;;;;CAIL,CAAC,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/setup/update.ts"],"names":[],"mappings":"AAwCA,wBAAsB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAyE9D"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Setup-mode update flow. Implements v0.10.0-PROPOSAL C.5 §Update flow.
|
|
3
|
+
//
|
|
4
|
+
// What this does:
|
|
5
|
+
// - Refreshes EML_CLIENT_VERSION in ~/.eml/config to match the currently-installed
|
|
6
|
+
// package version (so the hook's banner-check sees the right version)
|
|
7
|
+
// - Overwrites hook templates in ~/.eml/hooks/ from the current package's templates/
|
|
8
|
+
// (marker-aware: skips files that the user has customized — no marker present)
|
|
9
|
+
// - Verifies that ~/.claude/settings.json still has the managed entries
|
|
10
|
+
//
|
|
11
|
+
// What this does NOT do:
|
|
12
|
+
// - Refresh the npm package itself. That's the user's responsibility (typically via
|
|
13
|
+
// `npx @engramprotocol/mcp-server@latest setup update` to bust npx cache).
|
|
14
|
+
// If the package version hasn't changed when `setup update` runs, it's a no-op
|
|
15
|
+
// except for config-bump and template-overwrite (idempotent).
|
|
16
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
19
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
20
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
21
|
+
}
|
|
22
|
+
Object.defineProperty(o, k2, desc);
|
|
23
|
+
}) : (function(o, m, k, k2) {
|
|
24
|
+
if (k2 === undefined) k2 = k;
|
|
25
|
+
o[k2] = m[k];
|
|
26
|
+
}));
|
|
27
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
28
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
29
|
+
}) : function(o, v) {
|
|
30
|
+
o["default"] = v;
|
|
31
|
+
});
|
|
32
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
33
|
+
var ownKeys = function(o) {
|
|
34
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
35
|
+
var ar = [];
|
|
36
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
37
|
+
return ar;
|
|
38
|
+
};
|
|
39
|
+
return ownKeys(o);
|
|
40
|
+
};
|
|
41
|
+
return function (mod) {
|
|
42
|
+
if (mod && mod.__esModule) return mod;
|
|
43
|
+
var result = {};
|
|
44
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
45
|
+
__setModuleDefault(result, mod);
|
|
46
|
+
return result;
|
|
47
|
+
};
|
|
48
|
+
})();
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.runUpdate = runUpdate;
|
|
51
|
+
const fs = __importStar(require("fs"));
|
|
52
|
+
const _helpers_1 = require("./_helpers");
|
|
53
|
+
function log(msg) {
|
|
54
|
+
process.stderr.write(msg + '\n');
|
|
55
|
+
}
|
|
56
|
+
function fail(msg, code = 1) {
|
|
57
|
+
log(`\n❌ ${msg}`);
|
|
58
|
+
process.exit(code);
|
|
59
|
+
}
|
|
60
|
+
async function runUpdate(_argv) {
|
|
61
|
+
log('Engram Protocol — Setup (update)');
|
|
62
|
+
// --- 1. Read existing config ---------------------------------------------
|
|
63
|
+
const cfg = (0, _helpers_1.readConfig)();
|
|
64
|
+
if (!cfg) {
|
|
65
|
+
fail(`No installation found at ${_helpers_1.EML_CONFIG}. Run \`setup install\` first.`);
|
|
66
|
+
}
|
|
67
|
+
if (!cfg.EML_URL || !cfg.EML_API_TOKEN) {
|
|
68
|
+
fail(`Config at ${_helpers_1.EML_CONFIG} is incomplete (missing EML_URL or EML_API_TOKEN). Re-run \`setup install\`.`);
|
|
69
|
+
}
|
|
70
|
+
const oldVersion = cfg.EML_CLIENT_VERSION || '(unset)';
|
|
71
|
+
const newVersion = (0, _helpers_1.pkgVersion)();
|
|
72
|
+
log(` Current installed version: ${oldVersion}`);
|
|
73
|
+
log(` This package's version: ${newVersion}`);
|
|
74
|
+
if (oldVersion === newVersion) {
|
|
75
|
+
log(' → Config already at this version; will still refresh templates (idempotent).');
|
|
76
|
+
}
|
|
77
|
+
// --- 2. Update config (bump EML_CLIENT_VERSION) --------------------------
|
|
78
|
+
(0, _helpers_1.writeConfig)({ ...cfg, EML_CLIENT_VERSION: newVersion });
|
|
79
|
+
log(` ✓ ${_helpers_1.EML_CONFIG} EML_CLIENT_VERSION → ${newVersion}`);
|
|
80
|
+
// --- 3. Hook templates: overwrite (marker-aware) -------------------------
|
|
81
|
+
log('\nHook templates:');
|
|
82
|
+
fs.mkdirSync(_helpers_1.EML_HOOKS_DIR, { recursive: true });
|
|
83
|
+
for (const tpl of _helpers_1.HOOK_TEMPLATES) {
|
|
84
|
+
const installedPath = `${_helpers_1.EML_HOOKS_DIR}/${tpl.filename}`;
|
|
85
|
+
if (fs.existsSync(installedPath)) {
|
|
86
|
+
const current = fs.readFileSync(installedPath, 'utf-8');
|
|
87
|
+
if (!(0, _helpers_1.hasMarker)(current)) {
|
|
88
|
+
log(` ⚠ skip ${installedPath} — user-customized (no \`${_helpers_1.MANAGED_BY_MARKER}\` marker). Manual review needed.`);
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
(0, _helpers_1.installTemplate)(tpl.filename);
|
|
93
|
+
log(` ✓ ${installedPath}`);
|
|
94
|
+
}
|
|
95
|
+
// --- 4. Settings.json sanity check ---------------------------------------
|
|
96
|
+
log('\nSettings.json sanity check:');
|
|
97
|
+
if (!fs.existsSync(_helpers_1.CLAUDE_SETTINGS)) {
|
|
98
|
+
log(` ⚠ ${_helpers_1.CLAUDE_SETTINGS} missing — was the install completed? Run \`setup install\` again.`);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
const settings = (0, _helpers_1.readSettings)();
|
|
102
|
+
const allow = settings.permissions?.allow ?? [];
|
|
103
|
+
const hasMcpPerm = allow.includes(`mcp__${_helpers_1.MCP_SERVER_NAME}__*`);
|
|
104
|
+
if (hasMcpPerm)
|
|
105
|
+
log(` ✓ mcp__${_helpers_1.MCP_SERVER_NAME}__* present in permissions.allow`);
|
|
106
|
+
else
|
|
107
|
+
log(` ⚠ mcp__${_helpers_1.MCP_SERVER_NAME}__* missing from permissions.allow — run \`setup install\` to restore`);
|
|
108
|
+
let hookEntries = 0;
|
|
109
|
+
for (const event of Object.keys(settings.hooks ?? {})) {
|
|
110
|
+
const arr = settings.hooks[event] ?? [];
|
|
111
|
+
for (const e of arr) {
|
|
112
|
+
for (const h of e.hooks ?? []) {
|
|
113
|
+
if (typeof h.command === 'string' && h.command.includes(_helpers_1.EML_HOOKS_DIR))
|
|
114
|
+
hookEntries += 1;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
log(` ${hookEntries > 0 ? '✓' : '⚠'} ${hookEntries} hook entries reference ${_helpers_1.EML_HOOKS_DIR}`);
|
|
119
|
+
}
|
|
120
|
+
log(`
|
|
121
|
+
✅ Update complete.
|
|
122
|
+
|
|
123
|
+
Note: this updates the local config + hook templates of the currently-running setup-mode.
|
|
124
|
+
If you ran an old version via npx cache, run again with @latest to force a fresh download:
|
|
125
|
+
npx @engramprotocol/mcp-server@latest setup update
|
|
126
|
+
|
|
127
|
+
Restart Claude Code for changes to take effect.
|
|
128
|
+
`);
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/setup/update.ts"],"names":[],"mappings":";AAAA,wEAAwE;AACxE,EAAE;AACF,kBAAkB;AAClB,qFAAqF;AACrF,0EAA0E;AAC1E,uFAAuF;AACvF,mFAAmF;AACnF,0EAA0E;AAC1E,EAAE;AACF,yBAAyB;AACzB,sFAAsF;AACtF,+EAA+E;AAC/E,mFAAmF;AACnF,kEAAkE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BlE,8BAyEC;AAlGD,uCAAwB;AACxB,yCAamB;AAEnB,SAAS,GAAG,CAAC,GAAW;IACtB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC,CAAA;AAClC,CAAC;AAED,SAAS,IAAI,CAAC,GAAW,EAAE,IAAI,GAAG,CAAC;IACjC,GAAG,CAAC,OAAO,GAAG,EAAE,CAAC,CAAA;IACjB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACpB,CAAC;AAEM,KAAK,UAAU,SAAS,CAAC,KAAe;IAC7C,GAAG,CAAC,kCAAkC,CAAC,CAAA;IAEvC,4EAA4E;IAC5E,MAAM,GAAG,GAAG,IAAA,qBAAU,GAAE,CAAA;IACxB,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,IAAI,CAAC,4BAA4B,qBAAU,gCAAgC,CAAC,CAAA;IAC9E,CAAC;IACD,IAAI,CAAC,GAAG,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,aAA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L,CAAC,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool handler wrapper (v0.9-PROPOSAL §6.4 "Error handling — two channels").
|
|
3
|
+
*
|
|
4
|
+
* - Backend errors (e.g. 401/500) → `isError: true` with a message for the
|
|
5
|
+
* LLM (ideally phrased so the model can self-correct).
|
|
6
|
+
* - Protocol errors (malformed request, unknown tool) are left to the SDK.
|
|
7
|
+
*
|
|
8
|
+
* The CallToolResult type comes from the SDK; we just return the plain object —
|
|
9
|
+
* no type assertion needed (registerTool handles that).
|
|
10
|
+
*/
|
|
11
|
+
export declare function callTool<T>(fn: () => Promise<T>): Promise<{
|
|
12
|
+
content: Array<{
|
|
13
|
+
type: 'text';
|
|
14
|
+
text: string;
|
|
15
|
+
}>;
|
|
16
|
+
isError?: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
//# sourceMappingURL=_helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_helpers.d.ts","sourceRoot":"","sources":["../../src/tools/_helpers.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,wBAAsB,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;IAC/D,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAC,CAoBD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.callTool = callTool;
|
|
4
|
+
const http_client_1 = require("../http-client");
|
|
5
|
+
/**
|
|
6
|
+
* Tool handler wrapper (v0.9-PROPOSAL §6.4 "Error handling — two channels").
|
|
7
|
+
*
|
|
8
|
+
* - Backend errors (e.g. 401/500) → `isError: true` with a message for the
|
|
9
|
+
* LLM (ideally phrased so the model can self-correct).
|
|
10
|
+
* - Protocol errors (malformed request, unknown tool) are left to the SDK.
|
|
11
|
+
*
|
|
12
|
+
* The CallToolResult type comes from the SDK; we just return the plain object —
|
|
13
|
+
* no type assertion needed (registerTool handles that).
|
|
14
|
+
*/
|
|
15
|
+
async function callTool(fn) {
|
|
16
|
+
try {
|
|
17
|
+
const result = await fn();
|
|
18
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
if (err instanceof http_client_1.EmlApiError) {
|
|
22
|
+
return {
|
|
23
|
+
isError: true,
|
|
24
|
+
content: [{
|
|
25
|
+
type: 'text',
|
|
26
|
+
text: `EML API error (HTTP ${err.status}): ${err.message}`,
|
|
27
|
+
}],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const e = err;
|
|
31
|
+
return {
|
|
32
|
+
isError: true,
|
|
33
|
+
content: [{ type: 'text', text: `Tool execution failed: ${e.message}` }],
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=_helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_helpers.js","sourceRoot":"","sources":["../../src/tools/_helpers.ts"],"names":[],"mappings":";;AAYA,4BAuBC;AAnCD,gDAA4C;AAE5C;;;;;;;;;GASG;AACI,KAAK,UAAU,QAAQ,CAAI,EAAoB;IAIpD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,EAAE,EAAE,CAAA;QACzB,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAA;IAC/E,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,IAAI,GAAG,YAAY,yBAAW,EAAE,CAAC;YAC/B,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,OAAO,EAAE,CAAC;wBACR,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,uBAAuB,GAAG,CAAC,MAAM,MAAM,GAAG,CAAC,OAAO,EAAE;qBAC3D,CAAC;aACH,CAAA;QACH,CAAC;QACD,MAAM,CAAC,GAAG,GAAY,CAAA;QACtB,OAAO;YACL,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,0BAA0B,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;SACzE,CAAA;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boot.d.ts","sourceRoot":"","sources":["../../src/tools/boot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAGhD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI,CAgB1E"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerBootTool = registerBootTool;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const _helpers_1 = require("./_helpers");
|
|
6
|
+
function registerBootTool(server, http) {
|
|
7
|
+
server.registerTool('eml_boot', {
|
|
8
|
+
title: 'Boot Brain',
|
|
9
|
+
description: 'Manual brain-reload — returns the same markdown the SessionStart-Hook ' +
|
|
10
|
+
'delivers automatically. Use mid-session to refresh brain state.',
|
|
11
|
+
inputSchema: {
|
|
12
|
+
agent: zod_1.z.string().optional().describe('Agent ID (e.g. "motti", "default"). If omitted, the server uses the brain name as default.'),
|
|
13
|
+
},
|
|
14
|
+
}, async (args) => (0, _helpers_1.callTool)(() => http.post('/boot', { agent: args.agent })));
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=boot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boot.js","sourceRoot":"","sources":["../../src/tools/boot.ts"],"names":[],"mappings":";;AAKA,4CAgBC;AArBD,6BAAuB;AAGvB,yCAAqC;AAErC,SAAgB,gBAAgB,CAAC,MAAiB,EAAE,IAAgB;IAClE,MAAM,CAAC,YAAY,CACjB,UAAU,EACV;QACE,KAAK,EAAE,YAAY;QACnB,WAAW,EACT,wEAAwE;YACxE,iEAAiE;QACnE,WAAW,EAAE;YACX,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CACnC,4FAA4F,CAC7F;SACF;KACF,EACD,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,IAAA,mBAAQ,EAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAC1E,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { HttpClient } from '../http-client';
|
|
3
|
+
/**
|
|
4
|
+
* v0.9 Cluster 4 step 3: typed write tool for decision engrams.
|
|
5
|
+
*
|
|
6
|
+
* Properties (decision_type/rationale/alternatives/expires_at/review_due_at)
|
|
7
|
+
* are exposed as top-level tool params, packed into a `properties` object
|
|
8
|
+
* by the tool, and posted to /context.
|
|
9
|
+
*
|
|
10
|
+
* review_due_at: server default is 60d if unset (brain hygiene).
|
|
11
|
+
*/
|
|
12
|
+
export declare function registerDecideTool(server: McpServer, http: HttpClient): void;
|
|
13
|
+
//# sourceMappingURL=decide.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decide.d.ts","sourceRoot":"","sources":["../../src/tools/decide.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAOhD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI,CAwC5E"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerDecideTool = registerDecideTool;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const _helpers_1 = require("./_helpers");
|
|
6
|
+
const DECISION_TYPES = ['strategic', 'architectural', 'operational', 'roadmap'];
|
|
7
|
+
const SIGNIFICANCE = ['critical', 'high', 'normal', 'low', 'trivial'];
|
|
8
|
+
const STATUSES = ['planned', 'active', 'superseded', 'invalidated', 'expired', 'resolved'];
|
|
9
|
+
/**
|
|
10
|
+
* v0.9 Cluster 4 step 3: typed write tool for decision engrams.
|
|
11
|
+
*
|
|
12
|
+
* Properties (decision_type/rationale/alternatives/expires_at/review_due_at)
|
|
13
|
+
* are exposed as top-level tool params, packed into a `properties` object
|
|
14
|
+
* by the tool, and posted to /context.
|
|
15
|
+
*
|
|
16
|
+
* review_due_at: server default is 60d if unset (brain hygiene).
|
|
17
|
+
*/
|
|
18
|
+
function registerDecideTool(server, http) {
|
|
19
|
+
server.registerTool('eml_decide', {
|
|
20
|
+
title: 'Record Decision',
|
|
21
|
+
description: 'Records a deliberate, documented decision. Trigger: explicit ' +
|
|
22
|
+
'"we decide X", "Decision: Y" — NOT for speculation or open ' +
|
|
23
|
+
'questions. Decisions are the backbone of brain memory.',
|
|
24
|
+
inputSchema: {
|
|
25
|
+
content: zod_1.z.string().describe('The decision itself (1-3 sentences, what was decided).'),
|
|
26
|
+
scope: zod_1.z.string().describe('global | project.<id> | entity.<id> | agent.<id> | user.<id>'),
|
|
27
|
+
subject: zod_1.z.string().optional().describe('Slug for the decision (for later recall).'),
|
|
28
|
+
decision_type: zod_1.z.enum(DECISION_TYPES).optional(),
|
|
29
|
+
rationale: zod_1.z.string().optional().describe('Why this was decided.'),
|
|
30
|
+
alternatives: zod_1.z.array(zod_1.z.string()).optional().describe('Rejected alternatives.'),
|
|
31
|
+
expires_at: zod_1.z.string().optional().describe('ISO date: hard lifecycle, obsolete from then on.'),
|
|
32
|
+
review_due_at: zod_1.z.string().optional().describe('ISO date: next review (server default 60d).'),
|
|
33
|
+
significance: zod_1.z.enum(SIGNIFICANCE).optional(),
|
|
34
|
+
status: zod_1.z.enum(STATUSES).optional().describe('Default "active".'),
|
|
35
|
+
},
|
|
36
|
+
}, async (args) => (0, _helpers_1.callTool)(() => {
|
|
37
|
+
const properties = {};
|
|
38
|
+
if (args.decision_type !== undefined)
|
|
39
|
+
properties.decision_type = args.decision_type;
|
|
40
|
+
if (args.rationale !== undefined)
|
|
41
|
+
properties.rationale = args.rationale;
|
|
42
|
+
if (args.alternatives !== undefined)
|
|
43
|
+
properties.alternatives = args.alternatives;
|
|
44
|
+
if (args.expires_at !== undefined)
|
|
45
|
+
properties.expires_at = args.expires_at;
|
|
46
|
+
if (args.review_due_at !== undefined)
|
|
47
|
+
properties.review_due_at = args.review_due_at;
|
|
48
|
+
return http.post('/context', {
|
|
49
|
+
content: args.content,
|
|
50
|
+
type: 'decision',
|
|
51
|
+
scope: args.scope,
|
|
52
|
+
subject: args.subject,
|
|
53
|
+
status: args.status,
|
|
54
|
+
significance: args.significance,
|
|
55
|
+
properties: Object.keys(properties).length > 0 ? properties : undefined,
|
|
56
|
+
});
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=decide.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decide.js","sourceRoot":"","sources":["../../src/tools/decide.ts"],"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SAAS;SACxE,CAAC,CAAA;IACJ,CAAC,CAAC,CACH,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { HttpClient } from '../http-client';
|
|
3
|
+
/**
|
|
4
|
+
* v0.9 Cluster 4 step 3: list all entities, optionally filtered by kind.
|
|
5
|
+
* Replaces the earlier `eml_entity_list` with clearer naming + symmetry to
|
|
6
|
+
* `eml_projects` (container inventory).
|
|
7
|
+
*/
|
|
8
|
+
export declare function registerEntitiesTool(server: McpServer, http: HttpClient): void;
|
|
9
|
+
export declare function registerEntityCreateTool(server: McpServer, http: HttpClient): void;
|
|
10
|
+
export declare function registerEntityUpdateTool(server: McpServer, http: HttpClient): void;
|
|
11
|
+
//# sourceMappingURL=entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../src/tools/entity.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAKhD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI,CAe9E;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI,CAmBlF;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI,CAmBlF"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerEntitiesTool = registerEntitiesTool;
|
|
4
|
+
exports.registerEntityCreateTool = registerEntityCreateTool;
|
|
5
|
+
exports.registerEntityUpdateTool = registerEntityUpdateTool;
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
const _helpers_1 = require("./_helpers");
|
|
8
|
+
const ENTITY_KINDS = ['person', 'org', 'asset', 'subject'];
|
|
9
|
+
/**
|
|
10
|
+
* v0.9 Cluster 4 step 3: list all entities, optionally filtered by kind.
|
|
11
|
+
* Replaces the earlier `eml_entity_list` with clearer naming + symmetry to
|
|
12
|
+
* `eml_projects` (container inventory).
|
|
13
|
+
*/
|
|
14
|
+
function registerEntitiesTool(server, http) {
|
|
15
|
+
server.registerTool('eml_entities', {
|
|
16
|
+
title: 'List Entities',
|
|
17
|
+
description: 'Lists all entities in the brain (external persons / organisations / ' +
|
|
18
|
+
'assets / subjects), optionally filtered by kind. For "which external ' +
|
|
19
|
+
'persons / orgs are in the brain?".',
|
|
20
|
+
inputSchema: {
|
|
21
|
+
kind: zod_1.z.enum(ENTITY_KINDS).optional().describe('Default: all.'),
|
|
22
|
+
},
|
|
23
|
+
}, async (args) => (0, _helpers_1.callTool)(() => http.get('/entities', args.kind ? { kind: args.kind } : undefined)));
|
|
24
|
+
}
|
|
25
|
+
function registerEntityCreateTool(server, http) {
|
|
26
|
+
server.registerTool('eml_entity_create', {
|
|
27
|
+
title: 'Create Entity',
|
|
28
|
+
description: 'Registers an entity (external person / organisation / asset / subject). ' +
|
|
29
|
+
'Required BEFORE the first engram with scope=entity.<id> — otherwise ' +
|
|
30
|
+
'the scope-existence check fails. Trigger: "new client/contact", ' +
|
|
31
|
+
'"registering external organization X".',
|
|
32
|
+
inputSchema: {
|
|
33
|
+
id: zod_1.z.string().describe('Slug-style ID, e.g. "lasse" or "anthropic".'),
|
|
34
|
+
name: zod_1.z.string(),
|
|
35
|
+
kind: zod_1.z.enum(ENTITY_KINDS),
|
|
36
|
+
description: zod_1.z.string().optional(),
|
|
37
|
+
},
|
|
38
|
+
}, async (args) => (0, _helpers_1.callTool)(() => http.post('/entity', args)));
|
|
39
|
+
}
|
|
40
|
+
function registerEntityUpdateTool(server, http) {
|
|
41
|
+
server.registerTool('eml_entity_update', {
|
|
42
|
+
title: 'Update Entity',
|
|
43
|
+
description: 'Patch entity fields. Trigger: name change, description refinement.',
|
|
44
|
+
inputSchema: {
|
|
45
|
+
id: zod_1.z.string(),
|
|
46
|
+
name: zod_1.z.string().optional(),
|
|
47
|
+
kind: zod_1.z.enum(ENTITY_KINDS).optional(),
|
|
48
|
+
description: zod_1.z.string().optional(),
|
|
49
|
+
},
|
|
50
|
+
}, async (args) => (0, _helpers_1.callTool)(() => {
|
|
51
|
+
const { id, ...patch } = args;
|
|
52
|
+
return http.put(`/entity/${id}`, patch);
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity.js","sourceRoot":"","sources":["../../src/tools/entity.ts"],"names":[],"mappings":";;AAYA,oDAeC;AAED,4DAmBC;AAED,4DAmBC;AArED,6BAAuB;AAGvB,yCAAqC;AAErC,MAAM,YAAY,GAAG,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,CAAU,CAAA;AAEnE;;;;GAIG;AACH,SAAgB,oBAAoB,CAAC,MAAiB,EAAE,IAAgB;IACtE,MAAM,CAAC,YAAY,CACjB,cAAc,EACd;QACE,KAAK,EAAE,eAAe;QACtB,WAAW,EACT,sEAAsE;YACtE,uEAAuE;YACvE,oCAAoC;QACtC,WAAW,EAAE;YACX,IAAI,EAAE,OAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;SAChE;KACF,EACD,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,IAAA,mBAAQ,EAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAA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G,CAAC,WAAW,EAAE,EAAE,EAAE,KAAK,CAAC,CAAA;IACzC,CAAC,CAAC,CACH,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../src/tools/get.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAGhD,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI,CAiBzE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerGetTool = registerGetTool;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const _helpers_1 = require("./_helpers");
|
|
6
|
+
function registerGetTool(server, http) {
|
|
7
|
+
server.registerTool('eml_get', {
|
|
8
|
+
title: 'Get Engram',
|
|
9
|
+
description: 'Fetch one engram by ID, optionally with its relations.',
|
|
10
|
+
inputSchema: {
|
|
11
|
+
id: zod_1.z.string().describe('Engram ID (UUID).'),
|
|
12
|
+
with_relations: zod_1.z.boolean().optional().describe('Default true.'),
|
|
13
|
+
},
|
|
14
|
+
}, async (args) => (0, _helpers_1.callTool)(() => {
|
|
15
|
+
const params = {};
|
|
16
|
+
if (args.with_relations !== undefined)
|
|
17
|
+
params.with_relations = String(args.with_relations);
|
|
18
|
+
return http.get(`/engram/${args.id}`, params);
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../src/tools/get.ts"],"names":[],"mappings":";;AAKA,0CAiBC;AAtBD,6BAAuB;AAGvB,yCAAqC;AAErC,SAAgB,eAAe,CAAC,MAAiB,EAAE,IAAgB;IACjE,MAAM,CAAC,YAAY,CACjB,SAAS,EACT;QACE,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,wDAAwD;QACrE,WAAW,EAAE;YACX,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC;YAC5C,cAAc,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;SACjE;KACF,EACD,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,IAAA,mBAAQ,EAAC,GAAG,EAAE;QAC5B,MAAM,MAAM,GAAgD,EAAE,CAAA;QAC9D,IAAI,IAAI,CAAC,cAAc,KAAK,SAAS;YAAE,MAAM,CAAC,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;QAC1F,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,IAAI,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;IAC/C,CAAC,CAAC,CACH,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { HttpClient } from '../http-client';
|
|
3
|
+
/**
|
|
4
|
+
* v0.9.1 — 17-tool set.
|
|
5
|
+
*
|
|
6
|
+
* Tool categories:
|
|
7
|
+
* - Boot/Recall (2): eml_boot, eml_recall
|
|
8
|
+
* - Typed write (4): eml_decide, eml_set_status, eml_track_task, eml_note
|
|
9
|
+
* - Read/Find (5): eml_show, eml_list, eml_get, eml_projects, eml_entities
|
|
10
|
+
* - Self-awareness (1): eml_stats
|
|
11
|
+
* - Edit (1): eml_update
|
|
12
|
+
* - Project CRUD (2): eml_project_create, eml_project_update
|
|
13
|
+
* - Entity CRUD (2): eml_entity_create, eml_entity_update
|
|
14
|
+
*
|
|
15
|
+
* Intentionally not exposed in v0.9.1:
|
|
16
|
+
* - eml_relate (HTTP-only power use)
|
|
17
|
+
* - eml_confirm_review (brain-hygiene cluster, post-v0.9.1)
|
|
18
|
+
* - eml_session_get (→ v0.9.2 with cross-session awareness)
|
|
19
|
+
* - eml_epistemic_store / eml_context_store (replaced by typed tools)
|
|
20
|
+
*
|
|
21
|
+
* Order is not semantic — only affects the `tools/list` ordering.
|
|
22
|
+
* Boot/Recall come first because they're the most-used.
|
|
23
|
+
*/
|
|
24
|
+
export declare function registerAllTools(server: McpServer, http: HttpClient): void;
|
|
25
|
+
export declare const TOOL_NAMES: readonly ["eml_boot", "eml_recall", "eml_decide", "eml_set_status", "eml_track_task", "eml_note", "eml_show", "eml_list", "eml_get", "eml_projects", "eml_entities", "eml_stats", "eml_update", "eml_project_create", "eml_project_update", "eml_entity_create", "eml_entity_update"];
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAwBhD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI,CAkB1E;AAED,eAAO,MAAM,UAAU,uRAQb,CAAA"}
|