mcp-scraper 0.51.0 → 0.51.2

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.
@@ -0,0 +1,7 @@
1
+ // src/version.ts
2
+ var PACKAGE_VERSION = "0.51.2";
3
+
4
+ export {
5
+ PACKAGE_VERSION
6
+ };
7
+ //# sourceMappingURL=chunk-JNRSR5ZJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/version.ts"],"sourcesContent":["export const PACKAGE_VERSION = '0.51.2'\n"],"mappings":";AAAO,IAAM,kBAAkB;","names":[]}
@@ -158,7 +158,7 @@ import {
158
158
  resolveDeploymentProfile,
159
159
  resolveLocalSourcebookSchemaType,
160
160
  transcribeMediaUrl
161
- } from "./chunk-O63VVCCE.js";
161
+ } from "./chunk-FCZ3QCZP.js";
162
162
  import {
163
163
  auditImageUrls,
164
164
  auditImages,
@@ -214,7 +214,7 @@ import {
214
214
  } from "./chunk-3ZUBQQPQ.js";
215
215
  import {
216
216
  PACKAGE_VERSION
217
- } from "./chunk-73MUQSWC.js";
217
+ } from "./chunk-JNRSR5ZJ.js";
218
218
  import {
219
219
  abandonExtractSettlement,
220
220
  countSuccessfulPages,
@@ -24010,7 +24010,50 @@ function folderInventory(result) {
24010
24010
  }
24011
24011
  function enrichMemoryResult(toolName, result) {
24012
24012
  if (toolName !== "listTool" || result.ok !== true) return result;
24013
- return { ...result, folders: folderInventory(result) };
24013
+ if (result.scope === "account") return result;
24014
+ return { ...result, scope: "vault", folders: folderInventory(result) };
24015
+ }
24016
+ async function buildAccountMemoryInventory(args, listOne) {
24017
+ const filters = { ...args };
24018
+ delete filters.allVaults;
24019
+ delete filters.vault;
24020
+ const initial = enrichMemoryResult("listTool", await listOne(filters));
24021
+ if (initial.ok !== true) return initial;
24022
+ const vaults = Array.isArray(initial.vaults) ? initial.vaults.filter((vault) => typeof vault === "string") : [];
24023
+ const initialVault = typeof initial.vault === "string" ? initial.vault : null;
24024
+ if (!vaults.length && initialVault) vaults.push(initialVault);
24025
+ const vaultInventories = [];
24026
+ for (const vault of vaults) {
24027
+ const listed = vault === initialVault ? initial : enrichMemoryResult("listTool", await listOne({ ...filters, vault }));
24028
+ if (listed.ok !== true) {
24029
+ return {
24030
+ ok: false,
24031
+ scope: "account",
24032
+ partial: true,
24033
+ vaults,
24034
+ vaultInventories,
24035
+ error: typeof listed.error === "string" ? `Could not list vault ${vault}: ${listed.error}` : `Could not list vault ${vault}`
24036
+ };
24037
+ }
24038
+ const notes = Array.isArray(listed.notes) ? listed.notes : [];
24039
+ const folders = Array.isArray(listed.folders) ? listed.folders : [];
24040
+ vaultInventories.push({
24041
+ vault,
24042
+ noteCount: notes.length,
24043
+ folderCount: folders.length,
24044
+ notes,
24045
+ folders
24046
+ });
24047
+ }
24048
+ return {
24049
+ ok: true,
24050
+ scope: "account",
24051
+ partial: false,
24052
+ vaults,
24053
+ totalNotes: vaultInventories.reduce((sum, inventory) => sum + Number(inventory.noteCount), 0),
24054
+ totalFolders: vaultInventories.reduce((sum, inventory) => sum + Number(inventory.folderCount), 0),
24055
+ vaultInventories
24056
+ };
24014
24057
  }
24015
24058
  var MemoryMcpToolExecutor = class {
24016
24059
  baseUrl;
@@ -24021,22 +24064,25 @@ var MemoryMcpToolExecutor = class {
24021
24064
  }
24022
24065
  async callMemoryTool(toolName, args) {
24023
24066
  try {
24024
- const res = await fetch(`${this.baseUrl}/memory/mcp-call`, {
24025
- method: "POST",
24026
- headers: {
24027
- "content-type": "application/json",
24028
- "x-api-key": this.apiKey
24029
- },
24030
- body: JSON.stringify({ toolName, args })
24031
- });
24032
- const data = await res.json().catch(() => null);
24033
- if (!res.ok) {
24034
- const message = data?.error ?? `memory ${toolName} failed (HTTP ${res.status})`;
24035
- return { content: [{ type: "text", text: message }], isError: true };
24036
- }
24067
+ const callOne = async (input) => {
24068
+ const res = await fetch(`${this.baseUrl}/memory/mcp-call`, {
24069
+ method: "POST",
24070
+ headers: {
24071
+ "content-type": "application/json",
24072
+ "x-api-key": this.apiKey
24073
+ },
24074
+ body: JSON.stringify({ toolName, args: input })
24075
+ });
24076
+ const data2 = await res.json().catch(() => null);
24077
+ if (!res.ok) {
24078
+ throw new Error(data2?.error ?? `memory ${toolName} failed (HTTP ${res.status})`);
24079
+ }
24080
+ return data2 ?? { ok: false, error: `memory ${toolName} returned no result` };
24081
+ };
24082
+ const data = toolName === "listTool" && args.allVaults === true ? await buildAccountMemoryInventory(args, callOne) : await callOne(args);
24037
24083
  const result = enrichMemoryResult(
24038
24084
  toolName,
24039
- data ?? { ok: false, error: `memory ${toolName} returned no result` }
24085
+ data
24040
24086
  );
24041
24087
  return {
24042
24088
  content: [{ type: "text", text: JSON.stringify(result) }],
@@ -24253,8 +24299,9 @@ function registerReadCutovers() {
24253
24299
  return { content: [{ type: "text", text: JSON.stringify(result ?? {}) }], structuredContent: result ?? {}, isError: false };
24254
24300
  });
24255
24301
  registerCutover("listTool", async (input, apiKey) => {
24256
- const result = await listTool.execute({ ...input, apiKey }, {});
24257
- return { content: [{ type: "text", text: JSON.stringify(result ?? {}) }], structuredContent: result ?? {}, isError: false };
24302
+ const listOne = async (args) => await listTool.execute({ ...args, apiKey }, {}) ?? {};
24303
+ const result = input.allVaults === true ? await buildAccountMemoryInventory(input, listOne) : enrichMemoryResult("listTool", await listOne(input));
24304
+ return { content: [{ type: "text", text: JSON.stringify(result) }], structuredContent: result, isError: false };
24258
24305
  });
24259
24306
  registerCutover("searchTool", async (input, apiKey) => {
24260
24307
  const result = await searchTool.execute({ ...input, apiKey }, {});
@@ -44550,4 +44597,4 @@ app.get("/blog/:slug/", (c) => {
44550
44597
  export {
44551
44598
  app
44552
44599
  };
44553
- //# sourceMappingURL=server-IGIIEHXY.js.map
44600
+ //# sourceMappingURL=server-KAEHVDY7.js.map