mcp-scraper 0.26.1 → 0.26.3
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/README.md +3 -1
- package/dist/bin/api-server.cjs +56 -6
- package/dist/bin/api-server.cjs.map +1 -1
- package/dist/bin/api-server.js +1 -1
- package/dist/bin/mcp-scraper-cli.cjs +1 -1
- package/dist/bin/mcp-scraper-cli.cjs.map +1 -1
- package/dist/bin/mcp-scraper-cli.js +1 -1
- package/dist/bin/mcp-scraper-install.cjs +1 -1
- package/dist/bin/mcp-scraper-install.cjs.map +1 -1
- package/dist/bin/mcp-scraper-install.js +1 -1
- package/dist/bin/mcp-stdio-server.cjs +40 -19
- package/dist/bin/mcp-stdio-server.cjs.map +1 -1
- package/dist/bin/mcp-stdio-server.js +63 -4
- package/dist/bin/mcp-stdio-server.js.map +1 -1
- package/dist/chunk-27VXTOD2.js +7 -0
- package/dist/chunk-27VXTOD2.js.map +1 -0
- package/dist/{chunk-YMEPX46N.js → chunk-73YM3DEB.js} +4 -40
- package/dist/chunk-73YM3DEB.js.map +1 -0
- package/dist/{server-UHDJ5TH5.js → server-GN34MGAE.js} +94 -9
- package/dist/server-GN34MGAE.js.map +1 -0
- package/docs/mcp-tool-manifest.generated.json +2 -2
- package/package.json +1 -1
- package/dist/chunk-FQQC5OZJ.js +0 -7
- package/dist/chunk-FQQC5OZJ.js.map +0 -1
- package/dist/chunk-YMEPX46N.js.map +0 -1
- package/dist/server-UHDJ5TH5.js.map +0 -1
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
} from "./chunk-E5J4HJBO.js";
|
|
18
18
|
import {
|
|
19
19
|
HttpMcpToolExecutor,
|
|
20
|
-
MemoryMcpToolExecutor,
|
|
21
20
|
assessTranscriptSignal,
|
|
22
21
|
buildLinkGraph,
|
|
23
22
|
buildPaaExtractorMcpServer,
|
|
@@ -35,7 +34,7 @@ import {
|
|
|
35
34
|
sanitizeAttempts,
|
|
36
35
|
sanitizeHarvestResult,
|
|
37
36
|
transcribeMediaUrl
|
|
38
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-73YM3DEB.js";
|
|
39
38
|
import {
|
|
40
39
|
auditImages,
|
|
41
40
|
buildLinkReport,
|
|
@@ -76,7 +75,7 @@ import {
|
|
|
76
75
|
RawMapsOverviewSchema,
|
|
77
76
|
RawMapsReviewStatsSchema
|
|
78
77
|
} from "./chunk-XGIPATLV.js";
|
|
79
|
-
import "./chunk-
|
|
78
|
+
import "./chunk-27VXTOD2.js";
|
|
80
79
|
import {
|
|
81
80
|
completeExtractJob,
|
|
82
81
|
countSuccessfulPages,
|
|
@@ -16515,6 +16514,42 @@ serpIntelligenceApp.post("/page-snapshots", async (c) => {
|
|
|
16515
16514
|
import { Hono as Hono17 } from "hono";
|
|
16516
16515
|
import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
|
|
16517
16516
|
|
|
16517
|
+
// src/mcp/memory-mcp-tool-executor.ts
|
|
16518
|
+
var MemoryMcpToolExecutor = class {
|
|
16519
|
+
baseUrl;
|
|
16520
|
+
apiKey;
|
|
16521
|
+
constructor(baseUrl, apiKey) {
|
|
16522
|
+
this.baseUrl = baseUrl.replace(/\/$/, "");
|
|
16523
|
+
this.apiKey = apiKey;
|
|
16524
|
+
}
|
|
16525
|
+
async callMemoryTool(toolName, args) {
|
|
16526
|
+
try {
|
|
16527
|
+
const res = await fetch(`${this.baseUrl}/memory/mcp-call`, {
|
|
16528
|
+
method: "POST",
|
|
16529
|
+
headers: {
|
|
16530
|
+
"content-type": "application/json",
|
|
16531
|
+
"x-api-key": this.apiKey
|
|
16532
|
+
},
|
|
16533
|
+
body: JSON.stringify({ toolName, args })
|
|
16534
|
+
});
|
|
16535
|
+
const data = await res.json().catch(() => null);
|
|
16536
|
+
if (!res.ok) {
|
|
16537
|
+
const message = data?.error ?? `memory ${toolName} failed (HTTP ${res.status})`;
|
|
16538
|
+
return { content: [{ type: "text", text: message }], isError: true };
|
|
16539
|
+
}
|
|
16540
|
+
const result = data ?? { ok: false, error: `memory ${toolName} returned no result` };
|
|
16541
|
+
return {
|
|
16542
|
+
content: [{ type: "text", text: JSON.stringify(result) }],
|
|
16543
|
+
structuredContent: result,
|
|
16544
|
+
isError: false
|
|
16545
|
+
};
|
|
16546
|
+
} catch (err) {
|
|
16547
|
+
const message = err instanceof Error ? err.message : `memory ${toolName} call failed`;
|
|
16548
|
+
return { content: [{ type: "text", text: message }], isError: true };
|
|
16549
|
+
}
|
|
16550
|
+
}
|
|
16551
|
+
};
|
|
16552
|
+
|
|
16518
16553
|
// src/mcp/memory-inprocess-executor.ts
|
|
16519
16554
|
var CUTOVER = /* @__PURE__ */ new Map();
|
|
16520
16555
|
function registerCutover(upstreamName, handler) {
|
|
@@ -22499,6 +22534,42 @@ var MainNangoTransportError = class extends Error {
|
|
|
22499
22534
|
this.retryable = retryable;
|
|
22500
22535
|
}
|
|
22501
22536
|
};
|
|
22537
|
+
function nangoClientErrorText(error) {
|
|
22538
|
+
if (error instanceof Error) return error.message;
|
|
22539
|
+
if (typeof error === "string") return error;
|
|
22540
|
+
try {
|
|
22541
|
+
return JSON.stringify(error);
|
|
22542
|
+
} catch {
|
|
22543
|
+
return "";
|
|
22544
|
+
}
|
|
22545
|
+
}
|
|
22546
|
+
function normalizeNangoClientError(error) {
|
|
22547
|
+
if (error instanceof MainNangoTransportError) return error;
|
|
22548
|
+
const detail = nangoClientErrorText(error);
|
|
22549
|
+
if (/SERVICE_DISABLED|accessNotConfigured/i.test(detail)) {
|
|
22550
|
+
return new MainNangoTransportError(
|
|
22551
|
+
"The provider API required by this connection is disabled. Enable it in the provider project, wait for propagation, then retry.",
|
|
22552
|
+
409,
|
|
22553
|
+
"provider_api_disabled",
|
|
22554
|
+
false
|
|
22555
|
+
);
|
|
22556
|
+
}
|
|
22557
|
+
if (/PERMISSION_DENIED|insufficientPermissions|insufficient permission/i.test(detail)) {
|
|
22558
|
+
return new MainNangoTransportError(
|
|
22559
|
+
"The connected account does not have permission to run this provider operation.",
|
|
22560
|
+
403,
|
|
22561
|
+
"missing_provider_permission",
|
|
22562
|
+
false
|
|
22563
|
+
);
|
|
22564
|
+
}
|
|
22565
|
+
if (/RESOURCE_EXHAUSTED|rate.?limit|status["']?\s*:\s*429/i.test(detail)) {
|
|
22566
|
+
return new MainNangoTransportError("The connected provider is temporarily rate limited.", 429, "upstream_rate_limited", true);
|
|
22567
|
+
}
|
|
22568
|
+
if (/UNAUTHENTICATED|invalid_grant|status["']?\s*:\s*401/i.test(detail)) {
|
|
22569
|
+
return new MainNangoTransportError("The service connection requires reconnection.", 409, "connection_inactive", false);
|
|
22570
|
+
}
|
|
22571
|
+
return new MainNangoTransportError("The service connection is temporarily unavailable.", 503, "connection_transport_unavailable");
|
|
22572
|
+
}
|
|
22502
22573
|
function asRecord(value) {
|
|
22503
22574
|
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
22504
22575
|
}
|
|
@@ -22730,19 +22801,31 @@ async function withNangoClient(connection, run) {
|
|
|
22730
22801
|
});
|
|
22731
22802
|
return value;
|
|
22732
22803
|
} catch (error) {
|
|
22804
|
+
const normalized = normalizeNangoClientError(error);
|
|
22733
22805
|
await recordServiceConnectionHealth({
|
|
22734
22806
|
connectionId: connection.id,
|
|
22735
|
-
operationalStatus: "unavailable",
|
|
22736
|
-
failureCode:
|
|
22737
|
-
retryable:
|
|
22807
|
+
operationalStatus: normalized.code === "connection_transport_unavailable" ? "unavailable" : "degraded",
|
|
22808
|
+
failureCode: normalized.code,
|
|
22809
|
+
retryable: normalized.retryable,
|
|
22738
22810
|
evidenceSource: "nango_mcp"
|
|
22739
22811
|
}).catch(() => void 0);
|
|
22740
|
-
|
|
22741
|
-
throw new MainNangoTransportError("The service connection is temporarily unavailable.", 503, "connection_transport_unavailable");
|
|
22812
|
+
throw normalized;
|
|
22742
22813
|
} finally {
|
|
22743
22814
|
await client2.close().catch(() => void 0);
|
|
22744
22815
|
}
|
|
22745
22816
|
}
|
|
22817
|
+
async function probeNangoConnectionDirect(identity, connectionId) {
|
|
22818
|
+
const connection = await requireOwnedActiveConnection(identity, connectionId);
|
|
22819
|
+
const providerKey = connection.provider ?? connection.providerConfigKey;
|
|
22820
|
+
if (providerKey !== "google-search-console") return;
|
|
22821
|
+
await withNangoClient(connection, async (client2) => {
|
|
22822
|
+
const listed = await client2.listTools();
|
|
22823
|
+
if (!listed.tools.some((tool) => tool.name === "list-sites")) {
|
|
22824
|
+
throw new MainNangoTransportError("The Search Console health-check tool is unavailable.", 404, "live_tool_missing", false);
|
|
22825
|
+
}
|
|
22826
|
+
await client2.callTool({ name: "list-sites", arguments: {} });
|
|
22827
|
+
});
|
|
22828
|
+
}
|
|
22746
22829
|
async function listNangoToolsDirect(identity, connectionId) {
|
|
22747
22830
|
const connection = await requireOwnedActiveConnection(identity, connectionId);
|
|
22748
22831
|
const listed = await withNangoClient(connection, (client2) => client2.listTools());
|
|
@@ -23056,6 +23139,7 @@ var SAFE_CONTROL_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
|
23056
23139
|
"connection_transport_unavailable",
|
|
23057
23140
|
"connection_control_failed",
|
|
23058
23141
|
"missing_provider_permission",
|
|
23142
|
+
"provider_api_disabled",
|
|
23059
23143
|
"permission_verification_unavailable",
|
|
23060
23144
|
"meta_app_feature_not_enabled",
|
|
23061
23145
|
"insufficient_credits",
|
|
@@ -23649,6 +23733,7 @@ async function testNangoConnection(identity, connectionId) {
|
|
|
23649
23733
|
}
|
|
23650
23734
|
try {
|
|
23651
23735
|
const { tools } = await listNangoToolsDirect(identity, connectionId);
|
|
23736
|
+
await probeNangoConnectionDirect(identity, connectionId);
|
|
23652
23737
|
return { operationalStatus: "available", checkedAt: (/* @__PURE__ */ new Date()).toISOString(), toolCount: tools.length };
|
|
23653
23738
|
} catch (error) {
|
|
23654
23739
|
throw asNangoControlError(error);
|
|
@@ -27095,4 +27180,4 @@ app.get("/blog/:slug/", (c) => {
|
|
|
27095
27180
|
export {
|
|
27096
27181
|
app
|
|
27097
27182
|
};
|
|
27098
|
-
//# sourceMappingURL=server-
|
|
27183
|
+
//# sourceMappingURL=server-GN34MGAE.js.map
|