mcp-scraper 0.17.2 → 0.18.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.18.0";
3
+
4
+ export {
5
+ PACKAGE_VERSION
6
+ };
7
+ //# sourceMappingURL=chunk-RLWCHLV3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/version.ts"],"sourcesContent":["export const PACKAGE_VERSION = '0.18.0'\n"],"mappings":";AAAO,IAAM,kBAAkB;","names":[]}
@@ -37,7 +37,7 @@ import {
37
37
  renewConnectedDataArtifactDownload,
38
38
  sanitizeAttempts,
39
39
  sanitizeHarvestResult
40
- } from "./chunk-HJ3XIHWC.js";
40
+ } from "./chunk-FMEDPBIV.js";
41
41
  import {
42
42
  auditImages,
43
43
  buildLinkReport,
@@ -73,7 +73,7 @@ import {
73
73
  RawMapsOverviewSchema,
74
74
  RawMapsReviewStatsSchema
75
75
  } from "./chunk-XGIPATLV.js";
76
- import "./chunk-IDRSO4HX.js";
76
+ import "./chunk-RLWCHLV3.js";
77
77
  import {
78
78
  completeExtractJob,
79
79
  countSuccessfulPages,
@@ -20678,6 +20678,7 @@ var CONNECTED_DATA_DATASETS = [
20678
20678
  "calendar_events",
20679
20679
  "zoom_recordings",
20680
20680
  "zoom_transcripts",
20681
+ "meta_ads_insights",
20681
20682
  "resend_data",
20682
20683
  "resend_emails",
20683
20684
  "resend_received_emails",
@@ -21157,10 +21158,17 @@ var CONNECTION_SYNC_REQUIRED_TOOLS = {
21157
21158
  "list-ad-sets",
21158
21159
  "list-ads",
21159
21160
  "list-ad-creatives",
21160
- "get-insights",
21161
+ "get-insights"
21162
+ ]
21163
+ };
21164
+ var CONNECTION_SYNC_OPTIONAL_TOOLS = {
21165
+ "meta-marketing-api": [
21161
21166
  "list-catalogs",
21162
21167
  "list-datasets",
21163
- "list-custom-audiences"
21168
+ "list-custom-audiences",
21169
+ "list-ad-images",
21170
+ "list-ad-videos",
21171
+ "list-ad-rules"
21164
21172
  ]
21165
21173
  };
21166
21174
  function connectionSyncPolicyIssues(selections) {
@@ -21176,8 +21184,11 @@ function connectionSyncPolicyIssues(selections) {
21176
21184
  if (missingTools.length > 0) {
21177
21185
  issues.push({ providerConfigKey: selection.providerConfigKey, code: "missing_required_tools", missingTools });
21178
21186
  }
21179
- const requiredSet = new Set(required);
21180
- const unexpectedTools = [...allowed].filter((tool) => !requiredSet.has(tool));
21187
+ const permittedSet = /* @__PURE__ */ new Set([
21188
+ ...required,
21189
+ ...CONNECTION_SYNC_OPTIONAL_TOOLS[selection.providerConfigKey] ?? []
21190
+ ]);
21191
+ const unexpectedTools = [...allowed].filter((tool) => !permittedSet.has(tool));
21181
21192
  if (unexpectedTools.length > 0) {
21182
21193
  issues.push({ providerConfigKey: selection.providerConfigKey, code: "unexpected_tools", unexpectedTools });
21183
21194
  }
@@ -21286,7 +21297,10 @@ var SAFE_CONTROL_ERROR_CODES = /* @__PURE__ */ new Set([
21286
21297
  "tool_discovery_failed",
21287
21298
  "live_tool_missing",
21288
21299
  "connection_transport_unavailable",
21289
- "connection_control_failed"
21300
+ "connection_control_failed",
21301
+ "missing_provider_permission",
21302
+ "permission_verification_unavailable",
21303
+ "meta_app_feature_not_enabled"
21290
21304
  ]);
21291
21305
  var CONTROL_ERROR_CODE_ALIASES = /* @__PURE__ */ new Map([
21292
21306
  ["connection_not_active", "connection_inactive"],
@@ -21405,6 +21419,24 @@ async function getNangoCatalog() {
21405
21419
  const actionTools = cleanTools(
21406
21420
  row.actionTools ?? row.action_tools ?? row.writeTools ?? row.write_tools
21407
21421
  ).filter((tool) => !disabledTools?.has(tool));
21422
+ const requiredPermissionsByTool = {};
21423
+ const rawRequiredPermissions = row.requiredPermissionsByTool ?? row.required_permissions_by_tool;
21424
+ if (isRecord2(rawRequiredPermissions)) {
21425
+ for (const [tool, permissions] of Object.entries(rawRequiredPermissions).slice(0, 500)) {
21426
+ const cleanTool = cleanString(tool, 200);
21427
+ if (!cleanTool || !safeDefaultAllowedTools.includes(cleanTool) && !actionTools.includes(cleanTool)) continue;
21428
+ requiredPermissionsByTool[cleanTool] = cleanStringArray(permissions, 32, 200);
21429
+ }
21430
+ }
21431
+ const requiredFeaturesByTool = {};
21432
+ const rawRequiredFeatures = row.requiredFeaturesByTool ?? row.required_features_by_tool;
21433
+ if (isRecord2(rawRequiredFeatures)) {
21434
+ for (const [tool, features] of Object.entries(rawRequiredFeatures).slice(0, 500)) {
21435
+ const cleanTool = cleanString(tool, 200);
21436
+ if (!cleanTool) continue;
21437
+ requiredFeaturesByTool[cleanTool] = cleanStringArray(features, 32, 200);
21438
+ }
21439
+ }
21408
21440
  const platformSetupStatus = firstString(row, [
21409
21441
  "platformSetupStatus",
21410
21442
  "platform_setup_status",
@@ -21414,6 +21446,7 @@ async function getNangoCatalog() {
21414
21446
  const appReviewStatus = row.appReviewLimited === true || row.app_review_limited === true ? "limited" : firstString(row, ["appReviewStatus", "app_review_status", "reviewStatus", "review_status"], 100);
21415
21447
  const appReviewNote = firstString(row, ["appReviewNote", "app_review_note", "reviewNote", "review_note"], 500);
21416
21448
  const connectionSyncRequiredTools = [...CONNECTION_SYNC_REQUIRED_TOOLS[providerConfigKey] ?? []];
21449
+ const connectionSyncOptionalTools = [...CONNECTION_SYNC_OPTIONAL_TOOLS[providerConfigKey] ?? []];
21417
21450
  result.push({
21418
21451
  providerConfigKey,
21419
21452
  provider,
@@ -21425,8 +21458,12 @@ async function getNangoCatalog() {
21425
21458
  categories,
21426
21459
  safeDefaultAllowedTools,
21427
21460
  actionTools,
21461
+ requiredPermissionsByTool,
21462
+ requiredFeaturesByTool,
21463
+ enabledFeatures: cleanStringArray(row.enabledFeatures ?? row.enabled_features, 32, 200),
21428
21464
  connectionSyncSupported: connectionSyncRequiredTools.length > 0,
21429
21465
  connectionSyncRequiredTools,
21466
+ connectionSyncOptionalTools,
21430
21467
  platformSetupStatus,
21431
21468
  appReviewStatus,
21432
21469
  appReviewNote
@@ -21448,6 +21485,30 @@ async function getNangoConnections(identity) {
21448
21485
  const label = firstString(row, ["label", "accountLabel", "account_label", "displayName", "display_name", "endUserEmail", "end_user_email"]) || providerConfigKey;
21449
21486
  const rawStatus = firstString(row, ["status"], 64) || "connected";
21450
21487
  const reconnectRequired = row.reconnectRequired === true || row.reconnect_required === true || rawStatus === "needs_reauth" || rawStatus === "reauth_required" || rawStatus === "invalid" || rawStatus === "error" || rawStatus === "revoked" || rawStatus === "disabled";
21488
+ const toolCapabilities = [];
21489
+ const rawToolCapabilities = row.toolCapabilities ?? row.tool_capabilities;
21490
+ if (Array.isArray(rawToolCapabilities)) {
21491
+ for (const value of rawToolCapabilities.slice(0, 500)) {
21492
+ if (!isRecord2(value)) continue;
21493
+ const name = cleanString(value.name, 200);
21494
+ const classification = value.classification;
21495
+ const blockedValue = Object.prototype.hasOwnProperty.call(value, "blockedReason") ? value.blockedReason : value.blocked_reason;
21496
+ const blockedReason = blockedValue === null ? null : blockedValue === "missing_permission" || blockedValue === "permission_policy_missing" || blockedValue === "permission_verification_unavailable" || blockedValue === "missing_app_feature" ? blockedValue : void 0;
21497
+ if (!name || classification !== "read" && classification !== "action" || typeof value.available !== "boolean" || blockedReason === void 0) continue;
21498
+ toolCapabilities.push({
21499
+ name,
21500
+ classification,
21501
+ requiredPermissions: cleanStringArray(value.requiredPermissions ?? value.required_permissions, 32, 200),
21502
+ requiredFeatures: cleanStringArray(value.requiredFeatures ?? value.required_features, 32, 200),
21503
+ available: value.available,
21504
+ blockedReason,
21505
+ missingPermissions: cleanStringArray(value.missingPermissions ?? value.missing_permissions, 32, 200),
21506
+ missingFeatures: cleanStringArray(value.missingFeatures ?? value.missing_features, 32, 200)
21507
+ });
21508
+ }
21509
+ }
21510
+ const permissionVerificationValue = row.permissionVerification ?? row.permission_verification;
21511
+ const permissionVerification = permissionVerificationValue === "verified" || permissionVerificationValue === "unavailable" ? permissionVerificationValue : null;
21451
21512
  result.push({
21452
21513
  connectionId,
21453
21514
  providerConfigKey,
@@ -21458,6 +21519,10 @@ async function getNangoConnections(identity) {
21458
21519
  actionsEnabled: row.actionsEnabled === true || row.actions_enabled === true,
21459
21520
  readTools: cleanTools(row.readTools ?? row.read_tools),
21460
21521
  actionTools: cleanTools(row.actionTools ?? row.action_tools ?? row.writeTools ?? row.write_tools),
21522
+ toolCapabilities,
21523
+ grantedPermissions: cleanStringArray(row.grantedPermissions ?? row.granted_permissions, 64, 200),
21524
+ enabledFeatures: cleanStringArray(row.enabledFeatures ?? row.enabled_features, 32, 200),
21525
+ permissionVerification,
21461
21526
  mcpEndpoint: null,
21462
21527
  schemaDiscovery: "compatibility_describe",
21463
21528
  toolRevision: firstString(row, ["toolRevision", "tool_revision"], 200),
@@ -21685,7 +21750,7 @@ async function describeNangoTool(identity, connectionId, tool, fresh) {
21685
21750
  const outputSchemaValue = rawTool.outputSchema ?? rawTool.output_schema;
21686
21751
  const outputSchema = outputSchemaValue === void 0 ? void 0 : sanitizeToolSchema(outputSchemaValue);
21687
21752
  const blockedReasonValue = rawTool.blockedReason ?? rawTool.blocked_reason;
21688
- const blockedReason = blockedReasonValue === null || blockedReasonValue === void 0 ? null : blockedReasonValue === "actions_disabled" || blockedReasonValue === "inactive_connection" ? blockedReasonValue : void 0;
21753
+ const blockedReason = blockedReasonValue === null || blockedReasonValue === void 0 ? null : blockedReasonValue === "actions_disabled" || blockedReasonValue === "inactive_connection" || blockedReasonValue === "missing_permission" || blockedReasonValue === "missing_app_feature" || blockedReasonValue === "permission_policy_missing" || blockedReasonValue === "permission_verification_unavailable" ? blockedReasonValue : void 0;
21689
21754
  if (serializedBytes > 256 * 1024 || !name || name !== tool || classification !== "read" && classification !== "action" || typeof rawTool.callable !== "boolean" || blockedReason === void 0 || transport !== "nango" && transport !== "remote_mcp" || !providerConfigKey || schemaSource !== "live_tools_list" || !upstreamSchemaHash || !/^[a-f0-9]{64}$/i.test(upstreamSchemaHash) || !fetchedAt || Number.isNaN(Date.parse(fetchedAt)) || !inputSchema || outputSchemaValue !== void 0 && !outputSchema) {
21690
21755
  throw new NangoControlError(
21691
21756
  "The connection service returned an invalid live tool description.",
@@ -21702,6 +21767,10 @@ async function describeNangoTool(identity, connectionId, tool, fresh) {
21702
21767
  const annotations = sanitizeToolAnnotations(rawTool.annotations);
21703
21768
  const icons = sanitizeToolIcons(rawTool.icons);
21704
21769
  const execution = taskSupport ? { taskSupport } : void 0;
21770
+ const requiredPermissions = cleanStringArray(rawTool.requiredPermissions ?? rawTool.required_permissions, 32, 200);
21771
+ const missingPermissions = cleanStringArray(rawTool.missingPermissions ?? rawTool.missing_permissions, 32, 200);
21772
+ const requiredFeatures = cleanStringArray(rawTool.requiredFeatures ?? rawTool.required_features, 32, 200);
21773
+ const missingFeatures = cleanStringArray(rawTool.missingFeatures ?? rawTool.missing_features, 32, 200);
21705
21774
  const schemaHash = projectedToolSchemaHash({
21706
21775
  name,
21707
21776
  inputSchema,
@@ -21719,6 +21788,10 @@ async function describeNangoTool(identity, connectionId, tool, fresh) {
21719
21788
  classification,
21720
21789
  callable: rawTool.callable,
21721
21790
  blockedReason,
21791
+ requiredPermissions,
21792
+ missingPermissions,
21793
+ requiredFeatures,
21794
+ missingFeatures,
21722
21795
  transport,
21723
21796
  providerConfigKey,
21724
21797
  protocolVersion,
@@ -22768,7 +22841,34 @@ async function combinedConnections(identity) {
22768
22841
  if (nango.status === "rejected" && resend.status === "rejected") throw nango.reason;
22769
22842
  return [
22770
22843
  ...nango.status === "fulfilled" ? nango.value.map((connection) => ({ ...connection, transport: "nango", adminBlockedTools: [] })) : [],
22771
- ...resend.status === "fulfilled" ? resend.value : []
22844
+ ...resend.status === "fulfilled" ? resend.value.map((connection) => ({
22845
+ ...connection,
22846
+ toolCapabilities: [
22847
+ ...connection.readTools.map((name) => ({
22848
+ name,
22849
+ classification: "read",
22850
+ requiredPermissions: [],
22851
+ requiredFeatures: [],
22852
+ available: true,
22853
+ blockedReason: null,
22854
+ missingPermissions: [],
22855
+ missingFeatures: []
22856
+ })),
22857
+ ...connection.actionTools.map((name) => ({
22858
+ name,
22859
+ classification: "action",
22860
+ requiredPermissions: [],
22861
+ requiredFeatures: [],
22862
+ available: true,
22863
+ blockedReason: null,
22864
+ missingPermissions: [],
22865
+ missingFeatures: []
22866
+ }))
22867
+ ],
22868
+ grantedPermissions: [],
22869
+ enabledFeatures: [],
22870
+ permissionVerification: null
22871
+ })) : []
22772
22872
  ];
22773
22873
  }
22774
22874
  async function isResendConnection(identity, connectionId, providerHint) {
@@ -24361,4 +24461,4 @@ app.get("/blog/:slug/", (c) => {
24361
24461
  export {
24362
24462
  app
24363
24463
  };
24364
- //# sourceMappingURL=server-U5VODSSW.js.map
24464
+ //# sourceMappingURL=server-MQDCAR6I.js.map