@membank/mcp 0.8.0 → 0.10.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.mjs CHANGED
@@ -1,7 +1,33 @@
1
1
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
2
- import { DatabaseManager, EmbeddingService, MEMORY_TYPE_VALUES, MIGRATIONS, MemoryRepository, ProjectRepository, QueryEngine, listMemoryTypes, resolveProject, runScopeToProjectsMigration } from "@membank/core";
2
+ import { DatabaseManager, EmbeddingService, MEMORY_TYPE_VALUES, MIGRATIONS, MemoryRepository, MemoryTypeSchema, ProjectRepository, QueryEngine, listMemoryTypes, resolveProject, runScopeToProjectsMigration } from "@membank/core";
3
3
  import { Server } from "@modelcontextprotocol/sdk/server";
4
4
  import { CallToolRequestSchema, ErrorCode, ListToolsRequestSchema, McpError } from "@modelcontextprotocol/sdk/types.js";
5
+ import { ZodError, z } from "zod";
6
+ //#region src/schemas.ts
7
+ const SaveMemoryArgsSchema = z.object({
8
+ content: z.string().min(1),
9
+ type: MemoryTypeSchema,
10
+ tags: z.array(z.string()).optional(),
11
+ global: z.boolean().optional()
12
+ });
13
+ const UpdateMemoryArgsSchema = z.object({
14
+ id: z.string().min(1),
15
+ content: z.string().min(1),
16
+ tags: z.array(z.string()).optional()
17
+ });
18
+ const DeleteMemoryArgsSchema = z.object({ id: z.string().min(1) });
19
+ const QueryMemoryArgsSchema = z.object({
20
+ query: z.string().min(1),
21
+ type: MemoryTypeSchema.optional(),
22
+ limit: z.number().int().positive().optional(),
23
+ includePinned: z.boolean().optional()
24
+ });
25
+ const MigrateArgsSchema = z.discriminatedUnion("mode", [z.object({ mode: z.literal("list") }), z.object({
26
+ mode: z.literal("run"),
27
+ name: z.string().min(1)
28
+ })]);
29
+ const PinMemoryArgsSchema = z.object({ id: z.string().min(1) });
30
+ //#endregion
5
31
  //#region src/server.ts
6
32
  const SERVER_NAME = "membank";
7
33
  const SERVER_VERSION = "0.1.0";
@@ -18,6 +44,14 @@ function initCore(options = {}) {
18
44
  projects
19
45
  };
20
46
  }
