@rubytech/create-maxy-code 0.1.59 → 0.1.60

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 (125) hide show
  1. package/package.json +1 -1
  2. package/payload/platform/plugins/loop/PLUGIN.md +13 -1
  3. package/payload/platform/plugins/loop/mcp/dist/index.js +8 -7
  4. package/payload/platform/plugins/loop/mcp/dist/index.js.map +1 -1
  5. package/payload/platform/plugins/loop/mcp/dist/lib/file-crypto.d.ts +3 -0
  6. package/payload/platform/plugins/loop/mcp/dist/lib/file-crypto.d.ts.map +1 -0
  7. package/payload/platform/plugins/loop/mcp/dist/lib/file-crypto.js +48 -0
  8. package/payload/platform/plugins/loop/mcp/dist/lib/file-crypto.js.map +1 -0
  9. package/payload/platform/plugins/loop/mcp/dist/lib/key-store.d.ts +22 -0
  10. package/payload/platform/plugins/loop/mcp/dist/lib/key-store.d.ts.map +1 -0
  11. package/payload/platform/plugins/loop/mcp/dist/lib/key-store.js +165 -0
  12. package/payload/platform/plugins/loop/mcp/dist/lib/key-store.js.map +1 -0
  13. package/payload/platform/plugins/loop/mcp/dist/lib/loop-api.d.ts +1 -1
  14. package/payload/platform/plugins/loop/mcp/dist/lib/loop-api.d.ts.map +1 -1
  15. package/payload/platform/plugins/loop/mcp/dist/lib/loop-api.js +4 -39
  16. package/payload/platform/plugins/loop/mcp/dist/lib/loop-api.js.map +1 -1
  17. package/payload/platform/plugins/loop/mcp/dist/tools/key-deregister.d.ts.map +1 -1
  18. package/payload/platform/plugins/loop/mcp/dist/tools/key-deregister.js +5 -15
  19. package/payload/platform/plugins/loop/mcp/dist/tools/key-deregister.js.map +1 -1
  20. package/payload/platform/plugins/loop/mcp/dist/tools/key-register.d.ts.map +1 -1
  21. package/payload/platform/plugins/loop/mcp/dist/tools/key-register.js +11 -28
  22. package/payload/platform/plugins/loop/mcp/dist/tools/key-register.js.map +1 -1
  23. package/payload/platform/plugins/loop/mcp/src/index.ts +10 -7
  24. package/payload/platform/plugins/loop/mcp/src/lib/file-crypto.ts +54 -0
  25. package/payload/platform/plugins/loop/mcp/src/lib/key-store.ts +221 -0
  26. package/payload/platform/plugins/loop/mcp/src/lib/loop-api.ts +5 -42
  27. package/payload/platform/plugins/loop/mcp/src/tools/key-deregister.ts +5 -20
  28. package/payload/platform/plugins/loop/mcp/src/tools/key-register.ts +14 -39
  29. package/payload/platform/plugins/property-data/PLUGIN.md +14 -1
  30. package/payload/platform/plugins/property-data/mcp/dist/index.js +14 -11
  31. package/payload/platform/plugins/property-data/mcp/dist/index.js.map +1 -1
  32. package/payload/platform/plugins/property-data/mcp/dist/lib/file-crypto.d.ts +3 -0
  33. package/payload/platform/plugins/property-data/mcp/dist/lib/file-crypto.d.ts.map +1 -0
  34. package/payload/platform/plugins/property-data/mcp/dist/lib/file-crypto.js +49 -0
  35. package/payload/platform/plugins/property-data/mcp/dist/lib/file-crypto.js.map +1 -0
  36. package/payload/platform/plugins/property-data/mcp/dist/lib/key-store.d.ts +15 -0
  37. package/payload/platform/plugins/property-data/mcp/dist/lib/key-store.d.ts.map +1 -0
  38. package/payload/platform/plugins/property-data/mcp/dist/lib/key-store.js +135 -0
  39. package/payload/platform/plugins/property-data/mcp/dist/lib/key-store.js.map +1 -0
  40. package/payload/platform/plugins/property-data/mcp/dist/lib/propertydata-api.d.ts +0 -1
  41. package/payload/platform/plugins/property-data/mcp/dist/lib/propertydata-api.d.ts.map +1 -1
  42. package/payload/platform/plugins/property-data/mcp/dist/lib/propertydata-api.js +11 -22
  43. package/payload/platform/plugins/property-data/mcp/dist/lib/propertydata-api.js.map +1 -1
  44. package/payload/platform/plugins/property-data/mcp/dist/tools/endpoints.d.ts.map +1 -1
  45. package/payload/platform/plugins/property-data/mcp/dist/tools/endpoints.js +2 -2
  46. package/payload/platform/plugins/property-data/mcp/dist/tools/endpoints.js.map +1 -1
  47. package/payload/platform/plugins/property-data/mcp/dist/tools/key-deregister.d.ts.map +1 -1
  48. package/payload/platform/plugins/property-data/mcp/dist/tools/key-deregister.js +5 -15
  49. package/payload/platform/plugins/property-data/mcp/dist/tools/key-deregister.js.map +1 -1
  50. package/payload/platform/plugins/property-data/mcp/dist/tools/key-register.d.ts.map +1 -1
  51. package/payload/platform/plugins/property-data/mcp/dist/tools/key-register.js +30 -23
  52. package/payload/platform/plugins/property-data/mcp/dist/tools/key-register.js.map +1 -1
  53. package/payload/platform/plugins/property-data/mcp/src/index.ts +16 -11
  54. package/payload/platform/plugins/property-data/mcp/src/lib/file-crypto.ts +55 -0
  55. package/payload/platform/plugins/property-data/mcp/src/lib/key-store.ts +181 -0
  56. package/payload/platform/plugins/property-data/mcp/src/lib/propertydata-api.ts +9 -24
  57. package/payload/platform/plugins/property-data/mcp/src/tools/endpoints.ts +2 -2
  58. package/payload/platform/plugins/property-data/mcp/src/tools/key-deregister.ts +5 -17
  59. package/payload/platform/plugins/property-data/mcp/src/tools/key-register.ts +29 -33
  60. package/payload/premium-plugins/real-agent/plugins/loop/PLUGIN.md +13 -1
  61. package/payload/premium-plugins/real-agent/plugins/loop/mcp/dist/index.js +8 -7
  62. package/payload/premium-plugins/real-agent/plugins/loop/mcp/dist/index.js.map +1 -1
  63. package/payload/premium-plugins/real-agent/plugins/loop/mcp/dist/lib/file-crypto.d.ts +3 -0
  64. package/payload/premium-plugins/real-agent/plugins/loop/mcp/dist/lib/file-crypto.d.ts.map +1 -0
  65. package/payload/premium-plugins/real-agent/plugins/loop/mcp/dist/lib/file-crypto.js +48 -0
  66. package/payload/premium-plugins/real-agent/plugins/loop/mcp/dist/lib/file-crypto.js.map +1 -0
  67. package/payload/premium-plugins/real-agent/plugins/loop/mcp/dist/lib/key-store.d.ts +22 -0
  68. package/payload/premium-plugins/real-agent/plugins/loop/mcp/dist/lib/key-store.d.ts.map +1 -0
  69. package/payload/premium-plugins/real-agent/plugins/loop/mcp/dist/lib/key-store.js +165 -0
  70. package/payload/premium-plugins/real-agent/plugins/loop/mcp/dist/lib/key-store.js.map +1 -0
  71. package/payload/premium-plugins/real-agent/plugins/loop/mcp/dist/lib/loop-api.d.ts +1 -1
  72. package/payload/premium-plugins/real-agent/plugins/loop/mcp/dist/lib/loop-api.d.ts.map +1 -1
  73. package/payload/premium-plugins/real-agent/plugins/loop/mcp/dist/lib/loop-api.js +4 -39
  74. package/payload/premium-plugins/real-agent/plugins/loop/mcp/dist/lib/loop-api.js.map +1 -1
  75. package/payload/premium-plugins/real-agent/plugins/loop/mcp/dist/tools/key-deregister.d.ts.map +1 -1
  76. package/payload/premium-plugins/real-agent/plugins/loop/mcp/dist/tools/key-deregister.js +5 -15
  77. package/payload/premium-plugins/real-agent/plugins/loop/mcp/dist/tools/key-deregister.js.map +1 -1
  78. package/payload/premium-plugins/real-agent/plugins/loop/mcp/dist/tools/key-register.d.ts.map +1 -1
  79. package/payload/premium-plugins/real-agent/plugins/loop/mcp/dist/tools/key-register.js +11 -28
  80. package/payload/premium-plugins/real-agent/plugins/loop/mcp/dist/tools/key-register.js.map +1 -1
  81. package/payload/premium-plugins/real-agent/plugins/loop/mcp/src/index.ts +10 -7
  82. package/payload/premium-plugins/real-agent/plugins/loop/mcp/src/lib/file-crypto.ts +54 -0
  83. package/payload/premium-plugins/real-agent/plugins/loop/mcp/src/lib/key-store.ts +221 -0
  84. package/payload/premium-plugins/real-agent/plugins/loop/mcp/src/lib/loop-api.ts +5 -42
  85. package/payload/premium-plugins/real-agent/plugins/loop/mcp/src/tools/key-deregister.ts +5 -20
  86. package/payload/premium-plugins/real-agent/plugins/loop/mcp/src/tools/key-register.ts +14 -39
  87. package/payload/premium-plugins/real-agent/plugins/property-data/PLUGIN.md +14 -1
  88. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/index.js +14 -11
  89. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/index.js.map +1 -1
  90. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/lib/file-crypto.d.ts +3 -0
  91. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/lib/file-crypto.d.ts.map +1 -0
  92. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/lib/file-crypto.js +49 -0
  93. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/lib/file-crypto.js.map +1 -0
  94. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/lib/key-store.d.ts +15 -0
  95. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/lib/key-store.d.ts.map +1 -0
  96. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/lib/key-store.js +135 -0
  97. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/lib/key-store.js.map +1 -0
  98. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/lib/propertydata-api.d.ts +0 -1
  99. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/lib/propertydata-api.d.ts.map +1 -1
  100. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/lib/propertydata-api.js +11 -22
  101. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/lib/propertydata-api.js.map +1 -1
  102. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/tools/endpoints.d.ts.map +1 -1
  103. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/tools/endpoints.js +2 -2
  104. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/tools/endpoints.js.map +1 -1
  105. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/tools/key-deregister.d.ts.map +1 -1
  106. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/tools/key-deregister.js +5 -15
  107. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/tools/key-deregister.js.map +1 -1
  108. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/tools/key-register.d.ts.map +1 -1
  109. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/tools/key-register.js +30 -23
  110. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/dist/tools/key-register.js.map +1 -1
  111. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/src/index.ts +16 -11
  112. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/src/lib/file-crypto.ts +55 -0
  113. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/src/lib/key-store.ts +181 -0
  114. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/src/lib/propertydata-api.ts +9 -24
  115. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/src/tools/endpoints.ts +2 -2
  116. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/src/tools/key-deregister.ts +5 -17
  117. package/payload/premium-plugins/real-agent/plugins/property-data/mcp/src/tools/key-register.ts +29 -33
  118. package/payload/server/public/assets/{admin-nqCBFiSl.js → admin-Bp-BjBCX.js} +51 -51
  119. package/payload/server/public/index.html +1 -1
  120. package/payload/server/server.js +4 -3
  121. package/payload/premium-plugins/real-agent/lib/mcp-stderr-tee/dist/index.d.ts +0 -51
  122. package/payload/premium-plugins/real-agent/lib/mcp-stderr-tee/dist/index.d.ts.map +0 -1
  123. package/payload/premium-plugins/real-agent/lib/mcp-stderr-tee/dist/index.js +0 -196
  124. package/payload/premium-plugins/real-agent/lib/mcp-stderr-tee/dist/index.js.map +0 -1
  125. package/payload/premium-plugins/real-agent/lib/mcp-stderr-tee/package.json +0 -7
@@ -1 +1 @@
1
- {"version":3,"file":"key-register.d.ts","sourceRoot":"","sources":["../../src/tools/key-register.ts"],"names":[],"mappings":"AAcA,wBAAsB,WAAW,CAAC,MAAM,EAAE;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB,GAAG,OAAO,CAAC;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA2EhC"}
1
+ {"version":3,"file":"key-register.d.ts","sourceRoot":"","sources":["../../src/tools/key-register.ts"],"names":[],"mappings":"AAaA,wBAAsB,WAAW,CAAC,MAAM,EAAE;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB,GAAG,OAAO,CAAC;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAmDhC"}
@@ -1,18 +1,16 @@
1
- import { getSession } from "../lib/neo4j.js";
2
- import { encrypt } from "../lib/crypto.js";
1
+ import { selectLoopKeyStore } from "../lib/key-store.js";
3
2
  import { loopGet, LoopApiError } from "../lib/loop-api.js";
4
3
  const ALL_PERMISSIONS = ["properties", "people", "viewings", "feedback", "team", "marketing", "customer", "supplier"];
5
4
  export async function keyRegister(params) {
6
5
  const { teamName, apiKey, accountId } = params;
7
6
  const permissions = params.permissions ?? ALL_PERMISSIONS;
8
- // Validate key against Loop API — try /team endpoint
7
+ // Validate key against Loop API — try /team endpoint.
9
8
  let teamAddress = "";
10
9
  let agentId = "";
11
10
  let warning;
12
11
  try {
13
12
  const teamData = await loopGet(apiKey, "/team", "loop-key-register", teamName);
14
13
  if (Array.isArray(teamData) && teamData.length === 0) {
15
- // 204 was converted to empty array — ambiguous scope
16
14
  warning =
17
15
  "Key accepted but Loop returned no team data (204). " +
18
16
  "Verify the key's scope in Loop's dashboard.";
@@ -27,32 +25,17 @@ export async function keyRegister(params) {
27
25
  throw new Error(`Loop API rejected the key for team "${teamName}" (HTTP 401). ` +
28
26
  `Check that the key is valid and not expired.`);
29
27
  }
30
- // Network/timeout errors — still reject, key is unverified
31
28
  throw new Error(`Could not validate key against Loop API: ${err instanceof Error ? err.message : String(err)}`);
32
29
  }
33
- // Encrypt and store
34
- const encryptedKey = encrypt(apiKey);
35
- const now = new Date().toISOString();
36
- const writeSession = getSession();
37
- try {
38
- await writeSession.run(`CREATE INDEX loop_team_key_account_team IF NOT EXISTS
39
- FOR (k:LoopTeamKey) ON (k.accountId, k.teamName)`, {});
40
- const mergeResult = await writeSession.run(`MERGE (k:LoopTeamKey {teamName: $teamName, accountId: $accountId})
41
- ON CREATE SET
42
- k.encryptedKey = $encryptedKey,
43
- k.teamAddress = $teamAddress,
44
- k.agentId = $agentId,
45
- k.permissions = $permissions,
46
- k.createdAt = $now,
47
- k.updatedAt = $now
48
- RETURN k.createdAt = $now AS created`, { teamName, encryptedKey, teamAddress, agentId, accountId, permissions, now });
49
- const created = mergeResult.records[0]?.get("created");
50
- if (!created) {
51
- throw new Error(`Team "${teamName}" is already registered for this account.`);
52
- }
53
- }
54
- finally {
55
- await writeSession.close();
30
+ const { created } = await selectLoopKeyStore().save(accountId, {
31
+ teamName,
32
+ apiKey,
33
+ teamAddress,
34
+ agentId,
35
+ permissions,
36
+ });
37
+ if (!created) {
38
+ throw new Error(`Team "${teamName}" is already registered for this account.`);
56
39
  }
57
40
  console.error(`[loop] key-register team=${teamName} account=${accountId}`);
58
41
  return { warning };
@@ -1 +1 @@
1
- {"version":3,"file":"key-register.js","sourceRoot":"","sources":["../../src/tools/key-register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAU3D,MAAM,eAAe,GAAG,CAAC,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AAEtH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,MAKjC;IACC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IAC/C,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,eAAe,CAAC;IAE1D,qDAAqD;IACrD,IAAI,WAAW,GAAG,EAAE,CAAC;IACrB,IAAI,OAAO,GAAG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AAO,EAAE,OAAO,EAAE,CAAC;AACrB,CAAC"}
@@ -1,5 +1,5 @@
1
- import { initStderrTee } from "../../../../../../platform/lib/mcp-stderr-tee/dist/index.js";
2
- initStderrTee("loop");
1
+ // Logging-tee was a platform-wrapper concern; the host owns the stderr pipe
2
+ // in both platform and standalone (Claude Code native) spawn paths.
3
3
 
4
4
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
5
5
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
@@ -29,11 +29,11 @@ import { autoResponder } from "./tools/auto-responder.js";
29
29
  import { customerPreferences } from "./tools/customer-preferences.js";
30
30
  import { supplier } from "./tools/supplier.js";
31
31
  import { closeDriver } from "./lib/neo4j.js";
32
+ import { selectLoopKeyStore } from "./lib/key-store.js";
32
33
 
33
- const accountId = process.env.ACCOUNT_ID;
34
- if (!accountId) {
35
- throw new Error("ACCOUNT_ID environment variable is required");
36
- }
34
+ // ACCOUNT_ID is the platform's tenant id; "local" is the single-tenant
35
+ // standalone stand-in when spawned natively by Claude Code.
36
+ const accountId = process.env.ACCOUNT_ID ?? "local";
37
37
 
38
38
  const server = new McpServer({
39
39
  name: "maxy-loop",
@@ -45,7 +45,10 @@ const ALL_PERMISSIONS = z.enum([
45
45
  "marketing", "customer", "supplier",
46
46
  ]);
47
47
 
48
- console.error(`[loop] server started, account=${accountId}`);
48
+ const store = selectLoopKeyStore();
49
+ console.error(
50
+ `[loop] server started, account=${accountId} backend=${store.backendName} path=${store.backendPath}`,
51
+ );
49
52
 
50
53
  // Helper: wrap a tool function in standard error handling
51
54
  function toolHandler(fn: (p: Record<string, unknown>) => Promise<string>) {
@@ -0,0 +1,54 @@
1
+ import { randomBytes, createCipheriv, createDecipheriv } from "node:crypto";
2
+ import { readFileSync, writeFileSync, existsSync } from "node:fs";
3
+
4
+ // Standalone-mode crypto — see property-data's file-crypto.ts for the
5
+ // shape and rationale. The two are duplicated rather than shared because
6
+ // the MCPs are independent npm workspaces with no shared lib.
7
+
8
+ const ALGORITHM = "aes-256-gcm";
9
+ const KEY_LENGTH = 32;
10
+ const IV_LENGTH = 12;
11
+ const AUTH_TAG_LENGTH = 16;
12
+
13
+ function loadOrGenerateKey(keyFilePath: string, label: string): Buffer {
14
+ if (existsSync(keyFilePath)) {
15
+ const hex = readFileSync(keyFilePath, "utf-8").trim();
16
+ const buf = Buffer.from(hex, "hex");
17
+ if (buf.length !== KEY_LENGTH) {
18
+ throw new Error(
19
+ `[${label}] encryption key at ${keyFilePath} is ${buf.length} bytes, expected ${KEY_LENGTH}.`,
20
+ );
21
+ }
22
+ return buf;
23
+ }
24
+ const key = randomBytes(KEY_LENGTH);
25
+ writeFileSync(keyFilePath, key.toString("hex"), { mode: 0o600 });
26
+ console.error(`[${label}] encryption key generated at ${keyFilePath}`);
27
+ return key;
28
+ }
29
+
30
+ export function encryptWith(plaintext: string, keyFilePath: string, label: string): string {
31
+ const key = loadOrGenerateKey(keyFilePath, label);
32
+ const iv = randomBytes(IV_LENGTH);
33
+ const cipher = createCipheriv(ALGORITHM, key, iv, { authTagLength: AUTH_TAG_LENGTH });
34
+ let encrypted = cipher.update(plaintext, "utf-8", "hex");
35
+ encrypted += cipher.final("hex");
36
+ const authTag = cipher.getAuthTag().toString("hex");
37
+ return `${iv.toString("hex")}:${encrypted}:${authTag}`;
38
+ }
39
+
40
+ export function decryptWith(encryptedValue: string, keyFilePath: string, label: string): string {
41
+ const parts = encryptedValue.split(":");
42
+ if (parts.length !== 3) {
43
+ throw new Error(`[${label}] bad encrypted envelope (expected iv:ct:tag)`);
44
+ }
45
+ const key = loadOrGenerateKey(keyFilePath, label);
46
+ const iv = Buffer.from(parts[0], "hex");
47
+ const ciphertext = parts[1];
48
+ const authTag = Buffer.from(parts[2], "hex");
49
+ const decipher = createDecipheriv(ALGORITHM, key, iv, { authTagLength: AUTH_TAG_LENGTH });
50
+ decipher.setAuthTag(authTag);
51
+ let plaintext = decipher.update(ciphertext, "hex", "utf-8");
52
+ plaintext += decipher.final("utf-8");
53
+ return plaintext;
54
+ }
@@ -0,0 +1,221 @@
1
+ import { readFileSync, writeFileSync, existsSync, mkdirSync } from "node:fs";
2
+ import { resolve, dirname } from "node:path";
3
+ import { homedir } from "node:os";
4
+ import { getSession } from "./neo4j.js";
5
+ import { encrypt, decrypt } from "./crypto.js";
6
+ import { encryptWith, decryptWith } from "./file-crypto.js";
7
+
8
+ // Storage abstraction so the same MCP body runs against Neo4j (platform mode)
9
+ // or an on-disk encrypted file (standalone mode, spawned by Claude Code from
10
+ // ~/.claude/). Selected by LOOP_STANDALONE at boot. Loop is multi-team — each
11
+ // account can register many team keys — so the file backend stores a nested
12
+ // map and the store API mirrors that.
13
+
14
+ export interface LoopStoredKey {
15
+ teamName: string;
16
+ apiKey: string;
17
+ teamAddress: string;
18
+ agentId: string;
19
+ permissions: string[];
20
+ createdAt: string;
21
+ updatedAt: string;
22
+ }
23
+
24
+ export type LoopKeyInput = Omit<LoopStoredKey, "createdAt" | "updatedAt">;
25
+
26
+ export interface LoopKeyStore {
27
+ readonly backendName: string;
28
+ readonly backendPath: string;
29
+ loadAll(accountId: string): Promise<LoopStoredKey[]>;
30
+ save(accountId: string, key: LoopKeyInput): Promise<{ created: boolean }>;
31
+ delete(accountId: string, teamName: string): Promise<boolean>;
32
+ }
33
+
34
+ class Neo4jLoopKeyStore implements LoopKeyStore {
35
+ readonly backendName = "neo4j";
36
+ readonly backendPath = process.env.NEO4J_URI ?? "<unset>";
37
+
38
+ async loadAll(accountId: string): Promise<LoopStoredKey[]> {
39
+ const session = getSession();
40
+ try {
41
+ const result = await session.run(
42
+ `MATCH (k:LoopTeamKey {accountId: $accountId})
43
+ RETURN k.teamName AS teamName, k.encryptedKey AS encryptedKey,
44
+ k.teamAddress AS teamAddress, k.agentId AS agentId,
45
+ k.permissions AS permissions, k.createdAt AS createdAt,
46
+ k.updatedAt AS updatedAt
47
+ ORDER BY k.teamName`,
48
+ { accountId },
49
+ );
50
+ return result.records.map((r) => ({
51
+ teamName: r.get("teamName"),
52
+ apiKey: decrypt(r.get("encryptedKey")),
53
+ teamAddress: r.get("teamAddress") ?? "",
54
+ agentId: r.get("agentId") ?? "",
55
+ permissions: r.get("permissions") ?? [],
56
+ createdAt: r.get("createdAt") ?? "",
57
+ updatedAt: r.get("updatedAt") ?? "",
58
+ }));
59
+ } finally {
60
+ await session.close();
61
+ }
62
+ }
63
+
64
+ async save(accountId: string, key: LoopKeyInput): Promise<{ created: boolean }> {
65
+ const encryptedKey = encrypt(key.apiKey);
66
+ const now = new Date().toISOString();
67
+ const session = getSession();
68
+ try {
69
+ await session.run(
70
+ `CREATE INDEX loop_team_key_account_team IF NOT EXISTS
71
+ FOR (k:LoopTeamKey) ON (k.accountId, k.teamName)`,
72
+ {},
73
+ );
74
+ const result = await session.run(
75
+ `MERGE (k:LoopTeamKey {teamName: $teamName, accountId: $accountId})
76
+ ON CREATE SET
77
+ k.encryptedKey = $encryptedKey,
78
+ k.teamAddress = $teamAddress,
79
+ k.agentId = $agentId,
80
+ k.permissions = $permissions,
81
+ k.createdAt = $now,
82
+ k.updatedAt = $now
83
+ RETURN k.createdAt = $now AS created`,
84
+ {
85
+ teamName: key.teamName,
86
+ encryptedKey,
87
+ teamAddress: key.teamAddress,
88
+ agentId: key.agentId,
89
+ accountId,
90
+ permissions: key.permissions,
91
+ now,
92
+ },
93
+ );
94
+ return { created: Boolean(result.records[0]?.get("created")) };
95
+ } finally {
96
+ await session.close();
97
+ }
98
+ }
99
+
100
+ async delete(accountId: string, teamName: string): Promise<boolean> {
101
+ const session = getSession();
102
+ try {
103
+ const result = await session.run(
104
+ `MATCH (k:LoopTeamKey {teamName: $teamName, accountId: $accountId})
105
+ DELETE k
106
+ RETURN count(k) AS deleted`,
107
+ { teamName, accountId },
108
+ );
109
+ const deleted = result.records[0]?.get("deleted")?.toNumber?.() ?? 0;
110
+ return deleted > 0;
111
+ } finally {
112
+ await session.close();
113
+ }
114
+ }
115
+ }
116
+
117
+ const LABEL = "loop";
118
+
119
+ interface FileEnvelope {
120
+ [accountId: string]: {
121
+ [teamName: string]: {
122
+ encryptedKey: string;
123
+ teamAddress: string;
124
+ agentId: string;
125
+ permissions: string[];
126
+ createdAt: string;
127
+ updatedAt: string;
128
+ };
129
+ };
130
+ }
131
+
132
+ class FileLoopKeyStore implements LoopKeyStore {
133
+ readonly backendName = "file";
134
+ readonly backendPath: string;
135
+ private readonly storePath: string;
136
+ private readonly keyFilePath: string;
137
+
138
+ constructor() {
139
+ const home = homedir();
140
+ this.storePath = resolve(home, ".claude/.realagent-loop-key.enc");
141
+ this.keyFilePath = resolve(home, ".claude/.realagent-loop-encryption-key");
142
+ this.backendPath = this.storePath;
143
+ }
144
+
145
+ private ensureDir(): void {
146
+ mkdirSync(dirname(this.storePath), { recursive: true });
147
+ }
148
+
149
+ private readAll(): FileEnvelope {
150
+ if (!existsSync(this.storePath)) return {};
151
+ const blob = readFileSync(this.storePath, "utf-8").trim();
152
+ if (!blob) return {};
153
+ const json = decryptWith(blob, this.keyFilePath, LABEL);
154
+ return JSON.parse(json) as FileEnvelope;
155
+ }
156
+
157
+ private writeAll(env: FileEnvelope): void {
158
+ this.ensureDir();
159
+ const blob = encryptWith(JSON.stringify(env), this.keyFilePath, LABEL);
160
+ writeFileSync(this.storePath, blob, { mode: 0o600 });
161
+ }
162
+
163
+ async loadAll(accountId: string): Promise<LoopStoredKey[]> {
164
+ const env = this.readAll();
165
+ const account = env[accountId];
166
+ if (!account) return [];
167
+ return Object.entries(account)
168
+ .map(([teamName, entry]) => ({
169
+ teamName,
170
+ apiKey: decryptWith(entry.encryptedKey, this.keyFilePath, LABEL),
171
+ teamAddress: entry.teamAddress,
172
+ agentId: entry.agentId,
173
+ permissions: entry.permissions,
174
+ createdAt: entry.createdAt,
175
+ updatedAt: entry.updatedAt,
176
+ }))
177
+ .sort((a, b) => a.teamName.localeCompare(b.teamName));
178
+ }
179
+
180
+ async save(accountId: string, key: LoopKeyInput): Promise<{ created: boolean }> {
181
+ const env = this.readAll();
182
+ const account = env[accountId] ?? {};
183
+ const prev = account[key.teamName];
184
+ const now = new Date().toISOString();
185
+ const encryptedKey = encryptWith(key.apiKey, this.keyFilePath, LABEL);
186
+ account[key.teamName] = {
187
+ encryptedKey,
188
+ teamAddress: key.teamAddress,
189
+ agentId: key.agentId,
190
+ permissions: key.permissions,
191
+ createdAt: prev?.createdAt ?? now,
192
+ updatedAt: now,
193
+ };
194
+ env[accountId] = account;
195
+ this.writeAll(env);
196
+ return { created: !prev };
197
+ }
198
+
199
+ async delete(accountId: string, teamName: string): Promise<boolean> {
200
+ const env = this.readAll();
201
+ const account = env[accountId];
202
+ if (!account || !(teamName in account)) return false;
203
+ delete account[teamName];
204
+ if (Object.keys(account).length === 0) delete env[accountId];
205
+ else env[accountId] = account;
206
+ this.writeAll(env);
207
+ return true;
208
+ }
209
+ }
210
+
211
+ let cached: LoopKeyStore | null = null;
212
+
213
+ export function selectLoopKeyStore(): LoopKeyStore {
214
+ if (cached) return cached;
215
+ cached = process.env.LOOP_STANDALONE === "1" ? new FileLoopKeyStore() : new Neo4jLoopKeyStore();
216
+ return cached;
217
+ }
218
+
219
+ export function _resetKeyStoreForTests(): void {
220
+ cached = null;
221
+ }
@@ -1,5 +1,4 @@
1
- import { getSession } from "./neo4j.js";
2
- import { decrypt } from "./crypto.js";
1
+ import { selectLoopKeyStore } from "./key-store.js";
3
2
 
4
3
  // ─────────────────────────────────────────────────────────────────
5
4
  // Loop API V2 HTTP Client + Cross-Team Aggregation Engine
@@ -90,7 +89,7 @@ function unwrapEnvelope<T>(parsed: unknown, toolName: string, teamName: string):
90
89
 
91
90
  export interface LoopTeamKey {
92
91
  teamName: string;
93
- encryptedKey: string;
92
+ apiKey: string;
94
93
  teamAddress: string;
95
94
  agentId: string;
96
95
  permissions: string[];
@@ -120,29 +119,7 @@ export interface AggregationResult<T> {
120
119
  * Load all LoopTeamKey nodes for an account from Neo4j.
121
120
  */
122
121
  export async function loadTeamKeys(accountId: string): Promise<LoopTeamKey[]> {
123
- const session = getSession();
124
- try {
125
- const result = await session.run(
126
- `MATCH (k:LoopTeamKey {accountId: $accountId})
127
- RETURN k.teamName AS teamName, k.encryptedKey AS encryptedKey,
128
- k.teamAddress AS teamAddress, k.agentId AS agentId,
129
- k.permissions AS permissions, k.createdAt AS createdAt,
130
- k.updatedAt AS updatedAt
131
- ORDER BY k.teamName`,
132
- { accountId }
133
- );
134
- return result.records.map((r) => ({
135
- teamName: r.get("teamName"),
136
- encryptedKey: r.get("encryptedKey"),
137
- teamAddress: r.get("teamAddress") ?? "",
138
- agentId: r.get("agentId") ?? "",
139
- permissions: r.get("permissions") ?? [],
140
- createdAt: r.get("createdAt") ?? "",
141
- updatedAt: r.get("updatedAt") ?? "",
142
- }));
143
- } finally {
144
- await session.close();
145
- }
122
+ return selectLoopKeyStore().loadAll(accountId);
146
123
  }
147
124
 
148
125
  // Truncate to 200 chars, escape newlines, single line — `[loop] <tool> team=<t>
@@ -396,20 +373,7 @@ export async function aggregateAcrossTeams<T>(
396
373
  continue;
397
374
  }
398
375
 
399
- let apiKey: string;
400
- try {
401
- apiKey = decrypt(key.encryptedKey);
402
- } catch (err) {
403
- const msg = err instanceof Error ? err.message : String(err);
404
- console.error(`[loop] decrypt failed for team=${key.teamName}: ${msg}`);
405
- failures.push({
406
- teamName: key.teamName,
407
- reason: "Decryption failed",
408
- kind: "other",
409
- });
410
- continue;
411
- }
412
-
376
+ const apiKey = key.apiKey;
413
377
  const teamName = key.teamName;
414
378
  tasks.push({
415
379
  key,
@@ -512,8 +476,7 @@ export async function withTeamKey<T>(
512
476
  );
513
477
  }
514
478
 
515
- const apiKey = decrypt(key.encryptedKey);
516
- return execute(apiKey);
479
+ return execute(key.apiKey);
517
480
  }
518
481
 
519
482
  /**
@@ -1,27 +1,12 @@
1
- import { getSession } from "../lib/neo4j.js";
1
+ import { selectLoopKeyStore } from "../lib/key-store.js";
2
2
 
3
3
  export async function keyDeregister(params: {
4
4
  teamName: string;
5
5
  accountId: string;
6
6
  }): Promise<void> {
7
- const { teamName, accountId } = params;
8
-
9
- const session = getSession();
10
- try {
11
- const result = await session.run(
12
- `MATCH (k:LoopTeamKey {teamName: $teamName, accountId: $accountId})
13
- DELETE k
14
- RETURN count(k) AS deleted`,
15
- { teamName, accountId }
16
- );
17
-
18
- const deleted = result.records[0]?.get("deleted")?.toNumber?.() ?? 0;
19
- if (deleted === 0) {
20
- throw new Error(`Team "${teamName}" not found.`);
21
- }
22
- } finally {
23
- await session.close();
7
+ const deleted = await selectLoopKeyStore().delete(params.accountId, params.teamName);
8
+ if (!deleted) {
9
+ throw new Error(`Team "${params.teamName}" not found.`);
24
10
  }
25
-
26
- console.error(`[loop] key-deregister team=${teamName} account=${accountId}`);
11
+ console.error(`[loop] key-deregister team=${params.teamName} account=${params.accountId}`);
27
12
  }
@@ -1,5 +1,4 @@
1
- import { getSession } from "../lib/neo4j.js";
2
- import { encrypt } from "../lib/crypto.js";
1
+ import { selectLoopKeyStore } from "../lib/key-store.js";
3
2
  import { loopGet, LoopApiError } from "../lib/loop-api.js";
4
3
 
5
4
  interface LoopTeamResponse {
@@ -21,7 +20,7 @@ export async function keyRegister(params: {
21
20
  const { teamName, apiKey, accountId } = params;
22
21
  const permissions = params.permissions ?? ALL_PERMISSIONS;
23
22
 
24
- // Validate key against Loop API — try /team endpoint
23
+ // Validate key against Loop API — try /team endpoint.
25
24
  let teamAddress = "";
26
25
  let agentId = "";
27
26
  let warning: string | undefined;
@@ -31,11 +30,10 @@ export async function keyRegister(params: {
31
30
  apiKey,
32
31
  "/team",
33
32
  "loop-key-register",
34
- teamName
33
+ teamName,
35
34
  );
36
35
 
37
36
  if (Array.isArray(teamData) && teamData.length === 0) {
38
- // 204 was converted to empty array — ambiguous scope
39
37
  warning =
40
38
  "Key accepted but Loop returned no team data (204). " +
41
39
  "Verify the key's scope in Loop's dashboard.";
@@ -47,49 +45,26 @@ export async function keyRegister(params: {
47
45
  if (err instanceof LoopApiError && err.status === 401) {
48
46
  throw new Error(
49
47
  `Loop API rejected the key for team "${teamName}" (HTTP 401). ` +
50
- `Check that the key is valid and not expired.`
48
+ `Check that the key is valid and not expired.`,
51
49
  );
52
50
  }
53
- // Network/timeout errors — still reject, key is unverified
54
51
  throw new Error(
55
- `Could not validate key against Loop API: ${err instanceof Error ? err.message : String(err)}`
52
+ `Could not validate key against Loop API: ${err instanceof Error ? err.message : String(err)}`,
56
53
  );
57
54
  }
58
55
 
59
- // Encrypt and store
60
- const encryptedKey = encrypt(apiKey);
61
- const now = new Date().toISOString();
56
+ const { created } = await selectLoopKeyStore().save(accountId, {
57
+ teamName,
58
+ apiKey,
59
+ teamAddress,
60
+ agentId,
61
+ permissions,
62
+ });
62
63
 
63
- const writeSession = getSession();
64
- try {
65
- await writeSession.run(
66
- `CREATE INDEX loop_team_key_account_team IF NOT EXISTS
67
- FOR (k:LoopTeamKey) ON (k.accountId, k.teamName)`,
68
- {}
69
- );
70
-
71
- const mergeResult = await writeSession.run(
72
- `MERGE (k:LoopTeamKey {teamName: $teamName, accountId: $accountId})
73
- ON CREATE SET
74
- k.encryptedKey = $encryptedKey,
75
- k.teamAddress = $teamAddress,
76
- k.agentId = $agentId,
77
- k.permissions = $permissions,
78
- k.createdAt = $now,
79
- k.updatedAt = $now
80
- RETURN k.createdAt = $now AS created`,
81
- { teamName, encryptedKey, teamAddress, agentId, accountId, permissions, now }
82
- );
83
-
84
- const created = mergeResult.records[0]?.get("created");
85
- if (!created) {
86
- throw new Error(`Team "${teamName}" is already registered for this account.`);
87
- }
88
- } finally {
89
- await writeSession.close();
64
+ if (!created) {
65
+ throw new Error(`Team "${teamName}" is already registered for this account.`);
90
66
  }
91
67
 
92
68
  console.error(`[loop] key-register team=${teamName} account=${accountId}`);
93
-
94
69
  return { warning };
95
70
  }
@@ -87,7 +87,20 @@ Local stdio MCP that proxies the PropertyData UK market-analytics HTTP API (prop
87
87
 
88
88
  ## Security
89
89
 
90
- The PropertyData API key is encrypted at rest with AES-256-GCM. Encryption key lives at `~/<configDir>/.property-data-encryption-key` with mode `0600`. Never include the key value in responses; identify the key by registration timestamp only. If the operator asks for the key value, explain that keys are encrypted and cannot be retrieved — they must be re-registered from the PropertyData dashboard.
90
+ The PropertyData API key is encrypted at rest with AES-256-GCM. The encryption-key file lives at `~/<configDir>/.property-data-encryption-key` (platform mode) or `~/.claude/.realagent-property-data-encryption-key` (standalone mode), both with mode `0600`. Never include the key value in responses; identify the key by registration timestamp only. If the operator asks for the key value, explain that keys are encrypted and cannot be retrieved — they must be re-registered from the PropertyData dashboard.
91
+
92
+ ## Standalone mode (`~/.claude/` spawn)
93
+
94
+ The same `mcp/dist/index.js` boots in two environments, selected by env flag:
95
+
96
+ | Env var | Platform mode | Standalone mode |
97
+ |---|---|---|
98
+ | `PROPERTY_DATA_STANDALONE` | unset | `"1"` |
99
+ | `ACCOUNT_ID` | platform tenant id | absent (defaults to `"local"`) |
100
+ | `NEO4J_URI` etc. | required | unused |
101
+ | `PROPERTY_DATA_API_KEY` | unused | optional one-shot bypass (skips the store entirely) |
102
+
103
+ In standalone mode keys live at `~/.claude/.realagent-property-data-key.enc`. See `.docs/realagent-mcps-standalone-mode.md` for the full contract.
91
104
 
92
105
  ## When to use these tools
93
106