@neurynae/toolcairn-mcp 0.10.7 → 0.10.9

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.js CHANGED
@@ -4503,14 +4503,37 @@ async function autoInitProject(input) {
4503
4503
  cfg.project.languages = scan.languages;
4504
4504
  cfg.project.frameworks = scan.frameworks;
4505
4505
  cfg.project.subprojects = scan.subprojects;
4506
- cfg.tools.confirmed = scan.tools;
4507
4506
  cfg.scan_metadata = scan.scan_metadata;
4508
- const priorByKey = /* @__PURE__ */ new Map();
4507
+ if (!batchResolveFailed) {
4508
+ const priorConfirmedByKey = /* @__PURE__ */ new Map();
4509
+ for (const existing of cfg.tools.confirmed) {
4510
+ const eco = existing.locations?.[0]?.ecosystem ?? "";
4511
+ priorConfirmedByKey.set(`${eco}:${existing.name}`, existing);
4512
+ }
4513
+ cfg.tools.confirmed = scan.tools.map((fresh) => {
4514
+ const eco = fresh.locations?.[0]?.ecosystem ?? "";
4515
+ const prior = priorConfirmedByKey.get(`${eco}:${fresh.name}`);
4516
+ if (!prior)
4517
+ return fresh;
4518
+ return {
4519
+ ...fresh,
4520
+ // Preserve add-time ordinals + user-set fields.
4521
+ chosen_at: prior.chosen_at ?? fresh.chosen_at,
4522
+ confirmed_at: prior.confirmed_at ?? prior.chosen_at ?? fresh.chosen_at,
4523
+ last_verified: now,
4524
+ chosen_reason: prior.chosen_reason && prior.chosen_reason.length > 0 ? prior.chosen_reason : fresh.chosen_reason,
4525
+ alternatives_considered: prior.alternatives_considered && prior.alternatives_considered.length > 0 ? prior.alternatives_considered : fresh.alternatives_considered,
4526
+ query_id: prior.query_id ?? fresh.query_id,
4527
+ notes: prior.notes ?? fresh.notes
4528
+ };
4529
+ });
4530
+ }
4531
+ const priorUnknownByKey = /* @__PURE__ */ new Map();
4509
4532
  for (const existing of cfg.tools.unknown_in_graph ?? []) {
4510
- priorByKey.set(`${existing.ecosystem}:${existing.name}`, existing);
4533
+ priorUnknownByKey.set(`${existing.ecosystem}:${existing.name}`, existing);
4511
4534
  }
4512
4535
  cfg.tools.unknown_in_graph = unknownFromScan.map((fresh) => {
4513
- const prior = priorByKey.get(`${fresh.ecosystem}:${fresh.name}`);
4536
+ const prior = priorUnknownByKey.get(`${fresh.ecosystem}:${fresh.name}`);
4514
4537
  if (prior?.suggested) {
4515
4538
  return { ...fresh, suggested: true, suggested_at: prior.suggested_at };
4516
4539
  }
@@ -6082,19 +6105,6 @@ async function main() {
6082
6105
  let server;
6083
6106
  if (authenticated) {
6084
6107
  logger26.info({ user: creds.user_email }, "Authenticated \u2014 starting full server");
6085
- try {
6086
- const summary = await runPostAuthInit({ agent: "claude", onlyMissingConfig: true });
6087
- logger26.info(
6088
- {
6089
- roots: summary.roots_discovered.length,
6090
- provisioned: summary.projects.length,
6091
- unknown_tools_total: summary.unknown_tools_total
6092
- },
6093
- "Startup auto-init complete"
6094
- );
6095
- } catch (err) {
6096
- logger26.warn({ err }, "Startup auto-init failed \u2014 continuing with tool registration");
6097
- }
6098
6108
  server = await buildProdServer();
6099
6109
  } else {
6100
6110
  let verificationUri = "https://toolcairn.neurynae.com/signup";
@@ -6174,6 +6184,20 @@ After sign-in the server will automatically provision .toolcairn/config.json for
6174
6184
  const transport = createTransport();
6175
6185
  await server.connect(transport);
6176
6186
  logger26.info(authenticated ? "ToolCairn MCP ready" : "ToolCairn MCP ready (awaiting sign-in)");
6187
+ if (authenticated) {
6188
+ void runPostAuthInit({ agent: "claude" }).then((summary) => {
6189
+ logger26.info(
6190
+ {
6191
+ roots: summary.roots_discovered.length,
6192
+ provisioned: summary.projects.length,
6193
+ unknown_tools_total: summary.unknown_tools_total
6194
+ },
6195
+ "Background auto-refresh complete"
6196
+ );
6197
+ }).catch((err) => {
6198
+ logger26.warn({ err }, "Background auto-refresh failed \u2014 config left as-is");
6199
+ });
6200
+ }
6177
6201
  }
6178
6202
  main().catch((error) => {
6179
6203
  (0, import_errors28.createMcpLogger)({ name: "@toolcairn/mcp-server" }).error(