47
+ function parseArgs(schema, raw) {
48
+ try {
49
+ return schema.parse(raw);
50
+ } catch (e) {
51
+ const msg = e instanceof ZodError ? e.issues[0]?.message ?? e.message : String(e);
52
+ throw new McpError(ErrorCode.InvalidParams, msg);
53
+ }
54
+ }
21
55
  function createServer(core) {
22
56
  const server = new Server({
23
57
  name: SERVER_NAME,
@@ -114,6 +148,10 @@ function createServer(core) {
114
148
  limit: {
115
149
  type: "number",
116
150
  description: "Maximum results to return (default 10)"
151
+ },
152
+ includePinned: {
153
+ type: "boolean",
154
+ description: "Include pinned memories in results. Pinned memories are already injected into session context, so excluded by default to avoid duplicates."
117
155
  }
118
156
  },
119
157
  required: ["query"]
@@ -179,18 +217,13 @@ function createServer(core) {
179
217
  };
180
218
  }
181
219
  if (request.params.name === "save_memory") {
182
- const args = request.params.arguments;
183
- const content = args?.content;
184
- const type = args?.type;
185
- if (typeof content !== "string" || content.trim() === "") throw new McpError(ErrorCode.InvalidParams, "content is required and must be a non-empty string");
186
- if (typeof type !== "string" || !MEMORY_TYPE_VALUES.includes(type)) throw new McpError(ErrorCode.InvalidParams, "type is required and must be one of: correction, preference, decision, learning, fact");
187
- const tags = Array.isArray(args?.tags) ? args.tags : void 0;
188
- const projectScope = args?.global === true ? void 0 : await resolveProject();
220
+ const args = parseArgs(SaveMemoryArgsSchema, request.params.arguments);
221
+ const projectScope = args.global === true ? void 0 : await resolveProject();
189
222
  try {
190
223
  const memory = await core.repo.save({
191
- content,
192
- type,
193
- tags,
224
+ content: args.content,
225
+ type: args.type,
226
+ tags: args.tags,
194
227
  projectScope
195
228
  });
196
229
  return { content: [{
@@ -208,16 +241,11 @@ function createServer(core) {
208
241
  }
209
242
  }
210
243
  if (request.params.name === "update_memory") {
211
- const args = request.params.arguments;
212
- const id = args?.id;
213
- const content = args?.content;
214
- if (typeof id !== "string" || id.trim() === "") throw new McpError(ErrorCode.InvalidParams, "id is required and must be a non-empty string");
215
- if (typeof content !== "string" || content.trim() === "") throw new McpError(ErrorCode.InvalidParams, "content is required and must be a non-empty string");
216
- const tags = Array.isArray(args?.tags) ? args.tags : void 0;
244
+ const args = parseArgs(UpdateMemoryArgsSchema, request.params.arguments);
217
245
  try {
218
- const memory = await core.repo.update(id, {
219
- content,
220
- tags
246
+ const memory = await core.repo.update(args.id, {
247
+ content: args.content,
248
+ tags: args.tags
221
249
  });
222
250
  return { content: [{
223
251
  type: "text",
@@ -234,22 +262,21 @@ function createServer(core) {
234
262
  }
235
263
  }
236
264
  if (request.params.name === "delete_memory") {
237
- const id = request.params.arguments?.id;
238
- if (typeof id !== "string" || id.trim() === "") throw new McpError(ErrorCode.InvalidParams, "id is required and must be a non-empty string");
265
+ const args = parseArgs(DeleteMemoryArgsSchema, request.params.arguments);
239
266
  try {
240
- if (!(core.db.db.prepare(`SELECT id FROM memories WHERE id = ?`).get(id) !== void 0)) return {
267
+ if (!(core.db.db.prepare(`SELECT id FROM memories WHERE id = ?`).get(args.id) !== void 0)) return {
241
268
  content: [{
242
269
  type: "text",
243
- text: `Memory not found: ${id}`
270
+ text: `Memory not found: ${args.id}`
244
271
  }],
245
272
  isError: true
246
273
  };
247
- await core.repo.delete(id);
274
+ await core.repo.delete(args.id);
248
275
  return { content: [{
249
276
  type: "text",
250
277
  text: JSON.stringify({
251
278
  success: true,
252
- id
279
+ id: args.id
253
280
  })
254
281
  }] };
255
282
  } catch (err) {
@@ -263,16 +290,13 @@ function createServer(core) {
263
290
  }
264
291
  }
265
292
  if (request.params.name === "query_memory") {
266
- const args = request.params.arguments;
267
- const queryText = args?.query;
268
- if (typeof queryText !== "string" || queryText.trim() === "") throw new McpError(ErrorCode.InvalidParams, "query is required and must be a non-empty string");
269
- const type = args?.type;
270
- const limit = typeof args?.limit === "number" ? args.limit : 10;
293
+ const args = parseArgs(QueryMemoryArgsSchema, request.params.arguments);
271
294
  try {
272
295
  const serialised = (await core.query.query({
273
- query: queryText,
274
- type,
275
- limit
296
+ query: args.query,
297
+ type: args.type,
298
+ limit: args.limit ?? 10,
299
+ includePinned: args.includePinned
276
300
  })).map((r) => ({
277
301
  id: r.id,
278
302
  content: r.content,
@@ -280,6 +304,7 @@ function createServer(core) {
280
304
  tags: r.tags,
281
305
  projects: r.projects,
282
306
  pinned: r.pinned,
307
+ reviewEvents: r.reviewEvents,
283
308
  score: r.score
284
309
  }));
285
310
  return { content: [{
@@ -297,16 +322,12 @@ function createServer(core) {
297
322
  }
298
323
  }
299
324
  if (request.params.name === "migrate") {
300
- const args = request.params.arguments;
301
- const mode = args?.mode;
302
- if (mode !== "list" && mode !== "run") throw new McpError(ErrorCode.InvalidParams, "mode must be \"list\" or \"run\"");
303
- if (mode === "list") return { content: [{
325
+ const args = parseArgs(MigrateArgsSchema, request.params.arguments);
326
+ if (args.mode === "list") return { content: [{
304
327
  type: "text",
305
328
  text: JSON.stringify(MIGRATIONS)
306
329
  }] };
307
- const migrationName = args?.name;
308
- if (typeof migrationName !== "string" || migrationName.trim() === "") throw new McpError(ErrorCode.InvalidParams, "name is required for run mode");
309
- if (migrationName === "scope-to-projects") try {
330
+ if (args.name === "scope-to-projects") try {
310
331
  const result = await runScopeToProjectsMigration(core.projects);
311
332
  if (result === null) return {
312
333
  content: [{
@@ -328,14 +349,13 @@ function createServer(core) {
328
349
  isError: true
329
350
  };
330
351
  }
331
- throw new McpError(ErrorCode.InvalidParams, `Unknown migration: "${migrationName}". Available: ${MIGRATIONS.map((m) => m.name).join(", ")}`);
352
+ throw new McpError(ErrorCode.InvalidParams, `Unknown migration: "${args.name}". Available: ${MIGRATIONS.map((m) => m.name).join(", ")}`);
332
353
  }
333
354
  if (request.params.name === "pin_memory" || request.params.name === "unpin_memory") {
334
- const id = request.params.arguments?.id;
335
- if (typeof id !== "string" || id.trim() === "") throw new McpError(ErrorCode.InvalidParams, "id is required and must be a non-empty string");
355
+ const args = parseArgs(PinMemoryArgsSchema, request.params.arguments);
336
356
  const pinned = request.params.name === "pin_memory";
337
357
  try {
338
- const memory = core.repo.setPin(id, pinned);
358
+ const memory = core.repo.setPin(args.id, pinned);
339
359
  return { content: [{
340
360
  type: "text",
341
361
  text: JSON.stringify(memory)
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/server.ts","../src/index.ts"],"sourcesContent":["import type { MemoryType } from \"@membank/core\";\nimport {\n DatabaseManager,\n EmbeddingService,\n listMemoryTypes,\n MEMORY_TYPE_VALUES,\n MemoryRepository,\n MIGRATIONS,\n ProjectRepository,\n QueryEngine,\n resolveProject,\n runScopeToProjectsMigration,\n} from \"@membank/core\";\nimport { Server } from \"@modelcontextprotocol/sdk/server\";\nimport {\n CallToolRequestSchema,\n ErrorCode,\n ListToolsRequestSchema,\n McpError,\n} from \"@modelcontextprotocol/sdk/types.js\";\n\nconst SERVER_NAME = \"membank\";\nconst SERVER_VERSION = \"0.1.0\";\n\nexport interface CoreServices {\n db: DatabaseManager;\n embedding: EmbeddingService;\n repo: MemoryRepository;\n query: QueryEngine;\n projects: ProjectRepository;\n}\n\nexport interface ServerOptions {\n dbPath?: string;\n useInMemoryDb?: boolean;\n}\n\nexport function initCore(options: ServerOptions = {}): CoreServices {\n const db = options.useInMemoryDb\n ? DatabaseManager.openInMemory()\n : DatabaseManager.open(options.dbPath);\n const embedding = new EmbeddingService();\n const projects = new ProjectRepository(db);\n const repo = new MemoryRepository(db, embedding, projects);\n const query = new QueryEngine(db, embedding, repo);\n return { db, embedding, repo, query, projects };\n}\n\nexport function createServer(core: CoreServices): Server {\n const server = new Server(\n { name: SERVER_NAME, version: SERVER_VERSION },\n { capabilities: { tools: {} } }\n );\n\n server.setRequestHandler(ListToolsRequestSchema, () => ({\n tools: [\n {\n name: \"list_memory_types\",\n description: \"Returns the ordered list of memory type values supported by membank.\",\n inputSchema: { type: \"object\", properties: {}, required: [] },\n },\n {\n name: \"save_memory\",\n description:\n \"Save a new memory. Handles deduplication automatically — near-identical memories (cosine similarity >0.92, same type and project) overwrite the existing record.\",\n inputSchema: {\n type: \"object\",\n properties: {\n content: { type: \"string\", description: \"Memory content to save\" },\n type: {\n type: \"string\",\n enum: [...MEMORY_TYPE_VALUES],\n description: \"Memory type\",\n },\n tags: {\n type: \"array\",\n items: { type: \"string\" },\n description: \"Optional tags\",\n },\n global: {\n type: \"boolean\",\n description: \"Save as a global memory, not tied to any project\",\n },\n },\n required: [\"content\", \"type\"],\n },\n },\n {\n name: \"update_memory\",\n description: \"Update the content and/or tags of an existing memory by id.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\", description: \"Memory id to update\" },\n content: { type: \"string\", description: \"New content for the memory\" },\n tags: {\n type: \"array\",\n items: { type: \"string\" },\n description: \"Replacement tags (optional)\",\n },\n },\n required: [\"id\", \"content\"],\n },\n },\n {\n name: \"delete_memory\",\n description: \"Delete a memory by id.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\", description: \"Memory id to delete\" },\n },\n required: [\"id\"],\n },\n },\n {\n name: \"query_memory\",\n description:\n \"Search memories by semantic similarity. Returns results ranked by confidence score.\",\n inputSchema: {\n type: \"object\",\n properties: {\n query: { type: \"string\", description: \"Search text\" },\n type: {\n type: \"string\",\n enum: [...MEMORY_TYPE_VALUES],\n description: \"Filter by memory type\",\n },\n limit: { type: \"number\", description: \"Maximum results to return (default 10)\" },\n },\n required: [\"query\"],\n },\n },\n {\n name: \"migrate\",\n description:\n 'List or run named data migrations. Use mode \"list\" to see available migrations; mode \"run\" with a migration name to execute one.',\n inputSchema: {\n type: \"object\",\n properties: {\n mode: {\n type: \"string\",\n enum: [\"list\", \"run\"],\n description: 'Mode: \"list\" to see available migrations, \"run\" to execute one',\n },\n name: {\n type: \"string\",\n description: 'Migration name (required when mode is \"run\")',\n },\n },\n required: [\"mode\"],\n },\n },\n {\n name: \"pin_memory\",\n description:\n \"Pin a memory by id. Pinned memories are always injected into the session context.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\", description: \"Memory id to pin\" },\n },\n required: [\"id\"],\n },\n },\n {\n name: \"unpin_memory\",\n description: \"Unpin a memory by id. Removes the memory from guaranteed session injection.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\", description: \"Memory id to unpin\" },\n },\n required: [\"id\"],\n },\n },\n ],\n }));\n\n server.setRequestHandler(CallToolRequestSchema, async (request) => {\n if (request.params.name === \"list_memory_types\") {\n try {\n return {\n content: [{ type: \"text\", text: JSON.stringify(listMemoryTypes()) }],\n };\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n return { content: [{ type: \"text\", text: message }], isError: true };\n }\n }\n\n if (request.params.name === \"save_memory\") {\n const args = request.params.arguments as Record<string, unknown> | undefined;\n const content = args?.content;\n const type = args?.type;\n\n if (typeof content !== \"string\" || content.trim() === \"\") {\n throw new McpError(\n ErrorCode.InvalidParams,\n \"content is required and must be a non-empty string\"\n );\n }\n\n if (typeof type !== \"string\" || !(MEMORY_TYPE_VALUES as readonly string[]).includes(type)) {\n throw new McpError(\n ErrorCode.InvalidParams,\n \"type is required and must be one of: correction, preference, decision, learning, fact\"\n );\n }\n\n const tags = Array.isArray(args?.tags) ? (args.tags as string[]) : undefined;\n\n const projectScope = args?.global === true ? undefined : await resolveProject();\n\n try {\n const memory = await core.repo.save({\n content,\n type: type as MemoryType,\n tags,\n projectScope,\n });\n\n return {\n content: [{ type: \"text\", text: JSON.stringify(memory) }],\n };\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n return { content: [{ type: \"text\", text: message }], isError: true };\n }\n }\n\n if (request.params.name === \"update_memory\") {\n const args = request.params.arguments as Record<string, unknown> | undefined;\n const id = args?.id;\n const content = args?.content;\n\n if (typeof id !== \"string\" || id.trim() === \"\") {\n throw new McpError(\n ErrorCode.InvalidParams,\n \"id is required and must be a non-empty string\"\n );\n }\n\n if (typeof content !== \"string\" || content.trim() === \"\") {\n throw new McpError(\n ErrorCode.InvalidParams,\n \"content is required and must be a non-empty string\"\n );\n }\n\n const tags = Array.isArray(args?.tags) ? (args.tags as string[]) : undefined;\n\n try {\n const memory = await core.repo.update(id, { content, tags });\n return { content: [{ type: \"text\", text: JSON.stringify(memory) }] };\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n return { content: [{ type: \"text\", text: message }], isError: true };\n }\n }\n\n if (request.params.name === \"delete_memory\") {\n const args = request.params.arguments as Record<string, unknown> | undefined;\n const id = args?.id;\n\n if (typeof id !== \"string\" || id.trim() === \"\") {\n throw new McpError(\n ErrorCode.InvalidParams,\n \"id is required and must be a non-empty string\"\n );\n }\n\n try {\n const exists =\n core.db.db\n .prepare<[string], { id: string }>(`SELECT id FROM memories WHERE id = ?`)\n .get(id) !== undefined;\n\n if (!exists) {\n return {\n content: [{ type: \"text\", text: `Memory not found: ${id}` }],\n isError: true,\n };\n }\n\n await core.repo.delete(id);\n return { content: [{ type: \"text\", text: JSON.stringify({ success: true, id }) }] };\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n return { content: [{ type: \"text\", text: message }], isError: true };\n }\n }\n\n if (request.params.name === \"query_memory\") {\n const args = request.params.arguments as Record<string, unknown> | undefined;\n const queryText = args?.query;\n\n if (typeof queryText !== \"string\" || queryText.trim() === \"\") {\n throw new McpError(\n ErrorCode.InvalidParams,\n \"query is required and must be a non-empty string\"\n );\n }\n\n const type = args?.type as MemoryType | undefined;\n const limit = typeof args?.limit === \"number\" ? args.limit : 10;\n\n try {\n const results = await core.query.query({ query: queryText, type, limit });\n\n const serialised = results.map((r) => ({\n id: r.id,\n content: r.content,\n type: r.type,\n tags: r.tags,\n projects: r.projects,\n pinned: r.pinned,\n score: r.score,\n }));\n\n return {\n content: [{ type: \"text\", text: JSON.stringify(serialised) }],\n };\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n return { content: [{ type: \"text\", text: message }], isError: true };\n }\n }\n\n if (request.params.name === \"migrate\") {\n const args = request.params.arguments as Record<string, unknown> | undefined;\n const mode = args?.mode;\n\n if (mode !== \"list\" && mode !== \"run\") {\n throw new McpError(ErrorCode.InvalidParams, 'mode must be \"list\" or \"run\"');\n }\n\n if (mode === \"list\") {\n return {\n content: [{ type: \"text\", text: JSON.stringify(MIGRATIONS) }],\n };\n }\n\n const migrationName = args?.name;\n if (typeof migrationName !== \"string\" || migrationName.trim() === \"\") {\n throw new McpError(ErrorCode.InvalidParams, \"name is required for run mode\");\n }\n\n if (migrationName === \"scope-to-projects\") {\n try {\n const result = await runScopeToProjectsMigration(core.projects);\n if (result === null) {\n return {\n content: [\n {\n type: \"text\",\n text: JSON.stringify({ error: \"No project found for current directory.\" }),\n },\n ],\n isError: true,\n };\n }\n return {\n content: [{ type: \"text\", text: JSON.stringify(result) }],\n };\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n return { content: [{ type: \"text\", text: message }], isError: true };\n }\n }\n\n throw new McpError(\n ErrorCode.InvalidParams,\n `Unknown migration: \"${migrationName}\". Available: ${MIGRATIONS.map((m) => m.name).join(\", \")}`\n );\n }\n\n if (request.params.name === \"pin_memory\" || request.params.name === \"unpin_memory\") {\n const args = request.params.arguments as Record<string, unknown> | undefined;\n const id = args?.id;\n\n if (typeof id !== \"string\" || id.trim() === \"\") {\n throw new McpError(\n ErrorCode.InvalidParams,\n \"id is required and must be a non-empty string\"\n );\n }\n\n const pinned = request.params.name === \"pin_memory\";\n\n try {\n const memory = core.repo.setPin(id, pinned);\n return { content: [{ type: \"text\", text: JSON.stringify(memory) }] };\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n return { content: [{ type: \"text\", text: message }], isError: true };\n }\n }\n\n throw new Error(`Unknown tool: ${request.params.name}`);\n });\n\n return server;\n}\n","import { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport type { CoreServices } from \"./server.js\";\nimport { createServer, initCore } from \"./server.js\";\n\nexport async function startServer(): Promise<void> {\n let core: CoreServices;\n try {\n core = initCore();\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n process.stderr.write(`membank: failed to initialise core: ${message}\\n`);\n process.exit(1);\n }\n\n const server = createServer(core);\n const transport = new StdioServerTransport();\n await server.connect(transport);\n}\n"],"mappings":";;;;;AAqBA,MAAM,cAAc;AACpB,MAAM,iBAAiB;AAevB,SAAgB,SAAS,UAAyB,EAAE,EAAgB;CAClE,MAAM,KAAK,QAAQ,gBACf,gBAAgB,cAAc,GAC9B,gBAAgB,KAAK,QAAQ,OAAO;CACxC,MAAM,YAAY,IAAI,kBAAkB;CACxC,MAAM,WAAW,IAAI,kBAAkB,GAAG;CAC1C,MAAM,OAAO,IAAI,iBAAiB,IAAI,WAAW,SAAS;AAE1D,QAAO;EAAE;EAAI;EAAW;EAAM,OAAA,IADZ,YAAY,IAAI,WAAW,KACV;EAAE;EAAU;;AAGjD,SAAgB,aAAa,MAA4B;CACvD,MAAM,SAAS,IAAI,OACjB;EAAE,MAAM;EAAa,SAAS;EAAgB,EAC9C,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE,EAAE,CAChC;AAED,QAAO,kBAAkB,+BAA+B,EACtD,OAAO;EACL;GACE,MAAM;GACN,aAAa;GACb,aAAa;IAAE,MAAM;IAAU,YAAY,EAAE;IAAE,UAAU,EAAE;IAAE;GAC9D;EACD;GACE,MAAM;GACN,aACE;GACF,aAAa;IACX,MAAM;IACN,YAAY;KACV,SAAS;MAAE,MAAM;MAAU,aAAa;MAA0B;KAClE,MAAM;MACJ,MAAM;MACN,MAAM,CAAC,GAAG,mBAAmB;MAC7B,aAAa;MACd;KACD,MAAM;MACJ,MAAM;MACN,OAAO,EAAE,MAAM,UAAU;MACzB,aAAa;MACd;KACD,QAAQ;MACN,MAAM;MACN,aAAa;MACd;KACF;IACD,UAAU,CAAC,WAAW,OAAO;IAC9B;GACF;EACD;GACE,MAAM;GACN,aAAa;GACb,aAAa;IACX,MAAM;IACN,YAAY;KACV,IAAI;MAAE,MAAM;MAAU,aAAa;MAAuB;KAC1D,SAAS;MAAE,MAAM;MAA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MAAQ,MADnB,eAAe,QAAQ,IAAI,UAAU,OAAO,IAAI;MACd,CAAC;KAAE,SAAS;KAAM;;AAIxE,SAAM,IAAI,SACR,UAAU,eACV,uBAAuB,cAAc,gBAAgB,WAAW,KAAK,MAAM,EAAE,KAAK,CAAC,KAAK,KAAK,GAC9F;;AAGH,MAAI,QAAQ,OAAO,SAAS,gBAAgB,QAAQ,OAAO,SAAS,gBAAgB;GAElF,MAAM,KADO,QAAQ,OAAO,WACX;AAEjB,OAAI,OAAO,OAAO,YAAY,GAAG,MAAM,KAAK,GAC1C,OAAM,IAAI,SACR,UAAU,eACV,gDACD;GAGH,MAAM,SAAS,QAAQ,OAAO,SAAS;AAEvC,OAAI;IACF,MAAM,SAAS,KAAK,KAAK,OAAO,IAAI,OAAO;AAC3C,WAAO,EAAE,SAAS,CAAC;KAAE,MAAM;KAAQ,MAAM,KAAK,UAAU,OAAO;KAAE,CAAC,EAAE;YAC7D,KAAK;AAEZ,WAAO;KAAE,SAAS,CAAC;MAAE,MAAM;MAAQ,MADnB,eAAe,QAAQ,IAAI,UAAU,OAAO,IAAI;MACd,CAAC;KAAE,SAAS;KAAM;;;AAIxE,QAAM,IAAI,MAAM,iBAAiB,QAAQ,OAAO,OAAO;GACvD;AAEF,QAAO;;;;AC9YT,eAAsB,cAA6B;CACjD,IAAI;AACJ,KAAI;AACF,SAAO,UAAU;UACV,KAAK;EACZ,MAAM,UAAU,eAAe,QAAQ,IAAI,UAAU,OAAO,IAAI;AAChE,UAAQ,OAAO,MAAM,uCAAuC,QAAQ,IAAI;AACxE,UAAQ,KAAK,EAAE;;CAGjB,MAAM,SAAS,aAAa,KAAK;CACjC,MAAM,YAAY,IAAI,sBAAsB;AAC5C,OAAM,OAAO,QAAQ,UAAU"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/schemas.ts","../src/server.ts","../src/index.ts"],"sourcesContent":["import { MemoryTypeSchema } from \"@membank/core\";\nimport { z } from \"zod\";\n\nexport const SaveMemoryArgsSchema = z.object({\n content: z.string().min(1),\n type: MemoryTypeSchema,\n tags: z.array(z.string()).optional(),\n global: z.boolean().optional(),\n});\n\nexport const UpdateMemoryArgsSchema = z.object({\n id: z.string().min(1),\n content: z.string().min(1),\n tags: z.array(z.string()).optional(),\n});\n\nexport const DeleteMemoryArgsSchema = z.object({\n id: z.string().min(1),\n});\n\nexport const QueryMemoryArgsSchema = z.object({\n query: z.string().min(1),\n type: MemoryTypeSchema.optional(),\n limit: z.number().int().positive().optional(),\n includePinned: z.boolean().optional(),\n});\n\nexport const MigrateArgsSchema = z.discriminatedUnion(\"mode\", [\n z.object({ mode: z.literal(\"list\") }),\n z.object({ mode: z.literal(\"run\"), name: z.string().min(1) }),\n]);\n\nexport const PinMemoryArgsSchema = z.object({\n id: z.string().min(1),\n});\n","import {\n DatabaseManager,\n EmbeddingService,\n listMemoryTypes,\n MEMORY_TYPE_VALUES,\n MemoryRepository,\n MIGRATIONS,\n ProjectRepository,\n QueryEngine,\n resolveProject,\n runScopeToProjectsMigration,\n} from \"@membank/core\";\nimport { Server } from \"@modelcontextprotocol/sdk/server\";\nimport {\n CallToolRequestSchema,\n ErrorCode,\n ListToolsRequestSchema,\n McpError,\n} from \"@modelcontextprotocol/sdk/types.js\";\nimport { ZodError } from \"zod\";\nimport {\n DeleteMemoryArgsSchema,\n MigrateArgsSchema,\n PinMemoryArgsSchema,\n QueryMemoryArgsSchema,\n SaveMemoryArgsSchema,\n UpdateMemoryArgsSchema,\n} from \"./schemas.js\";\n\nconst SERVER_NAME = \"membank\";\nconst SERVER_VERSION = \"0.1.0\";\n\nexport interface CoreServices {\n db: DatabaseManager;\n embedding: EmbeddingService;\n repo: MemoryRepository;\n query: QueryEngine;\n projects: ProjectRepository;\n}\n\nexport interface ServerOptions {\n dbPath?: string;\n useInMemoryDb?: boolean;\n}\n\nexport function initCore(options: ServerOptions = {}): CoreServices {\n const db = options.useInMemoryDb\n ? DatabaseManager.openInMemory()\n : DatabaseManager.open(options.dbPath);\n const embedding = new EmbeddingService();\n const projects = new ProjectRepository(db);\n const repo = new MemoryRepository(db, embedding, projects);\n const query = new QueryEngine(db, embedding, repo);\n return { db, embedding, repo, query, projects };\n}\n\nfunction parseArgs<T>(schema: { parse: (v: unknown) => T }, raw: unknown): T {\n try {\n return schema.parse(raw);\n } catch (e) {\n const msg = e instanceof ZodError ? (e.issues[0]?.message ?? e.message) : String(e);\n throw new McpError(ErrorCode.InvalidParams, msg);\n }\n}\n\nexport function createServer(core: CoreServices): Server {\n const server = new Server(\n { name: SERVER_NAME, version: SERVER_VERSION },\n { capabilities: { tools: {} } }\n );\n\n server.setRequestHandler(ListToolsRequestSchema, () => ({\n tools: [\n {\n name: \"list_memory_types\",\n description: \"Returns the ordered list of memory type values supported by membank.\",\n inputSchema: { type: \"object\", properties: {}, required: [] },\n },\n {\n name: \"save_memory\",\n description:\n \"Save a new memory. Handles deduplication automatically — near-identical memories (cosine similarity >0.92, same type and project) overwrite the existing record.\",\n inputSchema: {\n type: \"object\",\n properties: {\n content: { type: \"string\", description: \"Memory content to save\" },\n type: {\n type: \"string\",\n enum: [...MEMORY_TYPE_VALUES],\n description: \"Memory type\",\n },\n tags: {\n type: \"array\",\n items: { type: \"string\" },\n description: \"Optional tags\",\n },\n global: {\n type: \"boolean\",\n description: \"Save as a global memory, not tied to any project\",\n },\n },\n required: [\"content\", \"type\"],\n },\n },\n {\n name: \"update_memory\",\n description: \"Update the content and/or tags of an existing memory by id.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\", description: \"Memory id to update\" },\n content: { type: \"string\", description: \"New content for the memory\" },\n tags: {\n type: \"array\",\n items: { type: \"string\" },\n description: \"Replacement tags (optional)\",\n },\n },\n required: [\"id\", \"content\"],\n },\n },\n {\n name: \"delete_memory\",\n description: \"Delete a memory by id.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\", description: \"Memory id to delete\" },\n },\n required: [\"id\"],\n },\n },\n {\n name: \"query_memory\",\n description:\n \"Search memories by semantic similarity. Returns results ranked by confidence score.\",\n inputSchema: {\n type: \"object\",\n properties: {\n query: { type: \"string\", description: \"Search text\" },\n type: {\n type: \"string\",\n enum: [...MEMORY_TYPE_VALUES],\n description: \"Filter by memory type\",\n },\n limit: { type: \"number\", description: \"Maximum results to return (default 10)\" },\n includePinned: {\n type: \"boolean\",\n description:\n \"Include pinned memories in results. Pinned memories are already injected into session context, so excluded by default to avoid duplicates.\",\n },\n },\n required: [\"query\"],\n },\n },\n {\n name: \"migrate\",\n description:\n 'List or run named data migrations. Use mode \"list\" to see available migrations; mode \"run\" with a migration name to execute one.',\n inputSchema: {\n type: \"object\",\n properties: {\n mode: {\n type: \"string\",\n enum: [\"list\", \"run\"],\n description: 'Mode: \"list\" to see available migrations, \"run\" to execute one',\n },\n name: {\n type: \"string\",\n description: 'Migration name (required when mode is \"run\")',\n },\n },\n required: [\"mode\"],\n },\n },\n {\n name: \"pin_memory\",\n description:\n \"Pin a memory by id. Pinned memories are always injected into the session context.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\", description: \"Memory id to pin\" },\n },\n required: [\"id\"],\n },\n },\n {\n name: \"unpin_memory\",\n description: \"Unpin a memory by id. Removes the memory from guaranteed session injection.\",\n inputSchema: {\n type: \"object\",\n properties: {\n id: { type: \"string\", description: \"Memory id to unpin\" },\n },\n required: [\"id\"],\n },\n },\n ],\n }));\n\n server.setRequestHandler(CallToolRequestSchema, async (request) => {\n if (request.params.name === \"list_memory_types\") {\n try {\n return {\n content: [{ type: \"text\", text: JSON.stringify(listMemoryTypes()) }],\n };\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n return { content: [{ type: \"text\", text: message }], isError: true };\n }\n }\n\n if (request.params.name === \"save_memory\") {\n const args = parseArgs(SaveMemoryArgsSchema, request.params.arguments);\n const projectScope = args.global === true ? undefined : await resolveProject();\n\n try {\n const memory = await core.repo.save({\n content: args.content,\n type: args.type,\n tags: args.tags,\n projectScope,\n });\n\n return {\n content: [{ type: \"text\", text: JSON.stringify(memory) }],\n };\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n return { content: [{ type: \"text\", text: message }], isError: true };\n }\n }\n\n if (request.params.name === \"update_memory\") {\n const args = parseArgs(UpdateMemoryArgsSchema, request.params.arguments);\n\n try {\n const memory = await core.repo.update(args.id, {\n content: args.content,\n tags: args.tags,\n });\n return { content: [{ type: \"text\", text: JSON.stringify(memory) }] };\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n return { content: [{ type: \"text\", text: message }], isError: true };\n }\n }\n\n if (request.params.name === \"delete_memory\") {\n const args = parseArgs(DeleteMemoryArgsSchema, request.params.arguments);\n\n try {\n const exists =\n core.db.db\n .prepare<[string], { id: string }>(`SELECT id FROM memories WHERE id = ?`)\n .get(args.id) !== undefined;\n\n if (!exists) {\n return {\n content: [{ type: \"text\", text: `Memory not found: ${args.id}` }],\n isError: true,\n };\n }\n\n await core.repo.delete(args.id);\n return {\n content: [{ type: \"text\", text: JSON.stringify({ success: true, id: args.id }) }],\n };\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n return { content: [{ type: \"text\", text: message }], isError: true };\n }\n }\n\n if (request.params.name === \"query_memory\") {\n const args = parseArgs(QueryMemoryArgsSchema, request.params.arguments);\n\n try {\n const results = await core.query.query({\n query: args.query,\n type: args.type,\n limit: args.limit ?? 10,\n includePinned: args.includePinned,\n });\n\n const serialised = results.map((r) => ({\n id: r.id,\n content: r.content,\n type: r.type,\n tags: r.tags,\n projects: r.projects,\n pinned: r.pinned,\n reviewEvents: r.reviewEvents,\n score: r.score,\n }));\n\n return {\n content: [{ type: \"text\", text: JSON.stringify(serialised) }],\n };\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n return { content: [{ type: \"text\", text: message }], isError: true };\n }\n }\n\n if (request.params.name === \"migrate\") {\n const args = parseArgs(MigrateArgsSchema, request.params.arguments);\n\n if (args.mode === \"list\") {\n return {\n content: [{ type: \"text\", text: JSON.stringify(MIGRATIONS) }],\n };\n }\n\n if (args.name === \"scope-to-projects\") {\n try {\n const result = await runScopeToProjectsMigration(core.projects);\n if (result === null) {\n return {\n content: [\n {\n type: \"text\",\n text: JSON.stringify({ error: \"No project found for current directory.\" }),\n },\n ],\n isError: true,\n };\n }\n return {\n content: [{ type: \"text\", text: JSON.stringify(result) }],\n };\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n return { content: [{ type: \"text\", text: message }], isError: true };\n }\n }\n\n throw new McpError(\n ErrorCode.InvalidParams,\n `Unknown migration: \"${args.name}\". Available: ${MIGRATIONS.map((m) => m.name).join(\", \")}`\n );\n }\n\n if (request.params.name === \"pin_memory\" || request.params.name === \"unpin_memory\") {\n const args = parseArgs(PinMemoryArgsSchema, request.params.arguments);\n const pinned = request.params.name === \"pin_memory\";\n\n try {\n const memory = core.repo.setPin(args.id, pinned);\n return { content: [{ type: \"text\", text: JSON.stringify(memory) }] };\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n return { content: [{ type: \"text\", text: message }], isError: true };\n }\n }\n\n throw new Error(`Unknown tool: ${request.params.name}`);\n });\n\n return server;\n}\n","import { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport type { CoreServices } from \"./server.js\";\nimport { createServer, initCore } from \"./server.js\";\n\nexport async function startServer(): Promise<void> {\n let core: CoreServices;\n try {\n core = initCore();\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n process.stderr.write(`membank: failed to initialise core: ${message}\\n`);\n process.exit(1);\n }\n\n const server = createServer(core);\n const transport = new StdioServerTransport();\n await server.connect(transport);\n}\n"],"mappings":";;;;;;AAGA,MAAa,uBAAuB,EAAE,OAAO;CAC3C,SAAS,EAAE,QAAQ,CAAC,IAAI,EAAE;CAC1B,MAAM;CACN,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,UAAU;CACpC,QAAQ,EAAE,SAAS,CAAC,UAAU;CAC/B,CAAC;AAEF,MAAa,yBAAyB,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 -18,7 +18,8 @@
18
18
  ],
19
19
  "dependencies": {
20
20
  "@modelcontextprotocol/sdk": "^1.29.0",
21
- "@membank/core": "0.6.1"
21
+ "zod": "^4.4.3",
22
+ "@membank/core": "0.8.0"
22
23
  },
23
24
  "devDependencies": {
24
25
  "@types/node": "^25.6.0",