mcp-scraper 0.10.0 → 0.12.0

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.12.0";
3
+
4
+ export {
5
+ PACKAGE_VERSION
6
+ };
7
+ //# sourceMappingURL=chunk-YA364G53.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/version.ts"],"sourcesContent":["export const PACKAGE_VERSION = '0.12.0'\n"],"mappings":";AAAO,IAAM,kBAAkB;","names":[]}
@@ -34,7 +34,7 @@ import {
34
34
  registerSerpIntelligenceCaptureTools,
35
35
  sanitizeAttempts,
36
36
  sanitizeHarvestResult
37
- } from "./chunk-IRYBBEZJ.js";
37
+ } from "./chunk-HXNE5GLG.js";
38
38
  import {
39
39
  auditImages,
40
40
  buildLinkReport,
@@ -70,7 +70,7 @@ import {
70
70
  RawMapsOverviewSchema,
71
71
  RawMapsReviewStatsSchema
72
72
  } from "./chunk-XGIPATLV.js";
73
- import "./chunk-B7BAJU7K.js";
73
+ import "./chunk-YA364G53.js";
74
74
  import {
75
75
  completeExtractJob,
76
76
  countSuccessfulPages,
@@ -20399,6 +20399,54 @@ var DISABLED_NANGO_TOOLS = {
20399
20399
  "google-mail": /* @__PURE__ */ new Set(["list-filters"]),
20400
20400
  slack: /* @__PURE__ */ new Set(["search-files", "search-messages"])
20401
20401
  };
20402
+ var CONNECTION_SYNC_REQUIRED_TOOLS = {
20403
+ "google-mail": ["list-messages", "get-message"],
20404
+ "google-calendar": ["list-events", "get-event"],
20405
+ zoom: [
20406
+ "list-meetings",
20407
+ "get-meeting",
20408
+ "list-recordings",
20409
+ "get-recording",
20410
+ "get-meeting-transcript"
20411
+ ]
20412
+ };
20413
+ function connectionSyncPolicyIssues(selections) {
20414
+ const issues = [];
20415
+ for (const selection of selections) {
20416
+ const required = CONNECTION_SYNC_REQUIRED_TOOLS[selection.providerConfigKey];
20417
+ if (!required) {
20418
+ issues.push({ providerConfigKey: selection.providerConfigKey, code: "unsupported_provider" });
20419
+ continue;
20420
+ }
20421
+ const allowed = new Set(selection.allowedTools);
20422
+ const missingTools = required.filter((tool) => !allowed.has(tool));
20423
+ if (missingTools.length > 0) {
20424
+ issues.push({ providerConfigKey: selection.providerConfigKey, code: "missing_required_tools", missingTools });
20425
+ }
20426
+ const requiredSet = new Set(required);
20427
+ const unexpectedTools = [...allowed].filter((tool) => !requiredSet.has(tool));
20428
+ if (unexpectedTools.length > 0) {
20429
+ issues.push({ providerConfigKey: selection.providerConfigKey, code: "unexpected_tools", unexpectedTools });
20430
+ }
20431
+ }
20432
+ return issues;
20433
+ }
20434
+ function connectionSyncSelectionError(connections) {
20435
+ if (connections.length === 0) {
20436
+ return "Data sync requires at least one bound service connection with approved read-only tools.";
20437
+ }
20438
+ const issues = connectionSyncPolicyIssues(connections);
20439
+ const unsupported = [...new Set(issues.filter((issue) => issue.code === "unsupported_provider").map((issue) => issue.providerConfigKey))];
20440
+ if (unsupported.length > 0) {
20441
+ return `Data sync currently supports only ${Object.keys(CONNECTION_SYNC_REQUIRED_TOOLS).join(", ")}. Unsupported providerConfigKey: ${unsupported.join(", ")}.`;
20442
+ }
20443
+ const missing = issues.filter((issue) => issue.code === "missing_required_tools").map((issue) => `${issue.providerConfigKey}: ${(issue.missingTools ?? []).join(", ")}`);
20444
+ if (missing.length > 0) {
20445
+ return `Data sync is missing required approved read tools (${missing.join("; ")}).`;
20446
+ }
20447
+ const unexpected = issues.filter((issue) => issue.code === "unexpected_tools").map((issue) => `${issue.providerConfigKey}: ${(issue.unexpectedTools ?? []).join(", ")}`);
20448
+ return unexpected.length > 0 ? `Data sync permits only its exact read-only tool set; remove unexpected tools (${unexpected.join("; ")}).` : null;
20449
+ }
20402
20450
  var NangoControlError = class extends Error {
20403
20451
  status;
20404
20452
  constructor(message, status = 502) {
@@ -20534,6 +20582,15 @@ async function getNangoCatalog() {
20534
20582
  const safeDefaultAllowedTools = cleanTools(
20535
20583
  row.safeDefaultAllowedTools ?? row.safe_default_allowed_tools ?? row.defaultAllowedTools ?? row.default_allowed_tools ?? row.allowedTools ?? row.allowed_tools
20536
20584
  ).filter((tool) => !disabledTools?.has(tool));
20585
+ const platformSetupStatus = firstString(row, [
20586
+ "platformSetupStatus",
20587
+ "platform_setup_status",
20588
+ "setupStatus",
20589
+ "setup_status"
20590
+ ], 100);
20591
+ const appReviewStatus = row.appReviewLimited === true || row.app_review_limited === true ? "limited" : firstString(row, ["appReviewStatus", "app_review_status", "reviewStatus", "review_status"], 100);
20592
+ const appReviewNote = firstString(row, ["appReviewNote", "app_review_note", "reviewNote", "review_note"], 500);
20593
+ const connectionSyncRequiredTools = [...CONNECTION_SYNC_REQUIRED_TOOLS[providerConfigKey] ?? []];
20537
20594
  result.push({
20538
20595
  providerConfigKey,
20539
20596
  provider,
@@ -20543,7 +20600,12 @@ async function getNangoCatalog() {
20543
20600
  docsUrl,
20544
20601
  authMode,
20545
20602
  categories,
20546
- safeDefaultAllowedTools
20603
+ safeDefaultAllowedTools,
20604
+ connectionSyncSupported: connectionSyncRequiredTools.length > 0,
20605
+ connectionSyncRequiredTools,
20606
+ platformSetupStatus,
20607
+ appReviewStatus,
20608
+ appReviewNote
20547
20609
  });
20548
20610
  }
20549
20611
  return result;
@@ -20571,6 +20633,7 @@ async function getNangoConnections(identity) {
20571
20633
  reconnectRequired,
20572
20634
  actionsEnabled: row.actionsEnabled === true || row.actions_enabled === true,
20573
20635
  readTools: cleanTools(row.readTools ?? row.read_tools),
20636
+ actionTools: cleanTools(row.actionTools ?? row.action_tools ?? row.writeTools ?? row.write_tools),
20574
20637
  vaultName: firstString(row, ["vaultName", "vault_name"], 100),
20575
20638
  tableName: firstString(row, ["tableName", "table_name"], 100),
20576
20639
  createdAt: firstString(row, ["createdAt", "created_at"], 100),
@@ -20687,10 +20750,10 @@ async function setScheduleConnectionActionsEnabled(identity, connectionId, enabl
20687
20750
  if (!isRecord(data) || !isRecord(data.connection)) return enabled;
20688
20751
  return data.connection.actionsEnabled === true;
20689
20752
  }
20690
- async function callScheduleConnectionAction(identity, connectionId, input) {
20753
+ async function callScheduleConnectionAction(identity, connectionId, input, tool) {
20691
20754
  const body = await controlRequest("/api/internal/nango/connections/actions/call", {
20692
20755
  method: "POST",
20693
- body: JSON.stringify({ identity, connectionId, input })
20756
+ body: JSON.stringify({ identity, connectionId, ...tool ? { tool } : {}, input })
20694
20757
  });
20695
20758
  const data = unwrapData(body);
20696
20759
  return isRecord(data) ? data.result ?? data : data;
@@ -21476,6 +21539,26 @@ app.post("/schedule-connections/actions/read", auth2, async (c) => {
21476
21539
  return scheduleConnectionError(c, err, "Unable to read from this connection.");
21477
21540
  }
21478
21541
  });
21542
+ app.post("/schedule-connections/actions/call", auth2, async (c) => {
21543
+ const user = c.get("user");
21544
+ const body = await c.req.json().catch(() => ({}));
21545
+ const connectionId = providerConfigKeyFrom(body.connectionId);
21546
+ const tool = providerConfigKeyFrom(body.tool);
21547
+ if (!connectionId || !tool || !body.args || typeof body.args !== "object" || Array.isArray(body.args)) {
21548
+ return c.json({ ok: false, error: "connectionId, tool, and an args object are required." }, 400);
21549
+ }
21550
+ try {
21551
+ const result = await callScheduleConnectionAction(
21552
+ user.email,
21553
+ connectionId,
21554
+ body.args,
21555
+ tool
21556
+ );
21557
+ return c.json({ ok: true, result });
21558
+ } catch (err) {
21559
+ return scheduleConnectionError(c, err, "Unable to run this connection action.");
21560
+ }
21561
+ });
21479
21562
  app.post("/schedule-link", auth2, async (c) => {
21480
21563
  try {
21481
21564
  const user = c.get("user");
@@ -21498,9 +21581,10 @@ app.get("/schedule-actions", auth2, async (c) => {
21498
21581
  try {
21499
21582
  const actions = await Promise.all(r.actions.map(async (action) => {
21500
21583
  const id = typeof action.id === "string" ? action.id : "";
21501
- if (!id) return { ...action, connections: [] };
21584
+ const executionMode = action.executionMode === "connection_sync" ? "connection_sync" : "agent";
21585
+ if (!id) return { ...action, executionMode, connections: [] };
21502
21586
  const bindings = await getScheduleConnectionBindings(user.email, id);
21503
- return { ...action, connections: bindingsForSchedule(bindings, id) };
21587
+ return { ...action, executionMode, connections: bindingsForSchedule(bindings, id) };
21504
21588
  }));
21505
21589
  return c.json({
21506
21590
  ...r,
@@ -21510,7 +21594,7 @@ app.get("/schedule-actions", auth2, async (c) => {
21510
21594
  console.warn("[schedule-actions] connection bindings unavailable:", err instanceof Error ? err.message : String(err));
21511
21595
  return c.json({
21512
21596
  ...r,
21513
- actions: r.actions.map((action) => ({ ...action, connections: [] })),
21597
+ actions: r.actions.map((action) => ({ ...action, executionMode: action.executionMode === "connection_sync" ? "connection_sync" : "agent", connections: [] })),
21514
21598
  connectionBindingsUnavailable: true
21515
21599
  });
21516
21600
  }
@@ -21520,6 +21604,10 @@ app.post("/schedule-actions", auth2, async (c) => {
21520
21604
  const { key, error } = await getOrCreateUserMemoryKey(user);
21521
21605
  if (!key) return c.json({ ok: false, error: error ?? "memory unavailable" }, 503);
21522
21606
  const body = await c.req.json().catch(() => ({}));
21607
+ const executionMode = body.executionMode ?? "agent";
21608
+ if (executionMode !== "agent" && executionMode !== "connection_sync") {
21609
+ return c.json({ ok: false, error: 'executionMode must be "agent" or "connection_sync".' }, 400);
21610
+ }
21523
21611
  const hasConnections = Object.prototype.hasOwnProperty.call(body, "connections");
21524
21612
  let connections;
21525
21613
  try {
@@ -21527,18 +21615,23 @@ app.post("/schedule-actions", auth2, async (c) => {
21527
21615
  } catch (err) {
21528
21616
  return scheduleConnectionError(c, err, "Invalid service connections.");
21529
21617
  }
21530
- const actionBody = { ...body };
21618
+ if (executionMode === "connection_sync") {
21619
+ const policyError = connectionSyncSelectionError(connections);
21620
+ if (policyError) return c.json({ ok: false, error: policyError }, 400);
21621
+ }
21622
+ const actionBody = { ...body, executionMode };
21531
21623
  delete actionBody.connections;
21532
21624
  const r = await memoryCall("createScheduledActionTool", actionBody, key);
21533
- if (!r.ok || !hasConnections) return c.json(r);
21534
- if (connections.length === 0) return c.json({ ...r, connections: [] });
21625
+ const createResponse = { ...r, executionMode };
21626
+ if (!r.ok || !hasConnections) return c.json(createResponse);
21627
+ if (connections.length === 0) return c.json({ ...createResponse, connections: [] });
21535
21628
  if (!r.id) {
21536
21629
  console.error("[schedule-actions] create returned no id while service connections were requested");
21537
21630
  return c.json({ ok: false, error: "The scheduled action was created without a usable id; service connections were not attached." }, 502);
21538
21631
  }
21539
21632
  try {
21540
21633
  const bound = await putScheduleConnectionBindings(user.email, r.id, connections);
21541
- return c.json({ ...r, connections: bound });
21634
+ return c.json({ ...createResponse, connections: bound });
21542
21635
  } catch (err) {
21543
21636
  const rollback = await memoryCall("deleteScheduledActionTool", { id: r.id }, key).catch(() => ({ ok: false }));
21544
21637
  if (!rollback.ok) console.error("[schedule-actions] failed to compensate action after connection binding failure", r.id);
@@ -21576,6 +21669,16 @@ app.put("/schedule-actions/:id/connections", auth2, async (c) => {
21576
21669
  }
21577
21670
  try {
21578
21671
  const scheduleActionId = c.req.param("id");
21672
+ const { key, error } = await getOrCreateUserMemoryKey(user);
21673
+ if (!key) return c.json({ ok: false, error: error ?? "memory unavailable" }, 503);
21674
+ const schedules = await memoryCall("listScheduledActionsTool", {}, key);
21675
+ if (!schedules.ok || !Array.isArray(schedules.actions)) return c.json(schedules, 502);
21676
+ const schedule = schedules.actions.find((action) => action.id === scheduleActionId);
21677
+ if (!schedule) return c.json({ ok: false, error: "scheduled action not found" }, 404);
21678
+ if (schedule.executionMode === "connection_sync") {
21679
+ const policyError = connectionSyncSelectionError(connections);
21680
+ if (policyError) return c.json({ ok: false, error: policyError }, 400);
21681
+ }
21579
21682
  const bindings = await putScheduleConnectionBindings(user.email, scheduleActionId, connections);
21580
21683
  return c.json({ ok: true, connections: bindings });
21581
21684
  } catch (err) {
@@ -22662,4 +22765,4 @@ app.get("/blog/:slug/", (c) => {
22662
22765
  export {
22663
22766
  app
22664
22767
  };
22665
- //# sourceMappingURL=server-KTA7CFX6.js.map
22768
+ //# sourceMappingURL=server-TFWBW24U.js.map