@memoraone/mcp 0.1.16 → 0.1.17

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.
Files changed (2) hide show
  1. package/dist/cli.cjs +91 -43
  2. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -5,6 +5,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
8
11
  var __copyProps = (to, from, except, desc) => {
9
12
  if (from && typeof from === "object" || typeof from === "function") {
10
13
  for (let key of __getOwnPropNames(from))
@@ -22,6 +25,44 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
25
  mod
23
26
  ));
24
27
 
28
+ // package.json
29
+ var require_package = __commonJS({
30
+ "package.json"(exports2, module2) {
31
+ module2.exports = {
32
+ name: "@memoraone/mcp",
33
+ version: "0.1.17",
34
+ type: "module",
35
+ main: "dist/index.cjs",
36
+ bin: {
37
+ "memoraone-mcp": "dist-bin/memoraone-mcp.cjs"
38
+ },
39
+ files: [
40
+ "dist",
41
+ "dist-bin"
42
+ ],
43
+ publishConfig: {
44
+ access: "public"
45
+ },
46
+ scripts: {
47
+ build: "tsup && node scripts/writeBinWrapper.cjs",
48
+ prepublishOnly: "pnpm run build",
49
+ dev: "tsx src/index.ts",
50
+ lint: "eslint ."
51
+ },
52
+ dependencies: {
53
+ "@modelcontextprotocol/sdk": "^1.25.1",
54
+ dotenv: "^16.4.5",
55
+ zod: "^4.0.0"
56
+ },
57
+ devDependencies: {
58
+ tsx: "^4.21.0",
59
+ tsup: "^8.5.1",
60
+ typescript: "^5.9.2"
61
+ }
62
+ };
63
+ }
64
+ });
65
+
25
66
  // src/index.ts
26
67
  var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
27
68
  var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
@@ -529,8 +570,8 @@ async function getProjectIdForFingerprint(fingerprint) {
529
570
  source: entry.source ?? "unknown"
530
571
  };
531
572
  }
