brains-mcp 1.70.2 → 1.70.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"httpServer.d.ts","sourceRoot":"","sources":["../src/httpServer.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAQxB,OAAO,EAAsD,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AA8G7G,wBAAgB,8BAA8B,IAAI,IAAI,CAErD;AA04BD;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAI9D;AAgsBD,wBAAsB,eAAe,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CA2mF9F"}
1
+ {"version":3,"file":"httpServer.d.ts","sourceRoot":"","sources":["../src/httpServer.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAQxB,OAAO,EAAsD,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AA+G7G,wBAAgB,8BAA8B,IAAI,IAAI,CAErD;AA04BD;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAI9D;AAgsBD,wBAAsB,eAAe,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CA+nF9F"}
@@ -27,6 +27,7 @@ import { buildExportZip } from "./tools/exportWiki.js";
27
27
  import { runImportFromBuffer, isValidWikiFilename, computeDiscoveredFolders, buildInstructionRefreshHint, } from "./tools/importWikiZip.js";
28
28
  import { purgeWiki } from "./tools/purgeWiki.js";
29
29
  import { AsyncJobRegistry } from "./jobs/asyncJobRegistry.js";
30
+ import { exportDownloadStore } from "./jobs/exportDownloadStore.js";
30
31
  import { appendLogEntry } from "./wiki/log.js";
31
32
  import { DriveNotFoundError } from "./drive/errors.js";
32
33
  import { StorageLimitError, PageLimitError, resolvePageLimitContext } from "./wiki/storageLimits.js";
@@ -3102,6 +3103,25 @@ export async function startHttpServer(drive, port) {
3102
3103
  return;
3103
3104
  }
3104
3105
  if (method === "GET" && pathname === "/api/v1/export/download") {
3106
+ // Token path: serve a ZIP previously built by the export_wiki MCP tool
3107
+ // (GH #328) instead of kicking off a fresh async job. One-time-issued
3108
+ // token from exportDownloadStore, valid for 24h from build time.
3109
+ const token = parsedUrl.searchParams.get("token")?.trim();
3110
+ if (token) {
3111
+ const stored = exportDownloadStore.get(token);
3112
+ if (!stored) {
3113
+ json(req, res, 404, { ok: false, error: "Export not found or expired — request a new export" });
3114
+ return;
3115
+ }
3116
+ res.writeHead(200, {
3117
+ "Content-Type": "application/zip",
3118
+ "Content-Disposition": `attachment; filename="${stored.fileName}"`,
3119
+ "Content-Length": String(stored.buffer.length),
3120
+ "Cache-Control": "no-store",
3121
+ });
3122
+ res.end(stored.buffer);
3123
+ return;
3124
+ }
3105
3125
  const folder = parsedUrl.searchParams.get("folder")?.trim() || undefined;
3106
3126
  const tagsParam = parsedUrl.searchParams.get("tags");
3107
3127
  const tags = tagsParam