@mneme-ai/mcp 1.1.0 → 1.2.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/dist/index.d.ts.map +1 -1
- package/dist/index.js +45 -344
- package/dist/index.js.map +1 -1
- package/dist/tools/_capabilities.d.ts +14 -0
- package/dist/tools/_capabilities.d.ts.map +1 -0
- package/dist/tools/_capabilities.js +77 -0
- package/dist/tools/_capabilities.js.map +1 -0
- package/dist/tools/_registry.d.ts +16 -0
- package/dist/tools/_registry.d.ts.map +1 -0
- package/dist/tools/_registry.js +57 -0
- package/dist/tools/_registry.js.map +1 -0
- package/dist/tools/_runtime.d.ts +32 -0
- package/dist/tools/_runtime.d.ts.map +1 -0
- package/dist/tools/_runtime.js +78 -0
- package/dist/tools/_runtime.js.map +1 -0
- package/dist/tools/_smart_do.d.ts +14 -0
- package/dist/tools/_smart_do.d.ts.map +1 -0
- package/dist/tools/_smart_do.js +49 -0
- package/dist/tools/_smart_do.js.map +1 -0
- package/dist/tools/_types.d.ts +70 -0
- package/dist/tools/_types.d.ts.map +1 -0
- package/dist/tools/_types.js +34 -0
- package/dist/tools/_types.js.map +1 -0
- package/dist/tools/audit.d.ts +9 -0
- package/dist/tools/audit.d.ts.map +1 -0
- package/dist/tools/audit.js +233 -0
- package/dist/tools/audit.js.map +1 -0
- package/dist/tools/forensics.d.ts +7 -0
- package/dist/tools/forensics.d.ts.map +1 -0
- package/dist/tools/forensics.js +189 -0
- package/dist/tools/forensics.js.map +1 -0
- package/dist/tools/insights.d.ts +7 -0
- package/dist/tools/insights.d.ts.map +1 -0
- package/dist/tools/insights.js +40 -0
- package/dist/tools/insights.js.map +1 -0
- package/dist/tools/lab.d.ts +7 -0
- package/dist/tools/lab.d.ts.map +1 -0
- package/dist/tools/lab.js +93 -0
- package/dist/tools/lab.js.map +1 -0
- package/dist/tools/memory.d.ts +10 -0
- package/dist/tools/memory.d.ts.map +1 -0
- package/dist/tools/memory.js +451 -0
- package/dist/tools/memory.js.map +1 -0
- package/dist/tools/meta.d.ts +7 -0
- package/dist/tools/meta.d.ts.map +1 -0
- package/dist/tools/meta.js +20 -0
- package/dist/tools/meta.js.map +1 -0
- package/dist/tools/people.d.ts +10 -0
- package/dist/tools/people.d.ts.map +1 -0
- package/dist/tools/people.js +73 -0
- package/dist/tools/people.js.map +1 -0
- package/dist/tools/quality.d.ts +6 -0
- package/dist/tools/quality.d.ts.map +1 -0
- package/dist/tools/quality.js +57 -0
- package/dist/tools/quality.js.map +1 -0
- package/dist/tools/quant.d.ts +7 -0
- package/dist/tools/quant.d.ts.map +1 -0
- package/dist/tools/quant.js +26 -0
- package/dist/tools/quant.js.map +1 -0
- package/package.json +3 -3
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAiCA,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;CACb;AAwBD,wBAAsB,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAmCpE"}
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Mneme MCP Server — entrypoint.
|
|
3
|
+
*
|
|
4
|
+
* Architecture (since v1.2.0):
|
|
5
|
+
* tools/_types.ts — MnemeTool + ToolResponse + wisdom envelope
|
|
6
|
+
* tools/_runtime.ts — buildRuntime() + passthroughHandler() + runCliJson()
|
|
7
|
+
* tools/_registry.ts — buildAllTools() merges every category file
|
|
8
|
+
* tools/_capabilities.ts — syllabus tool (the curriculum AI calls first)
|
|
9
|
+
* tools/_smart_do.ts — fallback NL dispatcher
|
|
10
|
+
* tools/<category>.ts — memory · people · audit · forensics · insights ·
|
|
11
|
+
* quality · quant · lab · meta
|
|
12
|
+
*
|
|
13
|
+
* Positioning: Mneme is the TEACHER, AI is the STUDENT. Every tool returns a
|
|
14
|
+
* `{data, wisdom, followUp, confidence}` envelope so AI clients get the data
|
|
15
|
+
* + an interpretive wisdom string + cross-references in one shot. The AI
|
|
16
|
+
* doesn't need to interpret raw JSON; Mneme pre-digests every finding.
|
|
17
|
+
*/
|
|
18
|
+
import { readFileSync } from "node:fs";
|
|
19
|
+
import { dirname, join } from "node:path";
|
|
3
20
|
import { fileURLToPath } from "node:url";
|
|
4
21
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
5
22
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
6
23
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
* Never hardcode versions in source: they drift silently across releases. */
|
|
24
|
+
import { buildRuntime } from "./tools/_runtime.js";
|
|
25
|
+
import { buildAllTools, buildToolMap } from "./tools/_registry.js";
|
|
26
|
+
import { toCallResult, toErrorResult } from "./tools/_types.js";
|
|
11
27
|
function resolveVersion() {
|
|
12
28
|
try {
|
|
13
29
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
14
|
-
// dist/index.js → ../package.json (sits beside dist/)
|
|
15
30
|
const pkg = JSON.parse(readFileSync(join(here, "..", "package.json"), "utf8"));
|
|
16
31
|
return pkg.version ?? "0.0.0";
|
|
17
32
|
}
|
|
@@ -19,353 +34,39 @@ function resolveVersion() {
|
|
|
19
34
|
return "0.0.0";
|
|
20
35
|
}
|
|
21
36
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
required: ["question"],
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
name: "mneme_why",
|
|
37
|
-
description: "Explain why a specific file (or line range) exists by combining git blame with related commits.",
|
|
38
|
-
inputSchema: {
|
|
39
|
-
type: "object",
|
|
40
|
-
properties: {
|
|
41
|
-
file: { type: "string", description: "Path relative to repo root" },
|
|
42
|
-
startLine: { type: "number" },
|
|
43
|
-
endLine: { type: "number" },
|
|
44
|
-
},
|
|
45
|
-
required: ["file"],
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
name: "mneme_search_commits",
|
|
50
|
-
description: "Hybrid (lexical + semantic) search over indexed commits and PRs.",
|
|
51
|
-
inputSchema: {
|
|
52
|
-
type: "object",
|
|
53
|
-
properties: {
|
|
54
|
-
query: { type: "string" },
|
|
55
|
-
topK: { type: "number" },
|
|
56
|
-
},
|
|
57
|
-
required: ["query"],
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: "mneme_status",
|
|
62
|
-
description: "Report what's indexed, the embedder, and DB stats.",
|
|
63
|
-
inputSchema: { type: "object", properties: {} },
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
name: "mneme_list_entities",
|
|
67
|
-
description: "List indexed source-code entities (functions, classes, types, exported variables) with optional filtering by language/kind/path-prefix.",
|
|
68
|
-
inputSchema: {
|
|
69
|
-
type: "object",
|
|
70
|
-
properties: {
|
|
71
|
-
kind: { type: "string", description: "function | class | type | variable | module" },
|
|
72
|
-
language: { type: "string", description: "typescript | tsx | javascript | jsx" },
|
|
73
|
-
pathPrefix: { type: "string", description: "Only entities under this path" },
|
|
74
|
-
limit: { type: "number", description: "Max rows (default 100)" },
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
name: "mneme_find_similar",
|
|
80
|
-
description: "Given an entity id (from mneme_list_entities) OR a code snippet, return the top-K most semantically similar entities in the repo.",
|
|
81
|
-
inputSchema: {
|
|
82
|
-
type: "object",
|
|
83
|
-
properties: {
|
|
84
|
-
entityId: { type: "string", description: "Existing entity id" },
|
|
85
|
-
snippet: { type: "string", description: "Or a code snippet to compare against" },
|
|
86
|
-
topK: { type: "number" },
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
name: "mneme_blast",
|
|
92
|
-
description: "Predict the blast radius of shipping a commit: which past incidents share its file footprint, plus a base-rate verdict (LOW/MED/HIGH).",
|
|
93
|
-
inputSchema: {
|
|
94
|
-
type: "object",
|
|
95
|
-
properties: {
|
|
96
|
-
commit: { type: "string", description: "Commit hash, short hash, or HEAD-relative ref" },
|
|
97
|
-
windowHours: { type: "number" },
|
|
98
|
-
},
|
|
99
|
-
required: ["commit"],
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
];
|
|
37
|
+
/** Convert MnemeTool[] to MCP's Tool[] shape (drops handler + triggers, keeps the
|
|
38
|
+
* rich description so AI tool-selection has full WHEN-to-use guidance). */
|
|
39
|
+
function toMcpTools(all) {
|
|
40
|
+
return all.map((t) => ({
|
|
41
|
+
name: t.name,
|
|
42
|
+
description: t.description,
|
|
43
|
+
inputSchema: t.inputSchema,
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
103
46
|
export async function startMcpServer(opts) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const meta = await git.getRepoMeta(opts.cwd);
|
|
108
|
-
const dbDir = join(meta.rootPath, ".mneme");
|
|
109
|
-
if (!existsSync(dbDir))
|
|
110
|
-
mkdirSync(dbDir, { recursive: true });
|
|
111
|
-
const dbPath = join(dbDir, "mneme.db");
|
|
112
|
-
const s = new store.MnemeStore(dbPath);
|
|
113
|
-
const embedder = await resolveEmbedder({ provider: "auto" });
|
|
47
|
+
const runtime = await buildRuntime(opts.cwd);
|
|
48
|
+
const allTools = buildAllTools();
|
|
49
|
+
const toolMap = buildToolMap();
|
|
114
50
|
const server = new Server({ name: "mneme", version: resolveVersion() }, { capabilities: { tools: {} } });
|
|
115
|
-
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
51
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
52
|
+
tools: toMcpTools(allTools),
|
|
53
|
+
}));
|
|
116
54
|
server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const compressOptOut = args["compress"] === false;
|
|
121
|
-
function htcCompressedFor(results) {
|
|
122
|
-
if (compressOptOut)
|
|
123
|
-
return undefined;
|
|
124
|
-
try {
|
|
125
|
-
const cached = htc.getAllAbstracts(s);
|
|
126
|
-
if (cached.size === 0)
|
|
127
|
-
return undefined;
|
|
128
|
-
const out = new Map();
|
|
129
|
-
for (const r of results) {
|
|
130
|
-
const hit = cached.get(r.commit.hash);
|
|
131
|
-
if (hit)
|
|
132
|
-
out.set(r.commit.hash, hit.abstract);
|
|
133
|
-
}
|
|
134
|
-
return out.size > 0 ? out : undefined;
|
|
135
|
-
}
|
|
136
|
-
catch {
|
|
137
|
-
return undefined;
|
|
138
|
-
}
|
|
55
|
+
const tool = toolMap.get(req.params.name);
|
|
56
|
+
if (!tool) {
|
|
57
|
+
return toErrorResult(`unknown tool: ${req.params.name}. Call mneme.capabilities to list available tools.`);
|
|
139
58
|
}
|
|
140
59
|
try {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
store: s,
|
|
145
|
-
embedder,
|
|
146
|
-
repo: meta,
|
|
147
|
-
topK: typeof args["topK"] === "number" ? args["topK"] : 8,
|
|
148
|
-
});
|
|
149
|
-
return jsonResult(toAskPayload(result, htcCompressedFor(result.searchResults)));
|
|
150
|
-
}
|
|
151
|
-
case "mneme_search_commits": {
|
|
152
|
-
const results = await retrieve.search(String(args["query"] ?? ""), {
|
|
153
|
-
store: s,
|
|
154
|
-
embedder,
|
|
155
|
-
repo: meta,
|
|
156
|
-
topK: typeof args["topK"] === "number" ? args["topK"] : 8,
|
|
157
|
-
});
|
|
158
|
-
const compressed = htcCompressedFor(results);
|
|
159
|
-
return jsonResult(results.map((sr) => toSearchPayload(sr, compressed)));
|
|
160
|
-
}
|
|
161
|
-
case "mneme_why": {
|
|
162
|
-
const file = String(args["file"] ?? "");
|
|
163
|
-
const sl = typeof args["startLine"] === "number" ? args["startLine"] : undefined;
|
|
164
|
-
const el = typeof args["endLine"] === "number" ? args["endLine"] : undefined;
|
|
165
|
-
const blamed = await git.blame(meta.rootPath, file, sl, el);
|
|
166
|
-
const tally = new Map();
|
|
167
|
-
for (const b of blamed)
|
|
168
|
-
tally.set(b.commitHash, (tally.get(b.commitHash) ?? 0) + 1);
|
|
169
|
-
const top = Array.from(tally.entries())
|
|
170
|
-
.sort((a, b) => b[1] - a[1])
|
|
171
|
-
.slice(0, 8)
|
|
172
|
-
.map(([h, count]) => ({
|
|
173
|
-
commit: s.getCommit(h) ?? null,
|
|
174
|
-
hash: h,
|
|
175
|
-
lineCount: count,
|
|
176
|
-
}));
|
|
177
|
-
return jsonResult({ file, startLine: sl, endLine: el, originating: top });
|
|
178
|
-
}
|
|
179
|
-
case "mneme_status": {
|
|
180
|
-
return jsonResult({
|
|
181
|
-
commits: s.countCommits(),
|
|
182
|
-
chunks: s.countChunks(),
|
|
183
|
-
embedded: s.countChunksWithEmbedding(),
|
|
184
|
-
entities: s.countEntities(),
|
|
185
|
-
entitiesEmbedded: s.countEntitiesWithEmbedding(),
|
|
186
|
-
synthesizedNotes: s.countSynthesizedNotes(),
|
|
187
|
-
embedder: s.getMeta("embedder"),
|
|
188
|
-
repoRoot: meta.rootPath,
|
|
189
|
-
host: meta.host,
|
|
190
|
-
owner: meta.owner,
|
|
191
|
-
repo: meta.repo,
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
case "mneme_list_entities": {
|
|
195
|
-
const where = [];
|
|
196
|
-
const params = [];
|
|
197
|
-
if (args["kind"]) {
|
|
198
|
-
where.push("kind = ?");
|
|
199
|
-
params.push(String(args["kind"]));
|
|
200
|
-
}
|
|
201
|
-
if (args["language"]) {
|
|
202
|
-
where.push("language = ?");
|
|
203
|
-
params.push(String(args["language"]));
|
|
204
|
-
}
|
|
205
|
-
if (args["pathPrefix"]) {
|
|
206
|
-
where.push("file_path LIKE ?");
|
|
207
|
-
params.push(`${String(args["pathPrefix"])}%`);
|
|
208
|
-
}
|
|
209
|
-
const limit = typeof args["limit"] === "number" ? Math.min(500, args["limit"]) : 100;
|
|
210
|
-
const sql = "SELECT id, kind, name, file_path, start_line, end_line, signature, language FROM entities" +
|
|
211
|
-
(where.length ? " WHERE " + where.join(" AND ") : "") +
|
|
212
|
-
" ORDER BY file_path, start_line LIMIT ?";
|
|
213
|
-
const rows = s.db.prepare(sql).all(...params, limit);
|
|
214
|
-
return jsonResult({ entities: rows, count: rows.length });
|
|
215
|
-
}
|
|
216
|
-
case "mneme_find_similar": {
|
|
217
|
-
const topK = typeof args["topK"] === "number" ? args["topK"] : 5;
|
|
218
|
-
const entityId = args["entityId"] ? String(args["entityId"]) : undefined;
|
|
219
|
-
const snippet = args["snippet"] ? String(args["snippet"]) : undefined;
|
|
220
|
-
let queryVec = null;
|
|
221
|
-
if (entityId) {
|
|
222
|
-
// Use the stored embedding directly. node:sqlite returns BLOBs as
|
|
223
|
-
// Uint8Array; better-sqlite3 used to return Buffer. Both expose
|
|
224
|
-
// the same .buffer / .byteOffset / .byteLength shape, so the
|
|
225
|
-
// copy-out works identically.
|
|
226
|
-
const row = s.db
|
|
227
|
-
.prepare("SELECT embedding FROM entities WHERE id = ?")
|
|
228
|
-
.get(entityId);
|
|
229
|
-
if (!row?.embedding) {
|
|
230
|
-
return errorResult(`No embedding for entity ${entityId}. Run \`mneme entities\` first.`);
|
|
231
|
-
}
|
|
232
|
-
const blob = row.embedding;
|
|
233
|
-
const copy = new Uint8Array(blob.byteLength);
|
|
234
|
-
copy.set(blob);
|
|
235
|
-
queryVec = new Float32Array(copy.buffer, 0, copy.byteLength / 4);
|
|
236
|
-
}
|
|
237
|
-
else if (snippet) {
|
|
238
|
-
const [v] = await embedder.embed([snippet]);
|
|
239
|
-
queryVec = v ?? null;
|
|
240
|
-
}
|
|
241
|
-
else {
|
|
242
|
-
return errorResult("mneme_find_similar requires either entityId or snippet.");
|
|
243
|
-
}
|
|
244
|
-
if (!queryVec)
|
|
245
|
-
return jsonResult({ matches: [] });
|
|
246
|
-
const candidates = [];
|
|
247
|
-
for (const e of s.iterEmbeddedEntities()) {
|
|
248
|
-
if (!e.embedding)
|
|
249
|
-
continue;
|
|
250
|
-
if (entityId && e.id === entityId)
|
|
251
|
-
continue;
|
|
252
|
-
if (e.embedding.length !== queryVec.length)
|
|
253
|
-
continue;
|
|
254
|
-
let dot = 0;
|
|
255
|
-
let na = 0;
|
|
256
|
-
let nb = 0;
|
|
257
|
-
for (let i = 0; i < queryVec.length; i++) {
|
|
258
|
-
const av = queryVec[i];
|
|
259
|
-
const bv = e.embedding[i];
|
|
260
|
-
dot += av * bv;
|
|
261
|
-
na += av * av;
|
|
262
|
-
nb += bv * bv;
|
|
263
|
-
}
|
|
264
|
-
const denom = Math.sqrt(na) * Math.sqrt(nb);
|
|
265
|
-
const sim = denom === 0 ? 0 : dot / denom;
|
|
266
|
-
candidates.push({ entity: { ...e, embedding: undefined }, score: sim });
|
|
267
|
-
}
|
|
268
|
-
candidates.sort((a, b) => b.score - a.score);
|
|
269
|
-
return jsonResult({ matches: candidates.slice(0, topK) });
|
|
270
|
-
}
|
|
271
|
-
case "mneme_blast": {
|
|
272
|
-
const ref = String(args["commit"] ?? "");
|
|
273
|
-
if (!ref)
|
|
274
|
-
return errorResult("mneme_blast requires `commit`.");
|
|
275
|
-
const r = await git.execGit(["rev-parse", ref], { cwd: meta.rootPath });
|
|
276
|
-
if (r.code !== 0)
|
|
277
|
-
return errorResult(`Cannot resolve commit "${ref}".`);
|
|
278
|
-
const hash = r.stdout.trim();
|
|
279
|
-
const c = s.getCommit(hash);
|
|
280
|
-
if (!c)
|
|
281
|
-
return errorResult(`Commit ${hash.slice(0, 8)} not indexed.`);
|
|
282
|
-
const incidents = s.db
|
|
283
|
-
.prepare("SELECT * FROM incidents")
|
|
284
|
-
.all();
|
|
285
|
-
const cFiles = new Set(c.files.map((p) => p.replace(/\\/g, "/").toLowerCase()));
|
|
286
|
-
const matches = incidents
|
|
287
|
-
.map((i) => {
|
|
288
|
-
const inc = {
|
|
289
|
-
id: String(i.id),
|
|
290
|
-
title: String(i.title),
|
|
291
|
-
affected: i.affected_files
|
|
292
|
-
? JSON.parse(String(i.affected_files))
|
|
293
|
-
: [],
|
|
294
|
-
};
|
|
295
|
-
const overlap = inc.affected.filter((f) => cFiles.has(f.replace(/\\/g, "/").toLowerCase()));
|
|
296
|
-
return overlap.length > 0 ? { incident: inc, overlap } : null;
|
|
297
|
-
})
|
|
298
|
-
.filter((x) => x !== null);
|
|
299
|
-
return jsonResult({ commit: c.shortHash, fileCount: c.files.length, matches });
|
|
300
|
-
}
|
|
301
|
-
default:
|
|
302
|
-
return errorResult(`unknown tool: ${req.params.name}`);
|
|
303
|
-
}
|
|
60
|
+
const args = (req.params.arguments ?? {});
|
|
61
|
+
const response = await tool.handler(runtime, args);
|
|
62
|
+
return toCallResult(response);
|
|
304
63
|
}
|
|
305
64
|
catch (err) {
|
|
306
|
-
return
|
|
65
|
+
return toErrorResult(`${req.params.name} failed: ${err.message}. ` +
|
|
66
|
+
`If this tool requires the index, ask the user to run \`mneme index\`.`);
|
|
307
67
|
}
|
|
308
68
|
});
|
|
309
69
|
const transport = new StdioServerTransport();
|
|
310
70
|
await server.connect(transport);
|
|
311
71
|
}
|
|
312
|
-
function toAskPayload(r, compressedAbstracts) {
|
|
313
|
-
return {
|
|
314
|
-
question: r.question,
|
|
315
|
-
summary: r.summary,
|
|
316
|
-
citations: r.citations,
|
|
317
|
-
results: r.searchResults.map((s) => toSearchPayload(s, compressedAbstracts)),
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* v0.24 HTC: when an abstracts map is provided, emit the compressed payload
|
|
322
|
-
* (abstract, hash, subject only — drops raw body + full file list). MCP
|
|
323
|
-
* clients (Claude Code, Cursor, Codex) consume ~10× fewer tokens.
|
|
324
|
-
*
|
|
325
|
-
* Caller can opt back into raw with `compress=false` in tool args.
|
|
326
|
-
*/
|
|
327
|
-
function toSearchPayload(s, compressedAbstracts) {
|
|
328
|
-
if (compressedAbstracts && compressedAbstracts.has(s.commit.hash)) {
|
|
329
|
-
return {
|
|
330
|
-
score: s.score,
|
|
331
|
-
commit: {
|
|
332
|
-
hash: s.commit.hash,
|
|
333
|
-
shortHash: s.commit.shortHash,
|
|
334
|
-
date: s.commit.authorDate.slice(0, 10),
|
|
335
|
-
author: s.commit.authorName,
|
|
336
|
-
// Compressed abstract takes the place of subject + body
|
|
337
|
-
abstract: compressedAbstracts.get(s.commit.hash),
|
|
338
|
-
// Keep prNumber as a lightweight cross-ref
|
|
339
|
-
prNumber: s.commit.prNumber,
|
|
340
|
-
},
|
|
341
|
-
compressed: true,
|
|
342
|
-
matchedKinds: Array.from(new Set(s.matchedChunks.map((c) => c.kind))),
|
|
343
|
-
};
|
|
344
|
-
}
|
|
345
|
-
return {
|
|
346
|
-
score: s.score,
|
|
347
|
-
commit: {
|
|
348
|
-
hash: s.commit.hash,
|
|
349
|
-
shortHash: s.commit.shortHash,
|
|
350
|
-
author: s.commit.authorName,
|
|
351
|
-
date: s.commit.authorDate,
|
|
352
|
-
subject: s.commit.subject,
|
|
353
|
-
body: s.commit.body,
|
|
354
|
-
files: s.commit.files,
|
|
355
|
-
prNumber: s.commit.prNumber,
|
|
356
|
-
},
|
|
357
|
-
matchedKinds: Array.from(new Set(s.matchedChunks.map((c) => c.kind))),
|
|
358
|
-
};
|
|
359
|
-
}
|
|
360
|
-
function jsonResult(value) {
|
|
361
|
-
return {
|
|
362
|
-
content: [{ type: "text", text: JSON.stringify(value, null, 2) }],
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
|
-
function errorResult(message) {
|
|
366
|
-
return {
|
|
367
|
-
isError: true,
|
|
368
|
-
content: [{ type: "text", text: message }],
|
|
369
|
-
};
|
|
370
|
-
}
|
|
371
72
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GAGvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAqC,MAAM,gBAAgB,CAAC;AAC9F,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAMvD;8EAC8E;AAC9E,SAAS,cAAc;IACrB,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACrD,sDAAsD;QACtD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAE5E,CAAC;QACF,OAAO,GAAG,CAAC,OAAO,IAAI,OAAO,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAAC;AAED,MAAM,KAAK,GAAW;IACpB;QACE,IAAI,EAAE,WAAW;QACjB,WAAW,EACT,0HAA0H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M,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mneme.capabilities — the SYLLABUS tool.
|
|
3
|
+
*
|
|
4
|
+
* AI students should call this FIRST when they connect to Mneme. It returns
|
|
5
|
+
* a categorized index of every tool with WHEN-to-use guidance, so the AI
|
|
6
|
+
* builds a mental model of the catalog before picking individual tools.
|
|
7
|
+
*
|
|
8
|
+
* This tool embodies the Mneme positioning: "Mneme is the teacher. AI is the
|
|
9
|
+
* student." A good teacher hands the student a syllabus on day one — not a
|
|
10
|
+
* pile of unrelated lessons.
|
|
11
|
+
*/
|
|
12
|
+
import type { MnemeTool } from "./_types.js";
|
|
13
|
+
export declare const capabilitiesTool: MnemeTool;
|
|
14
|
+
//# sourceMappingURL=_capabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_capabilities.d.ts","sourceRoot":"","sources":["../../src/tools/_capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAgB,MAAM,aAAa,CAAC;AAqB3D,eAAO,MAAM,gBAAgB,EAAE,SA0D9B,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mneme.capabilities — the SYLLABUS tool.
|
|
3
|
+
*
|
|
4
|
+
* AI students should call this FIRST when they connect to Mneme. It returns
|
|
5
|
+
* a categorized index of every tool with WHEN-to-use guidance, so the AI
|
|
6
|
+
* builds a mental model of the catalog before picking individual tools.
|
|
7
|
+
*
|
|
8
|
+
* This tool embodies the Mneme positioning: "Mneme is the teacher. AI is the
|
|
9
|
+
* student." A good teacher hands the student a syllabus on day one — not a
|
|
10
|
+
* pile of unrelated lessons.
|
|
11
|
+
*/
|
|
12
|
+
import { groupByCategory } from "./_registry.js";
|
|
13
|
+
const CATEGORY_DESCRIPTIONS = {
|
|
14
|
+
memory: "Q&A, semantic search, citations. Pick from here when the user asks WHY code exists, when something was added, or wants to find related commits.",
|
|
15
|
+
people: "Contributors, knowledge atrophy, telepathic teammates, cultural alphas, semantic ownership. Pick from here when the user asks about PEOPLE.",
|
|
16
|
+
audit: "AI Session Audit — trust certificate for every AI commit. Vendor-neutral. Pick from here when the user asks 'is this AI commit safe?'.",
|
|
17
|
+
forensics: "Security: vuln-hunt, anomaly detection, authorship attribution. Pick from here when the user asks about security or suspicious commits.",
|
|
18
|
+
insights: "Storytelling, regret-mining, prediction. Pick from here for 'tell me the story', 'what should we worry about', 'what could break'.",
|
|
19
|
+
quality: "Code/repo health, palimpsest causal chains, twin rewriting, cognitive fingerprints. Pick from here for quality + voice + history.",
|
|
20
|
+
quant: "Wall-Street-inspired metrics: drawdown, alpha, Greeks, moneyball, black-swan. Pick when user wants quantitative analysis of engineering data.",
|
|
21
|
+
lab: "Periodic Table + Second Brain + Wisdom Mutant. Compose new workflows, save recipes, recalibrate. Pick when user wants to build/run custom plans.",
|
|
22
|
+
meta: "Doctor, manifesto, wisdom, advanced help — informational only.",
|
|
23
|
+
};
|
|
24
|
+
export const capabilitiesTool = {
|
|
25
|
+
name: "mneme.capabilities",
|
|
26
|
+
category: "meta",
|
|
27
|
+
description: "Return Mneme's full tool catalog organized by category, with WHEN-to-use guidance for each. " +
|
|
28
|
+
"**AI clients should call this FIRST when they connect** — it's the syllabus that teaches you what kind of question " +
|
|
29
|
+
"goes to which group of tools. Mneme is the teacher; this tool hands you the curriculum.",
|
|
30
|
+
triggers: [
|
|
31
|
+
"what can mneme do?",
|
|
32
|
+
"list mneme tools",
|
|
33
|
+
"mneme capabilities",
|
|
34
|
+
],
|
|
35
|
+
inputSchema: {
|
|
36
|
+
type: "object",
|
|
37
|
+
properties: {
|
|
38
|
+
category: {
|
|
39
|
+
type: "string",
|
|
40
|
+
description: "Optional: filter to one category (memory | people | audit | forensics | insights | quality | quant | lab | meta).",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
handler: async (_rt, args) => {
|
|
45
|
+
const grouped = groupByCategory();
|
|
46
|
+
const filter = args["category"] ? String(args["category"]) : undefined;
|
|
47
|
+
const data = {};
|
|
48
|
+
for (const [category, tools] of grouped) {
|
|
49
|
+
if (filter && filter !== category)
|
|
50
|
+
continue;
|
|
51
|
+
data[category] = {
|
|
52
|
+
purpose: CATEGORY_DESCRIPTIONS[category],
|
|
53
|
+
tools: tools.map((t) => ({
|
|
54
|
+
name: t.name,
|
|
55
|
+
description: t.description,
|
|
56
|
+
triggers: t.triggers,
|
|
57
|
+
})),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const total = Object.values(data).reduce((s, c) => s + (c.tools?.length ?? 0), 0);
|
|
61
|
+
return {
|
|
62
|
+
data: {
|
|
63
|
+
positioning: "Mneme is a TUNING KIT for AI coding tools. Bolted on via MCP, it turns Claude Code / Cursor / Codex / " +
|
|
64
|
+
"Gemini / Continue / Aider into a SUPER-GENIUS that knows your repo's history, decisions, and incidents. " +
|
|
65
|
+
"Mneme is the teacher; the AI is the student. This catalog is the syllabus.",
|
|
66
|
+
totalTools: total,
|
|
67
|
+
catalog: data,
|
|
68
|
+
},
|
|
69
|
+
wisdom: `Mneme exposes ${total} tools across 9 categories. As you receive user queries, match the user's intent to the ` +
|
|
70
|
+
`descriptions + triggers in this catalog. Prefer specific tools (mneme.<category>.<verb>) over the generic ` +
|
|
71
|
+
`mneme.smart_do dispatcher. If the user's request is ambiguous, ask a clarifying question rather than guessing.`,
|
|
72
|
+
followUp: ["mneme.memory.status"],
|
|
73
|
+
confidence: { level: "high" },
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=_capabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_capabilities.js","sourceRoot":"","sources":["../../src/tools/_capab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ACxC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;oBACvB,IAAI,EAAE,CAAC,CAAC,IAAI;oBACZ,WAAW,EAAE,CAAC,CAAC,WAAW;oBAC1B,QAAQ,EAAE,CAAC,CAAC,QAAQ;iBACrB,CAAC,CAAC;aACJ,CAAC;QACJ,CAAC;QACD,MAAM,KAAK,GAAW,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAC9C,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAE,CAA2B,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC,CAAC,EAC/D,CAAC,CACF,CAAC;QACF,OAAO;YACL,IAAI,EAAE;gBACJ,WAAW,EACT,wGAAwG;oBACxG,0GAA0G;oBAC1G,4EAA4E;gBAC9E,UAAU,EAAE,KAAK;gBACjB,OAAO,EAAE,IAAI;aACd;YACD,MAAM,EACJ,iBAAiB,KAAK,0FAA0F;gBAChH,4GAA4G;gBAC5G,gHAAgH;YAClH,QAAQ,EAAE,CAAC,qBAAqB,CAAC;YACjC,UAAU,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;SAC9B,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool registry — collects all category modules into one ordered list +
|
|
3
|
+
* a fast lookup map. Each category file exports a `tools: MnemeTool[]`
|
|
4
|
+
* array; the registry concatenates them and surfaces them to the MCP
|
|
5
|
+
* server as one flat catalog (with namespaced names like
|
|
6
|
+
* `mneme.people.atrophy` for AI client navigation).
|
|
7
|
+
*/
|
|
8
|
+
import type { MnemeTool, ToolCategory } from "./_types.js";
|
|
9
|
+
/** All Mneme tools, in display order. The capabilities syllabus comes first
|
|
10
|
+
* so AI clients that read tool lists top-down see it immediately. */
|
|
11
|
+
export declare function buildAllTools(): MnemeTool[];
|
|
12
|
+
/** Build a fast lookup table keyed by tool name */
|
|
13
|
+
export declare function buildToolMap(): Map<string, MnemeTool>;
|
|
14
|
+
/** Group tools by category — used by the capabilities syllabus tool */
|
|
15
|
+
export declare function groupByCategory(): Map<ToolCategory, MnemeTool[]>;
|
|
16
|
+
//# sourceMappingURL=_registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_registry.d.ts","sourceRoot":"","sources":["../../src/tools/_registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAc3D;sEACsE;AACtE,wBAAgB,aAAa,IAAI,SAAS,EAAE,CAc3C;AAED,mDAAmD;AACnD,wBAAgB,YAAY,IAAI,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CASrD;AAED,uEAAuE;AACvE,wBAAgB,eAAe,IAAI,GAAG,CAAC,YAAY,EAAE,SAAS,EAAE,CAAC,CAOhE"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool registry — collects all category modules into one ordered list +
|
|
3
|
+
* a fast lookup map. Each category file exports a `tools: MnemeTool[]`
|
|
4
|
+
* array; the registry concatenates them and surfaces them to the MCP
|
|
5
|
+
* server as one flat catalog (with namespaced names like
|
|
6
|
+
* `mneme.people.atrophy` for AI client navigation).
|
|
7
|
+
*/
|
|
8
|
+
import { memoryTools } from "./memory.js";
|
|
9
|
+
import { peopleTools } from "./people.js";
|
|
10
|
+
import { auditTools } from "./audit.js";
|
|
11
|
+
import { forensicsTools } from "./forensics.js";
|
|
12
|
+
import { insightsTools } from "./insights.js";
|
|
13
|
+
import { qualityTools } from "./quality.js";
|
|
14
|
+
import { quantTools } from "./quant.js";
|
|
15
|
+
import { labTools } from "./lab.js";
|
|
16
|
+
import { metaTools } from "./meta.js";
|
|
17
|
+
import { capabilitiesTool } from "./_capabilities.js";
|
|
18
|
+
import { smartDoTool } from "./_smart_do.js";
|
|
19
|
+
/** All Mneme tools, in display order. The capabilities syllabus comes first
|
|
20
|
+
* so AI clients that read tool lists top-down see it immediately. */
|
|
21
|
+
export function buildAllTools() {
|
|
22
|
+
return [
|
|
23
|
+
capabilitiesTool,
|
|
24
|
+
smartDoTool,
|
|
25
|
+
...memoryTools,
|
|
26
|
+
...peopleTools,
|
|
27
|
+
...auditTools,
|
|
28
|
+
...forensicsTools,
|
|
29
|
+
...insightsTools,
|
|
30
|
+
...qualityTools,
|
|
31
|
+
...quantTools,
|
|
32
|
+
...labTools,
|
|
33
|
+
...metaTools,
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
/** Build a fast lookup table keyed by tool name */
|
|
37
|
+
export function buildToolMap() {
|
|
38
|
+
const out = new Map();
|
|
39
|
+
for (const t of buildAllTools()) {
|
|
40
|
+
if (out.has(t.name)) {
|
|
41
|
+
throw new Error(`MCP tool name collision: ${t.name}`);
|
|
42
|
+
}
|
|
43
|
+
out.set(t.name, t);
|
|
44
|
+
}
|
|
45
|
+
return out;
|
|
46
|
+
}
|
|
47
|
+
/** Group tools by category — used by the capabilities syllabus tool */
|
|
48
|
+
export function groupByCategory() {
|
|
49
|
+
const out = new Map();
|
|
50
|
+
for (const t of buildAllTools()) {
|
|
51
|
+
if (!out.has(t.category))
|
|
52
|
+
out.set(t.category, []);
|
|
53
|
+
out.get(t.category).push(t);
|
|
54
|
+
}
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=_registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_registry.js","sourceRoot":"","sources":["../../src/tools/_registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,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