532
- async function setProjectIdForFingerprint(args) {
533
- const { fingerprint, projectKey, source, linked_at } = args;
573
+ async function setProjectIdForFingerprint(args2) {
574
+ const { fingerprint, projectKey, source, linked_at } = args2;
534
575
  if (!fingerprintRegex.test(fingerprint)) {
535
576
  throw new Error("[memoraone-mcp] Invalid fingerprint");
536
577
  }
@@ -568,21 +609,21 @@ async function readRepoProjectId(gitRoot) {
568
609
  throw err;
569
610
  }
570
611
  }
571
- function resolveProjectIdOrThrow(args) {
572
- const envProjectKey = args.envProjectKey?.trim();
612
+ function resolveProjectIdOrThrow(args2) {
613
+ const envProjectKey = args2.envProjectKey?.trim();
573
614
  if (envProjectKey) {
574
615
  return { projectKey: envProjectKey, source: "env" };
575
616
  }
576
- const repoFileProjectKey = args.repoFileProjectKey?.trim();
617
+ const repoFileProjectKey = args2.repoFileProjectKey?.trim();
577
618
  if (repoFileProjectKey) {
578
619
  return { projectKey: repoFileProjectKey, source: "repo-file" };
579
620
  }
580
- const workspaceProjectKey = args.workspaceProjectKey?.trim();
621
+ const workspaceProjectKey = args2.workspaceProjectKey?.trim();
581
622
  if (workspaceProjectKey) {
582
623
  return { projectKey: workspaceProjectKey, source: "workspace-map" };
583
624
  }
584
625
  throw new Error(
585
- `Repo not linked to a MemoraOne project. Set MEMORAONE_PROJECT_ID or create ${args.repoFilePath} containing a project key.`
626
+ `Repo not linked to a MemoraOne project. Set MEMORAONE_PROJECT_ID or create ${args2.repoFilePath} containing a project key.`
586
627
  );
587
628
  }
588
629
 
@@ -682,12 +723,12 @@ var postEventInputSchema = import_v49.z.object({
682
723
  content: import_v49.z.record(import_v49.z.string(), import_v49.z.any()),
683
724
  metadata: import_v49.z.record(import_v49.z.string(), import_v49.z.any()).optional()
684
725
  });
685
- async function handlePostEvent(client, args) {
726
+ async function handlePostEvent(client, args2) {
686
727
  const nonce = crypto4.randomBytes(8).toString("hex");
687
728
  console.error(
688
729
  `[memoraone-mcp][debug] tool=memora_post_event toolCallId=unknown nonce=${nonce} stage=before_post`
689
730
  );
690
- const parsed2 = postEventInputSchema.parse(args ?? {});
731
+ const parsed2 = postEventInputSchema.parse(args2 ?? {});
691
732
  const projectKey = getCurrentProjectId();
692
733
  if (!projectKey) {
693
734
  throw new Error("No project selected. Use memora_list_projects and memora_set_project to select a project.");
@@ -735,8 +776,8 @@ var askWithMemoryInputSchema = import_v410.z.object({
735
776
  function isAskWithMemoryResponse(value) {
736
777
  return typeof value === "object" && value !== null && typeof value.answer === "string" && value.answer !== "";
737
778
  }
738
- async function handleAskWithMemory(client, args) {
739
- const parsed2 = askWithMemoryInputSchema.parse(args ?? {});
779
+ async function handleAskWithMemory(client, args2) {
780
+ const parsed2 = askWithMemoryInputSchema.parse(args2 ?? {});
740
781
  const projectKey = getCurrentProjectId();
741
782
  if (!projectKey) {
742
783
  throw new Error("No project selected. Use memora_list_projects and memora_set_project to select a project.");
@@ -770,8 +811,8 @@ var logIntentInputSchema = import_v411.z.object({
770
811
  intent_source: import_v411.z.string().optional().default("cursor_chat"),
771
812
  run_id: import_v411.z.string().min(1).optional()
772
813
  });
773
- async function handleLogIntent(client, args) {
774
- const parsed2 = logIntentInputSchema.parse(args ?? {});
814
+ async function handleLogIntent(client, args2) {
815
+ const parsed2 = logIntentInputSchema.parse(args2 ?? {});
775
816
  const projectKey = getCurrentProjectId();
776
817
  if (!projectKey) {
777
818
  throw new Error("No project selected. Use memora_list_projects and memora_set_project to select a project.");
@@ -821,8 +862,8 @@ var logChangeSummaryInputSchema = import_v412.z.object({
821
862
  commit: import_v412.z.string().min(1).optional(),
822
863
  run_id: import_v412.z.string().min(1).optional()
823
864
  });
824
- async function handleLogChangeSummary(client, args) {
825
- const parsed2 = logChangeSummaryInputSchema.parse(args ?? {});
865
+ async function handleLogChangeSummary(client, args2) {
866
+ const parsed2 = logChangeSummaryInputSchema.parse(args2 ?? {});
826
867
  const projectKey = getCurrentProjectId();
827
868
  if (!projectKey) {
828
869
  throw new Error("No project selected. Use memora_list_projects and memora_set_project to select a project.");
@@ -864,8 +905,8 @@ var logToolResultInputSchema = import_v413.z.object({
864
905
  error_kind: import_v413.z.enum(["infra", "logic", "auth", "rate_limit", "validation", "unknown"]).optional(),
865
906
  stats: import_v413.z.record(import_v413.z.string(), import_v413.z.any()).optional()
866
907
  });
867
- async function handleLogToolResult(client, args) {
868
- const parsed2 = logToolResultInputSchema.parse(args ?? {});
908
+ async function handleLogToolResult(client, args2) {
909
+ const parsed2 = logToolResultInputSchema.parse(args2 ?? {});
869
910
  const projectKey = getCurrentProjectId();
870
911
  if (!projectKey) {
871
912
  throw new Error("No project selected. Use memora_list_projects and memora_set_project to select a project.");
@@ -908,8 +949,8 @@ var logCommandInputSchema = import_v414.z.object({
908
949
  run_id: import_v414.z.string().min(1).optional(),
909
950
  stats: import_v414.z.record(import_v414.z.string(), import_v414.z.any()).optional()
910
951
  });
911
- async function handleLogCommand(client, args) {
912
- const parsed2 = logCommandInputSchema.parse(args ?? {});
952
+ async function handleLogCommand(client, args2) {
953
+ const parsed2 = logCommandInputSchema.parse(args2 ?? {});
913
954
  const projectKey = getCurrentProjectId();
914
955
  if (!projectKey) {
915
956
  throw new Error("No project selected. Use memora_list_projects and memora_set_project to select a project.");
@@ -951,8 +992,8 @@ var setProjectInputSchema = import_v415.z.object({
951
992
  projectKey: import_v415.z.string().min(1).optional(),
952
993
  projectId: import_v415.z.string().min(1).optional()
953
994
  });
954
- async function handleSetProject(args) {
955
- const parsed2 = setProjectInputSchema.parse(args ?? {});
995
+ async function handleSetProject(args2) {
996
+ const parsed2 = setProjectInputSchema.parse(args2 ?? {});
956
997
  const resolvedProjectKey = parsed2.projectKey ?? parsed2.projectId;
957
998
  if (!resolvedProjectKey) {
958
999
  throw new Error("projectKey is required");
@@ -995,9 +1036,9 @@ function redactSensitiveFields(obj) {
995
1036
  }
996
1037
  return redacted;
997
1038
  }
998
- function sanitizeArgsSummary(args) {
1039
+ function sanitizeArgsSummary(args2) {
999
1040
  try {
1000
- const redacted = redactSensitiveFields(args);
1041
+ const redacted = redactSensitiveFields(args2);
1001
1042
  const summary = JSON.stringify(redacted);
1002
1043
  return summary.length > 200 ? summary.slice(0, 200) + "..." : summary;
1003
1044
  } catch {
@@ -1031,12 +1072,12 @@ function registerToolWithWorklog(server, client, toolName, description, schema,
1031
1072
  server.tool(toolName, description, schema, handler);
1032
1073
  return;
1033
1074
  }
1034
- server.tool(toolName, description, schema, async (args) => {
1035
- const argsSummary = sanitizeArgsSummary(args);
1075
+ server.tool(toolName, description, schema, async (args2) => {
1076
+ const argsSummary = sanitizeArgsSummary(args2);
1036
1077
  const start = Date.now();
1037
1078
  await postWorklogEvent(client, `tool_start: ${toolName} ${argsSummary}`);
1038
1079
  try {
1039
- const result = await handler(args);
1080
+ const result = await handler(args2);
1040
1081
  const durationMs = Date.now() - start;
1041
1082
  await postWorklogEvent(client, `tool_end: ${toolName} ok (${durationMs}ms)`);
1042
1083
  return result;
@@ -1085,8 +1126,8 @@ async function main() {
1085
1126
  "memora_post_event",
1086
1127
  "Forward an event to MemoraOne timeline",
1087
1128
  postEventShape,
1088
- async (args) => {
1089
- const result = await handlePostEvent(client, args);
1129
+ async (args2) => {
1130
+ const result = await handlePostEvent(client, args2);
1090
1131
  return {
1091
1132
  content: [
1092
1133
  {
@@ -1119,8 +1160,8 @@ async function main() {
1119
1160
  "memora_set_project",
1120
1161
  "Set the current project key for subsequent tool calls",
1121
1162
  setProjectShape,
1122
- async (args) => {
1123
- const result = await handleSetProject(args);
1163
+ async (args2) => {
1164
+ const result = await handleSetProject(args2);
1124
1165
  return {
1125
1166
  content: [
1126
1167
  {
@@ -1138,8 +1179,8 @@ async function main() {
1138
1179
  "memora_ask_with_memory",
1139
1180
  "Ask MemoraOne with project memory context",
1140
1181
  askWithMemoryShape,
1141
- async (args) => {
1142
- const result = await handleAskWithMemory(client, args);
1182
+ async (args2) => {
1183
+ const result = await handleAskWithMemory(client, args2);
1143
1184
  return {
1144
1185
  content: [
1145
1186
  {
@@ -1157,8 +1198,8 @@ async function main() {
1157
1198
  "memora_log_intent",
1158
1199
  "Log a natural-language TASK or DECISION intent to the MemoraOne timeline",
1159
1200
  logIntentShape,
1160
- async (args) => {
1161
- const result = await handleLogIntent(client, args);
1201
+ async (args2) => {
1202
+ const result = await handleLogIntent(client, args2);
1162
1203
  return {
1163
1204
  content: [
1164
1205
  {
@@ -1176,8 +1217,8 @@ async function main() {
1176
1217
  "memora_log_change_summary",
1177
1218
  "Log a concise code change summary to the MemoraOne timeline",
1178
1219
  logChangeSummaryShape,
1179
- async (args) => {
1180
- const result = await handleLogChangeSummary(client, args);
1220
+ async (args2) => {
1221
+ const result = await handleLogChangeSummary(client, args2);
1181
1222
  return {
1182
1223
  content: [
1183
1224
  {
@@ -1195,8 +1236,8 @@ async function main() {
1195
1236
  "memora_log_tool_result",
1196
1237
  "Log a tool execution result to the MemoraOne timeline",
1197
1238
  logToolResultShape,
1198
- async (args) => {
1199
- const result = await handleLogToolResult(client, args);
1239
+ async (args2) => {
1240
+ const result = await handleLogToolResult(client, args2);
1200
1241
  return {
1201
1242
  content: [
1202
1243
  {
@@ -1214,8 +1255,8 @@ async function main() {
1214
1255
  "memora_log_command",
1215
1256
  "Log a command execution to the MemoraOne timeline",
1216
1257
  logCommandShape,
1217
- async (args) => {
1218
- const result = await handleLogCommand(client, args);
1258
+ async (args2) => {
1259
+ const result = await handleLogCommand(client, args2);
1219
1260
  return {
1220
1261
  content: [
1221
1262
  {
@@ -1266,6 +1307,13 @@ main().catch((err) => {
1266
1307
  });
1267
1308
 
1268
1309
  // src/cli.ts
1269
- console.error(
1270
- `[memoraone-mcp][info] LOCAL BUILD ACTIVE version=0.1.14 pid=${process.pid} ts=${Date.now()}`
1271
- );
1310
+ var { version } = require_package();
1311
+ var args = process.argv.slice(2);
1312
+ if (args.includes("--version") || args.includes("-v")) {
1313
+ console.log(version);
1314
+ process.exit(0);
1315
+ }
1316
+ if (args.includes("--help") || args.includes("-h")) {
1317
+ console.log("Usage: memoraone-mcp [--version] [--help]");
1318
+ process.exit(0);
1319
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memoraone/mcp",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {