@llmnesia/mcp 0.1.5 → 0.1.7

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/README.md CHANGED
@@ -48,10 +48,12 @@ The installer:
48
48
  1. sets up the native host that bridges the browser extension to your local
49
49
  corpus,
50
50
  2. copies the server into `~/.llmnesia/bin` so it has a permanent home,
51
- 3. detects supported MCP clients you have (Claude Code, Claude Desktop,
52
- Cursor, and Codex), and
53
- 4. registers that copy with each detected client — using the client's own CLI
54
- where available, or with an automatic backup before editing its config file.
51
+ 3. sets up the supported desktop AI apps (Claude Code, Claude Desktop, Cursor,
52
+ and Codex/ChatGPT), and
53
+ 4. registers that copy using the client's own CLI where available, or with an
54
+ automatic backup before editing its documented user config. It prepares all
55
+ of those standard config paths, so an app installed later does not require
56
+ running setup again.
55
57
 
56
58
  The `install` command is the approval to perform those setup steps. It does not
57
59
  interrupt setup with a separate prompt for every detected app, and it never
@@ -118,10 +120,10 @@ received data — check it before concluding a chat does not exist.
118
120
 
119
121
  | Client | How `install` wires it |
120
122
  | --- | --- |
121
- | Claude Code | Runs `claude mcp add --scope user` with the absolute Node and installed runtime paths, making it available in every project (detects `claude` on PATH). |
122
- | Claude Desktop | Edits `claude_desktop_config.json` at the standard OS-specific path. |
123
- | Cursor | Edits `~/.cursor/mcp.json`. |
124
- | Codex | Runs `codex mcp add` with the absolute runtime paths when available. If Windows does not expose the app's bundled CLI, the installer safely edits `~/.codex/config.toml` itself and backs up existing settings first. Read-only LLMnesia tools are configured to run without repeated approval prompts; writes still ask. |
123
+ | Claude Code | Runs `claude mcp add --scope user` with the absolute Node and installed runtime paths when available. Otherwise it writes the documented user-scope `~/.claude.json` entry, so Windows users do not need the `claude` command on PATH. |
124
+ | Claude Desktop | Edits `claude_desktop_config.json` at the standard OS-specific path, preparing it in advance if Claude Desktop is installed later. |
125
+ | Cursor | Edits `~/.cursor/mcp.json`, preparing it in advance if Cursor is installed later. |
126
+ | Codex / ChatGPT desktop | Runs `codex mcp add` with the absolute runtime paths when available. If the bundled CLI is unavailable, the installer safely edits `~/.codex/config.toml` itself and backs up existing settings first, including preparing it for a later installation. Read-only LLMnesia tools are configured to run without repeated approval prompts; writes still ask. |
125
127
  | Others (Windsurf, Zed, LM Studio, …) | Prints the generic stdio block for you to paste. |
126
128
 
127
129
  **Cloud-only clients cannot reach a local stdio server** (web ChatGPT, Lovable,
@@ -38,7 +38,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
38
38
  ));
39
39
 
40
40
  // src/version.ts
41
- var VERSION = true ? "0.1.5" : "0.0.0-dev";
41
+ var VERSION = true ? "0.1.7" : "0.0.0-dev";
42
42
 
43
43
  export {
44
44
  __require,
@@ -15,7 +15,7 @@ import {
15
15
  __commonJS,
16
16
  __require,
17
17
  __toESM
18
- } from "./chunk-YVBAQ5VA.js";
18
+ } from "./chunk-VVUZBDC7.js";
19
19
 
20
20
  // ../node_modules/isexe/windows.js
21
21
  var require_windows = __commonJS({
@@ -2606,7 +2606,7 @@ async function watchInbox(corpus, onDrain) {
2606
2606
  // src/clientRegistration.ts
2607
2607
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
2608
2608
  import { execFile as execFile2 } from "child_process";
2609
- import { access, readFile as readFile2, stat as stat5, writeFile as writeFile2 } from "fs/promises";
2609
+ import { access, mkdir as mkdir2, readFile as readFile2, stat as stat5, writeFile as writeFile2 } from "fs/promises";
2610
2610
  import { homedir as homedir2, platform as platform2 } from "os";
2611
2611
  import { dirname as dirname4, join as join4 } from "path";
2612
2612
  import { promisify as promisify2 } from "util";
@@ -2820,9 +2820,11 @@ ${"stderr" in err ? String(err.stderr) : ""}` : errorMessage(err);
2820
2820
  await runCodex(["mcp", "remove", name]);
2821
2821
  }
2822
2822
  };
2823
- function paths(home2, osPlatform2) {
2824
- const claudeDesktop = osPlatform2 === "darwin" ? join4(home2, "Library", "Application Support", "Claude", "claude_desktop_config.json") : osPlatform2 === "win32" ? join4(process.env.APPDATA || join4(home2, "AppData", "Roaming"), "Claude", "claude_desktop_config.json") : null;
2823
+ function paths(home2, osPlatform2, appData) {
2824
+ const claudeCodeRoot = process.env.CLAUDE_CONFIG_DIR || home2;
2825
+ const claudeDesktop = osPlatform2 === "darwin" ? join4(home2, "Library", "Application Support", "Claude", "claude_desktop_config.json") : osPlatform2 === "win32" ? join4(appData || process.env.APPDATA || join4(home2, "AppData", "Roaming"), "Claude", "claude_desktop_config.json") : null;
2825
2826
  return {
2827
+ claudeCode: join4(claudeCodeRoot, ".claude.json"),
2826
2828
  claudeDesktop,
2827
2829
  cursor: join4(home2, ".cursor", "mcp.json"),
2828
2830
  codex: join4(home2, ".codex", "config.toml")
@@ -2870,10 +2872,13 @@ async function clientDirExists(configPath) {
2870
2872
  return false;
2871
2873
  }
2872
2874
  }
2873
- async function registerClaudeCode(serve, cli, confirm) {
2875
+ async function registerClaudeCode(serve, cli, configPath, confirm, now, prepareMissing) {
2874
2876
  const present = await cli.detect();
2875
2877
  if (!present) {
2876
- return { client: "Claude Code", action: "skipped", detail: "`claude` not found on PATH." };
2878
+ if (!prepareMissing) {
2879
+ return { client: "Claude Code", action: "skipped", detail: "`claude` not found on PATH." };
2880
+ }
2881
+ return registerJsonClient("Claude Code", configPath, serve, confirm, now, prepareMissing, true);
2877
2882
  }
2878
2883
  let existing;
2879
2884
  try {
@@ -2955,15 +2960,19 @@ claude mcp add --scope user ${SERVER_NAME} -- ${serve.command} ${serve.args.join
2955
2960
  function sameServeCommand(left, right) {
2956
2961
  return left.command === right.command && JSON.stringify(left.args) === JSON.stringify(right.args);
2957
2962
  }
2958
- async function registerCodex(serve, cli, configPath, confirm, now) {
2963
+ async function registerCodex(serve, cli, configPath, confirm, now, prepareMissing = false) {
2959
2964
  if (!await cli.detect()) {
2960
- if (!await clientDirExists(configPath)) {
2965
+ const configDirExists = await clientDirExists(configPath);
2966
+ if (!configDirExists && !prepareMissing) {
2961
2967
  return {
2962
2968
  client: "Codex",
2963
2969
  action: "skipped",
2964
2970
  detail: `Not installed (no Codex CLI and no ${dirname4(configPath)}).`
2965
2971
  };
2966
2972
  }
2973
+ if (!configDirExists) {
2974
+ await mkdir2(dirname4(configPath), { recursive: true });
2975
+ }
2967
2976
  try {
2968
2977
  const raw = await readFile2(configPath, "utf8");
2969
2978
  if (renderCodexConfig(raw, serve) === raw) {
@@ -2986,8 +2995,8 @@ ${codexBlock(serve)}`
2986
2995
  const update = await writeCodexConfig(configPath, serve, now);
2987
2996
  return {
2988
2997
  client: "Codex",
2989
- action: update.changed ? "registered" : "skipped",
2990
- detail: update.changed ? `Wrote ${configPath}${update.backupPath ? ` (backup: ${update.backupPath})` : ""}.` : `Already registered at ${configPath}.`
2998
+ action: update.changed ? configDirExists ? "registered" : "prepared" : "skipped",
2999
+ detail: update.changed ? configDirExists ? `Wrote ${configPath}${update.backupPath ? ` (backup: ${update.backupPath})` : ""}.` : `Prepared ${configPath} for a future Codex or ChatGPT installation.` : `Already registered at ${configPath}.`
2991
3000
  };
2992
3001
  } catch (err) {
2993
3002
  return { client: "Codex", action: "error", detail: `Could not update ${configPath}: ${errorMessage(err)}` };
@@ -3068,14 +3077,22 @@ codex mcp add ${SERVER_NAME} -- ${serve.command} ${serve.args.join(" ")}`
3068
3077
  detail: `Ran: codex mcp add ${SERVER_NAME} -- ${serve.command} ${serve.args.join(" ")}`
3069
3078
  };
3070
3079
  }
3071
- async function registerJsonClient(clientLabel, configPath, serve, confirm, now) {
3072
- if (!await clientDirExists(configPath)) {
3080
+ async function registerJsonClient(clientLabel, configPath, serve, confirm, now, prepareMissing = false, prepareWhenConfigAbsent = false) {
3081
+ const configDirExists = await clientDirExists(configPath);
3082
+ if (!configDirExists && !prepareMissing) {
3073
3083
  return {
3074
3084
  client: clientLabel,
3075
3085
  action: "skipped",
3076
3086
  detail: `Not installed (no ${dirname4(configPath)}). Re-run install after setting it up.`
3077
3087
  };
3078
3088
  }
3089
+ if (!configDirExists) {
3090
+ try {
3091
+ await mkdir2(dirname4(configPath), { recursive: true });
3092
+ } catch (err) {
3093
+ return { client: clientLabel, action: "error", detail: `Could not prepare ${configPath}: ${errorMessage(err)}` };
3094
+ }
3095
+ }
3079
3096
  let data;
3080
3097
  let existed;
3081
3098
  let raw;
@@ -3112,7 +3129,11 @@ ${preview}`;
3112
3129
  const nextData = { ...data, mcpServers: { ...servers, [SERVER_NAME]: nextEntry } };
3113
3130
  await writeFile2(configPath, `${JSON.stringify(nextData, null, 2)}
3114
3131
  `, "utf8");
3115
- return { client: clientLabel, action: "registered", detail: `Wrote ${configPath}.` };
3132
+ return {
3133
+ client: clientLabel,
3134
+ action: configDirExists && !(prepareWhenConfigAbsent && !existed) ? "registered" : "prepared",
3135
+ detail: configDirExists ? prepareWhenConfigAbsent && !existed ? `Prepared ${configPath} for a future ${clientLabel} installation.` : `Wrote ${configPath}.` : `Prepared ${configPath} for a future ${clientLabel} installation.`
3136
+ };
3116
3137
  } catch (err) {
3117
3138
  return { client: clientLabel, action: "error", detail: `Could not write ${configPath}: ${errorMessage(err)}` };
3118
3139
  }
@@ -3205,7 +3226,8 @@ async function registerClients(options) {
3205
3226
  const home2 = options.home ?? homedir2();
3206
3227
  const osPlatform2 = options.osPlatform ?? platform2();
3207
3228
  const now = options.now ?? (() => Date.now());
3208
- const { claudeDesktop, cursor, codex } = paths(home2, osPlatform2);
3229
+ const prepareMissing = options.prepareMissingDesktopApps === true;
3230
+ const { claudeCode, claudeDesktop, cursor, codex } = paths(home2, osPlatform2, options.appData);
3209
3231
  const results = [];
3210
3232
  const safe = async (client, fn) => {
3211
3233
  try {
@@ -3217,22 +3239,31 @@ async function registerClients(options) {
3217
3239
  results.push(
3218
3240
  await safe(
3219
3241
  "Claude Code",
3220
- () => registerClaudeCode(options.serve, options.claudeCli ?? realClaudeCli, options.confirm)
3242
+ () => registerClaudeCode(
3243
+ options.serve,
3244
+ options.claudeCli ?? realClaudeCli,
3245
+ claudeCode,
3246
+ options.confirm,
3247
+ now,
3248
+ prepareMissing
3249
+ )
3221
3250
  )
3222
3251
  );
3223
3252
  if (claudeDesktop) {
3224
3253
  results.push(
3225
3254
  await safe(
3226
3255
  "Claude Desktop",
3227
- () => registerJsonClient("Claude Desktop", claudeDesktop, options.serve, options.confirm, now)
3256
+ () => registerJsonClient("Claude Desktop", claudeDesktop, options.serve, options.confirm, now, prepareMissing)
3228
3257
  )
3229
3258
  );
3230
3259
  }
3231
- results.push(await safe("Cursor", () => registerJsonClient("Cursor", cursor, options.serve, options.confirm, now)));
3260
+ results.push(
3261
+ await safe("Cursor", () => registerJsonClient("Cursor", cursor, options.serve, options.confirm, now, prepareMissing))
3262
+ );
3232
3263
  results.push(
3233
3264
  await safe(
3234
3265
  "Codex",
3235
- () => registerCodex(options.serve, options.codexCli ?? realCodexCli, codex, options.confirm, now)
3266
+ () => registerCodex(options.serve, options.codexCli ?? realCodexCli, codex, options.confirm, now, prepareMissing)
3236
3267
  )
3237
3268
  );
3238
3269
  results.push({
@@ -3378,7 +3409,7 @@ import { delimiter, dirname as dirname6, isAbsolute as isAbsolute2, join as join
3378
3409
  import { homedir as homedir4, platform as platform3 } from "os";
3379
3410
 
3380
3411
  // src/runtimeInstall.ts
3381
- import { cp, mkdir as mkdir2, readdir as readdir3, rename, rm as rm2, writeFile as writeFile3 } from "fs/promises";
3412
+ import { cp, mkdir as mkdir3, readdir as readdir3, rename, rm as rm2, writeFile as writeFile3 } from "fs/promises";
3382
3413
  import { existsSync } from "fs";
3383
3414
  import { homedir as homedir3 } from "os";
3384
3415
  import { dirname as dirname5, join as join5 } from "path";
@@ -3404,10 +3435,10 @@ async function installRuntime(options = {}) {
3404
3435
  const nonce = `${process.pid}-${Date.now()}`;
3405
3436
  const stagingDir = join5(parentDir, `.bin-install-${nonce}`);
3406
3437
  const backupDir = join5(parentDir, `.bin-backup-${nonce}`);
3407
- await mkdir2(parentDir, { recursive: true });
3438
+ await mkdir3(parentDir, { recursive: true });
3408
3439
  await rm2(stagingDir, { recursive: true, force: true });
3409
3440
  await rm2(backupDir, { recursive: true, force: true });
3410
- await mkdir2(stagingDir, { recursive: true });
3441
+ await mkdir3(stagingDir, { recursive: true });
3411
3442
  try {
3412
3443
  for (const name of await readdir3(sourceDir)) {
3413
3444
  await cp(join5(sourceDir, name), join5(stagingDir, name), { recursive: true });
@@ -3793,66 +3824,67 @@ ${message}
3793
3824
  rl.close();
3794
3825
  }
3795
3826
  }
3796
- function printRegistrationResults(results) {
3797
- for (const r of results) {
3798
- if (r.client.startsWith("Other MCP clients")) {
3799
- continue;
3800
- }
3801
- if (r.action === "registered") {
3802
- process.stdout.write(`\u2713 ${r.client}
3803
- `);
3804
- continue;
3805
- }
3806
- if (r.action === "skipped" && r.detail.startsWith("Already registered")) {
3807
- process.stdout.write(`\u2713 ${r.client} (already configured)
3808
- `);
3809
- continue;
3810
- }
3811
- if (r.action === "error") {
3812
- process.stderr.write(`\u2717 ${r.client}: ${r.detail}
3813
- `);
3814
- continue;
3815
- }
3816
- if (r.action === "printed") {
3817
- process.stdout.write(`\u2022 ${r.client}: ${r.detail}
3818
- `);
3819
- }
3820
- }
3827
+ function summarizeClientRegistrations(results) {
3828
+ const connected = [];
3829
+ const prepared = [];
3830
+ const errors = [];
3831
+ for (const result of results) {
3832
+ if (result.client.startsWith("Other MCP clients")) continue;
3833
+ if (result.action === "registered" || result.action === "skipped" && result.detail.startsWith("Already registered")) {
3834
+ connected.push(result.client);
3835
+ } else if (result.action === "prepared") {
3836
+ prepared.push(result.client);
3837
+ } else if (result.action === "error") {
3838
+ errors.push({ client: result.client, detail: result.detail });
3839
+ }
3840
+ }
3841
+ return { connected, prepared, errors };
3842
+ }
3843
+ function formatInstallSuccess() {
3844
+ return "\nSetup complete.\nFully close and reopen your browser and any desktop AI app you use.\nLLMnesia will be available in each supported desktop AI app you use.\nLLMnesia Settings will confirm when your history is ready.\n";
3821
3845
  }
3822
3846
  async function runInstall(positionals, options, flags) {
3823
3847
  let hadProblems = false;
3824
- process.stdout.write("Installing LLMnesia MCP\u2026\n");
3848
+ process.stdout.write("Connecting your browser...\n");
3825
3849
  try {
3826
- const host = await installNativeHost({
3850
+ await installNativeHost({
3827
3851
  ids: positionals,
3828
3852
  corpus: options.corpus,
3829
3853
  force: flags.has("force"),
3830
3854
  quiet: true
3831
3855
  });
3832
- process.stdout.write(`\u2713 Browser helper (${host.installedCount} browser${host.installedCount === 1 ? "" : "s"})
3833
- `);
3856
+ process.stdout.write("Browser connected.\n");
3834
3857
  } catch (err) {
3835
3858
  hadProblems = true;
3836
- process.stderr.write(`\u2717 Browser helper: ${err instanceof Error ? err.message : String(err)}
3859
+ process.stderr.write(`Could not connect your browser: ${err instanceof Error ? err.message : String(err)}
3837
3860
  `);
3838
3861
  }
3839
- const runtime = await installRuntime();
3840
- process.stdout.write("\u2713 MCP runtime\n");
3841
- const results = await registerClients({ serve: runtime.serve, confirm: async () => true });
3842
- printRegistrationResults(results);
3843
- hadProblems ||= results.some((result) => result.action === "error");
3844
- process.stdout.write(
3845
- "\nDesktop helper installed. Fully quit and reopen your MCP apps and browser.\nBrowser sync is required or your MCP history will be empty. If you did not start in LLMnesia Settings, open it and click \u2018Enable automatic sync\u2019 once. LLMnesia will finish the first sync automatically.\n"
3846
- );
3847
- const npxCommand = process.platform === "win32" ? "npx.cmd" : "npx";
3848
- process.stdout.write(`Then run \`${npxCommand} -y @llmnesia/mcp@latest doctor\` to check what's wired up.
3862
+ process.stdout.write("Connecting your desktop AI apps...\n");
3863
+ let runtime;
3864
+ try {
3865
+ runtime = await installRuntime();
3866
+ } catch (err) {
3867
+ process.stderr.write(`Could not install LLMnesia: ${err instanceof Error ? err.message : String(err)}
3849
3868
  `);
3869
+ process.stderr.write("Setup needs attention. Fix the message above, then run the same command again.\n");
3870
+ return 1;
3871
+ }
3872
+ const results = await registerClients({
3873
+ serve: runtime.serve,
3874
+ confirm: async () => true,
3875
+ prepareMissingDesktopApps: true
3876
+ });
3877
+ const registrations = summarizeClientRegistrations(results);
3878
+ for (const error of registrations.errors) {
3879
+ process.stderr.write(`Could not connect ${error.client}: ${error.detail}
3880
+ `);
3881
+ }
3882
+ hadProblems ||= registrations.errors.length > 0;
3850
3883
  if (hadProblems) {
3851
- process.stderr.write(
3852
- "\nInstall completed with problems. Review the error messages above; no failure was silently treated as success.\n"
3853
- );
3884
+ process.stderr.write("\nSetup needs attention. Fix the message above, then run the same command again.\n");
3854
3885
  return 1;
3855
3886
  }
3887
+ process.stdout.write(formatInstallSuccess());
3856
3888
  return 0;
3857
3889
  }
3858
3890
  async function runUninstall(flags) {
@@ -3867,10 +3899,19 @@ async function runUninstall(flags) {
3867
3899
  }
3868
3900
  }
3869
3901
  const results = await unregisterClients();
3870
- printRegistrationResults(results);
3902
+ for (const result of results) {
3903
+ if (result.client.startsWith("Other MCP clients")) continue;
3904
+ if (result.action === "registered") {
3905
+ process.stdout.write(`${result.client} disconnected.
3906
+ `);
3907
+ } else if (result.action === "error") {
3908
+ process.stderr.write(`Could not disconnect ${result.client}: ${result.detail}
3909
+ `);
3910
+ }
3911
+ }
3871
3912
  if (results.some((result) => result.action === "error")) {
3872
3913
  process.stderr.write(
3873
- "Uninstall stopped before removing the runtime or browser host because one or more client registrations could not be removed. Fix the \u2717 messages above and retry.\n"
3914
+ "Uninstall stopped before removing the remaining files. Fix the message above and try again.\n"
3874
3915
  );
3875
3916
  return 1;
3876
3917
  }
@@ -4062,7 +4103,9 @@ function collapse(text) {
4062
4103
  return text.replace(/\s+/g, " ").trim();
4063
4104
  }
4064
4105
  export {
4065
- main
4106
+ formatInstallSuccess,
4107
+ main,
4108
+ summarizeClientRegistrations
4066
4109
  };
4067
4110
  /*! Bundled license information:
4068
4111
 
package/dist/cli.js CHANGED
@@ -3,7 +3,7 @@ import { createRequire as __llmnesiaCreateRequire } from "node:module";
3
3
  const require = __llmnesiaCreateRequire(import.meta.url);
4
4
  import {
5
5
  VERSION
6
- } from "./chunk-YVBAQ5VA.js";
6
+ } from "./chunk-VVUZBDC7.js";
7
7
 
8
8
  // src/nodeDownload.ts
9
9
  var NODE_DOWNLOAD_URLS = {
@@ -141,7 +141,7 @@ async function bootstrap() {
141
141
  await guideUnsupportedNodeVersion(process.versions.node);
142
142
  return 1;
143
143
  }
144
- const { main } = await import("./cli-TVE63AWC.js");
144
+ const { main } = await import("./cli-I5OU54IJ.js");
145
145
  return main();
146
146
  }
147
147
  bootstrap().then((code) => {
package/dist/mcp.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  __commonJS,
14
14
  __export,
15
15
  __toESM
16
- } from "./chunk-YVBAQ5VA.js";
16
+ } from "./chunk-VVUZBDC7.js";
17
17
 
18
18
  // ../node_modules/ajv/dist/compile/codegen/code.js
19
19
  var require_code = __commonJS({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llmnesia/mcp",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "comment:mcpName": "The MCP Registry's ownership marker: it must equal server.json's `name`, and the namespace must match how you authenticate with mcp-publisher. `com.llmnesia/...` requires DNS auth (a TXT record on llmnesia.com) — see docs/MCP_INSTALLER_BOARD.md.",