mcp-scraper 0.48.0 → 0.50.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.
- package/README.md +2 -2
- package/dist/{analytics-repository-WWXVU3VW.js → analytics-repository-IKE53S3E.js} +10 -2
- package/dist/bin/api-server.cjs +1214 -328
- package/dist/bin/api-server.cjs.map +1 -1
- package/dist/bin/api-server.js +4 -4
- 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 +3 -3
- package/dist/bin/mcp-scraper-install.cjs.map +1 -1
- package/dist/bin/mcp-scraper-install.js +2 -2
- package/dist/bin/mcp-stdio-server.cjs +75 -8
- package/dist/bin/mcp-stdio-server.cjs.map +1 -1
- package/dist/bin/mcp-stdio-server.js +5 -5
- package/dist/bin/paa-harvest.cjs.map +1 -1
- package/dist/bin/paa-harvest.js +3 -3
- package/dist/{chunk-MFNGUM4L.js → chunk-2XTYLJQK.js} +15 -1
- package/dist/chunk-2XTYLJQK.js.map +1 -0
- package/dist/{chunk-PTABZABJ.js → chunk-44LNKZTE.js} +76 -8
- package/dist/chunk-44LNKZTE.js.map +1 -0
- package/dist/{chunk-YW2LXLDU.js → chunk-5BEPOFKG.js} +160 -15
- package/dist/chunk-5BEPOFKG.js.map +1 -0
- package/dist/chunk-C7NN57WH.js +7 -0
- package/dist/chunk-C7NN57WH.js.map +1 -0
- package/dist/{chunk-MFE6RMIA.js → chunk-GOZIG6HD.js} +2 -2
- package/dist/{chunk-R66PJOZW.js → chunk-NNZXZTJ2.js} +2 -2
- package/dist/{chunk-QAH7WMYC.js → chunk-QH63IZTX.js} +3 -3
- package/dist/chunk-QH63IZTX.js.map +1 -0
- package/dist/{chunk-6DPIE262.js → chunk-QHVFKFME.js} +2 -2
- package/dist/{chunk-PODASLGT.js → chunk-QXAY44SA.js} +2 -2
- package/dist/{chunk-ZEMHL36J.js → chunk-YMSZO62N.js} +2 -2
- package/dist/{db-A4YUPV4Z.js → db-UPSS5BGM.js} +2 -2
- package/dist/{extract-bundle-2HONVC5T.js → extract-bundle-RCTNANCH.js} +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/{location-data-repository-YWFJGNIP.js → location-data-repository-UUSHH5M2.js} +3 -3
- package/dist/{server-EVTCL3KB.js → server-3ND2EXYO.js} +882 -242
- package/dist/server-3ND2EXYO.js.map +1 -0
- package/dist/{site-extract-repository-STNOI5OH.js → site-extract-repository-3VQAALNR.js} +3 -3
- package/dist/{worker-4MHZS3OB.js → worker-KQN673JF.js} +5 -5
- package/package.json +1 -1
- package/dist/chunk-IAXQIHNS.js +0 -7
- package/dist/chunk-IAXQIHNS.js.map +0 -1
- package/dist/chunk-MFNGUM4L.js.map +0 -1
- package/dist/chunk-PTABZABJ.js.map +0 -1
- package/dist/chunk-QAH7WMYC.js.map +0 -1
- package/dist/chunk-YW2LXLDU.js.map +0 -1
- package/dist/server-EVTCL3KB.js.map +0 -1
- /package/dist/{analytics-repository-WWXVU3VW.js.map → analytics-repository-IKE53S3E.js.map} +0 -0
- /package/dist/{chunk-MFE6RMIA.js.map → chunk-GOZIG6HD.js.map} +0 -0
- /package/dist/{chunk-R66PJOZW.js.map → chunk-NNZXZTJ2.js.map} +0 -0
- /package/dist/{chunk-6DPIE262.js.map → chunk-QHVFKFME.js.map} +0 -0
- /package/dist/{chunk-PODASLGT.js.map → chunk-QXAY44SA.js.map} +0 -0
- /package/dist/{chunk-ZEMHL36J.js.map → chunk-YMSZO62N.js.map} +0 -0
- /package/dist/{db-A4YUPV4Z.js.map → db-UPSS5BGM.js.map} +0 -0
- /package/dist/{extract-bundle-2HONVC5T.js.map → extract-bundle-RCTNANCH.js.map} +0 -0
- /package/dist/{location-data-repository-YWFJGNIP.js.map → location-data-repository-UUSHH5M2.js.map} +0 -0
- /package/dist/{site-extract-repository-STNOI5OH.js.map → site-extract-repository-3VQAALNR.js.map} +0 -0
- /package/dist/{worker-4MHZS3OB.js.map → worker-KQN673JF.js.map} +0 -0
|
@@ -18,10 +18,10 @@ import {
|
|
|
18
18
|
browserServiceProfileSaveChanges,
|
|
19
19
|
recordVendorUsage,
|
|
20
20
|
vendorCostUsd
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-QXAY44SA.js";
|
|
22
22
|
import {
|
|
23
23
|
PACKAGE_VERSION
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-C7NN57WH.js";
|
|
25
25
|
import {
|
|
26
26
|
MC_PER_CREDIT
|
|
27
27
|
} from "./chunk-SOEYDWJU.js";
|
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
|
|
34
34
|
// src/harvest-timeout.ts
|
|
35
35
|
var VERCEL_FUNCTION_MAX_MS = 3e5;
|
|
36
|
+
var DEFAULT_TOOL_CLIENT_TIMEOUT_MS = 3e5;
|
|
36
37
|
var CLIENT_OVER_SERVER_MARGIN_MS = 15e3;
|
|
37
38
|
function harvestTimeoutBudget(maxQuestions, serpOnly = false) {
|
|
38
39
|
const requested = Number.isFinite(maxQuestions) && maxQuestions > 0 ? Math.trunc(maxQuestions) : 30;
|
|
@@ -360,6 +361,8 @@ seam is noted so you can chain them.
|
|
|
360
361
|
JSON-LD, media, citations, source metadata, related entities, trails, and saved account filters.
|
|
361
362
|
- Read one published entity -> **commons_get_entity**. It returns the Wikidata-style backend fields,
|
|
362
363
|
JSON-LD, source provenance, media, ledger, and the Wikipedia-style page projection.
|
|
364
|
+
- Read its machine-verifiable governed relationships -> **commons_get_entity_linkset**. It returns the
|
|
365
|
+
RFC 9264 linkset projection; do not infer claim status from loose See Also labels.
|
|
363
366
|
- List unresolved See Also concepts -> **commons_list_needs_links**. Use it to find concepts that appear
|
|
364
367
|
in public See Also sections but do not yet have a Commons entity ID or /wiki/ slug.
|
|
365
368
|
- Plan a new or edited entity -> **commons_prepare_entity**. This is the Commons equivalent of
|
|
@@ -5329,6 +5332,9 @@ var CommonsGetEntityInputSchema = {
|
|
|
5329
5332
|
idOrSlug: z4.string().trim().min(1).max(180).describe("Transparent Public Wiki entity id such as TPW-Q... or a public /wiki/ slug."),
|
|
5330
5333
|
includeWikiPage: z4.boolean().default(true).describe("Include the Wikipedia-style page projection used by transparent-commons.cc/wiki/.")
|
|
5331
5334
|
};
|
|
5335
|
+
var CommonsGetEntityLinksetInputSchema = {
|
|
5336
|
+
idOrSlug: z4.string().trim().min(1).max(180).describe("Transparent Commons TPW-Q entity id or /wiki/ slug whose governed RFC 9264 linkset should be read.")
|
|
5337
|
+
};
|
|
5332
5338
|
var CommonsFeaturedImageInputSchema = z4.object({
|
|
5333
5339
|
url: z4.string().url().describe("Required public image URL for a publishable entity. Use extract_url includeFeaturedImage or preserved media when available."),
|
|
5334
5340
|
alt: z4.string().trim().max(500).optional(),
|
|
@@ -5381,6 +5387,27 @@ var CommonsRelatedLinkInputSchema = z4.object({
|
|
|
5381
5387
|
imageUrl: z4.string().trim().max(2e3).optional().describe("Optional preview image for hover cards when available."),
|
|
5382
5388
|
needsLink: z4.boolean().default(false).describe("Set true when the concept belongs in See Also but no existing Commons entity/page exists yet. The backend exposes these records through commons_list_needs_links.")
|
|
5383
5389
|
}).strict();
|
|
5390
|
+
var CommonsClaimInputSchema = z4.object({
|
|
5391
|
+
predicate: z4.string().trim().min(1).max(500).describe("Registered link relation such as related, describedby, license, or type; alternatively an absolute HTTPS relation URI from a published vocabulary."),
|
|
5392
|
+
predicateLabel: z4.string().trim().max(160).optional().describe("Human-readable label for display and review. It does not replace the machine predicate."),
|
|
5393
|
+
objectEntityId: z4.string().trim().regex(/^TPW-Q[A-Za-z0-9._-]+$/).max(80).optional().describe("Existing Transparent Commons entity target. Use exactly one of objectEntityId or objectUrl."),
|
|
5394
|
+
objectUrl: z4.string().url().refine((value) => value.startsWith("https://"), "objectUrl must use HTTPS.").optional().describe("External or third-party target. Use exactly one of objectUrl or objectEntityId."),
|
|
5395
|
+
title: z4.string().trim().max(500).optional(),
|
|
5396
|
+
mediaType: z4.string().trim().max(160).optional().describe("Optional RFC link target media type."),
|
|
5397
|
+
hreflang: z4.array(z4.string().trim().min(1).max(80)).max(20).optional().describe("Optional repeatable RFC link target language hints."),
|
|
5398
|
+
qualifiers: z4.record(z4.string().max(120), z4.union([z4.string(), z4.number(), z4.boolean(), z4.null()])).optional(),
|
|
5399
|
+
references: z4.array(CommonsCitationInputSchema).max(50).optional().describe("Evidence supporting the relationship assertion."),
|
|
5400
|
+
rank: z4.enum(["preferred", "normal", "deprecated"]).default("normal"),
|
|
5401
|
+
confidence: z4.number().min(0).max(1).default(1),
|
|
5402
|
+
confidenceReason: z4.string().trim().max(1e3).optional(),
|
|
5403
|
+
disputeState: z4.enum(["undisputed", "attributed", "disputed", "contested", "needs_review", "deprecated"]).default("undisputed"),
|
|
5404
|
+
validFrom: z4.string().trim().max(80).optional(),
|
|
5405
|
+
validTo: z4.string().trim().max(80).optional(),
|
|
5406
|
+
asOf: z4.string().trim().max(80).optional(),
|
|
5407
|
+
sourceFamily: z4.enum(["first_party", "partner", "independent", "community", "unknown"]).default("unknown")
|
|
5408
|
+
}).strict().refine((claim) => Boolean(claim.objectEntityId) !== Boolean(claim.objectUrl), {
|
|
5409
|
+
message: "Provide exactly one of objectEntityId or objectUrl."
|
|
5410
|
+
});
|
|
5384
5411
|
var CommonsPrepareEntityInputSchema = {
|
|
5385
5412
|
title: z4.string().trim().min(1).max(180).describe("Candidate public page title. Used to derive slug, choose a profile, and search duplicate entities."),
|
|
5386
5413
|
description: z4.string().trim().max(600).optional().describe("Optional candidate summary. Include when known so the prepare pass can route and validate the article shape."),
|
|
@@ -5420,6 +5447,7 @@ var CommonsSubmitEntityInputSchema = {
|
|
|
5420
5447
|
url: z4.string().url().optional(),
|
|
5421
5448
|
description: z4.string().trim().max(300).optional()
|
|
5422
5449
|
}).strict()).max(200).optional().describe("Related concepts, including trails. Existing entities should use entityId."),
|
|
5450
|
+
claims: z4.array(CommonsClaimInputSchema).max(300).optional().describe("Governed relationship assertions. Supplying claims replaces the accepted claim set for this entity; omitting claims preserves it. Only approved, active, non-disputed claims project into the RFC 9264 linkset."),
|
|
5423
5451
|
bodyMarkdown: z4.string().max(5e5).optional().describe("Structured encyclopedia body in neutral Markdown, not a raw scrape dump or blog essay. Use H2 for entity-profile sections and H3/H4/H5 for subtopics; every heading appears in the public page menu. Call commons_prepare_entity first for the live entity profile and commons_validate_entity before submit. Profile sections are adaptive: include History, Pricing, Reception, Timeline, Classification, or similar sections only when source evidence supports them; omit unsupported sections instead of adding empty/filler headings. Apply NPOV, verifiability, and no-original-research rules; self-published sources can support only uncontroversial source-owned facts."),
|
|
5424
5452
|
contentSections: z4.array(z4.object({
|
|
5425
5453
|
id: z4.string().trim().max(180).optional(),
|
|
@@ -8631,6 +8659,19 @@ function registerPaaExtractorMcpTools(server, executor, options = {}) {
|
|
|
8631
8659
|
openWorldHint: false
|
|
8632
8660
|
}
|
|
8633
8661
|
}, async (input) => executor.commonsGetEntity(input));
|
|
8662
|
+
server.registerTool("commons_get_entity_linkset", {
|
|
8663
|
+
title: "Transparent Commons RFC 9264 Linkset",
|
|
8664
|
+
description: "Read the governed RFC 9264 application/linkset+json projection for one published Transparent Commons entity. The anchor is the canonical /wiki/ page; only approved, active, non-disputed claims are included, while third-party targets remain explicit HTTPS links.",
|
|
8665
|
+
inputSchema: CommonsGetEntityLinksetInputSchema,
|
|
8666
|
+
outputSchema: recordOutputSchema("commons_get_entity_linkset", CommonsGenericOutputSchema),
|
|
8667
|
+
annotations: {
|
|
8668
|
+
title: "Transparent Commons RFC 9264 Linkset",
|
|
8669
|
+
readOnlyHint: true,
|
|
8670
|
+
destructiveHint: false,
|
|
8671
|
+
idempotentHint: true,
|
|
8672
|
+
openWorldHint: false
|
|
8673
|
+
}
|
|
8674
|
+
}, async (input) => executor.commonsGetEntityLinkset(input));
|
|
8634
8675
|
server.registerTool("commons_list_needs_links", {
|
|
8635
8676
|
title: "Transparent Commons Needs-Link Backlog",
|
|
8636
8677
|
description: "List unresolved See Also concepts from published Transparent Commons pages. Use this after search/lookup when an agent needs to grow the graph: each result names a concept that appears in See Also but does not yet have a resolved Commons entityId or /wiki/ slug. This is platform Commons graph data, not personal Memory storage.",
|
|
@@ -9098,6 +9139,29 @@ function registerPaaExtractorMcpTools(server, executor, options = {}) {
|
|
|
9098
9139
|
|
|
9099
9140
|
// src/mcp/http-mcp-tool-executor.ts
|
|
9100
9141
|
import { createHash as createHash4, randomUUID as randomUUID2 } from "crypto";
|
|
9142
|
+
function unclassifiedTransportFailure(path, err) {
|
|
9143
|
+
const name = err instanceof Error ? err.name : typeof err;
|
|
9144
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
9145
|
+
console.error(JSON.stringify({
|
|
9146
|
+
event: "mcp_executor_transport_failed",
|
|
9147
|
+
path,
|
|
9148
|
+
error_name: name,
|
|
9149
|
+
error_message: sanitizeVendorName(detail).slice(0, 400)
|
|
9150
|
+
}));
|
|
9151
|
+
return {
|
|
9152
|
+
content: [{
|
|
9153
|
+
type: "text",
|
|
9154
|
+
text: JSON.stringify({
|
|
9155
|
+
error: "service_unavailable",
|
|
9156
|
+
error_type: name,
|
|
9157
|
+
retryable: true,
|
|
9158
|
+
path,
|
|
9159
|
+
message: publicErrorMessage("service_unavailable")
|
|
9160
|
+
})
|
|
9161
|
+
}],
|
|
9162
|
+
isError: true
|
|
9163
|
+
};
|
|
9164
|
+
}
|
|
9101
9165
|
function youtubeVideoIdFromUrl(url) {
|
|
9102
9166
|
if (!url) return null;
|
|
9103
9167
|
try {
|
|
@@ -9198,7 +9262,7 @@ var HttpMcpToolExecutor = class {
|
|
|
9198
9262
|
const rawOverride = process.env.MCP_SCRAPER_HTTP_TIMEOUT_MS;
|
|
9199
9263
|
const parsedOverride = rawOverride === void 0 ? NaN : Number(rawOverride);
|
|
9200
9264
|
this.httpTimeoutOverrideMs = Number.isFinite(parsedOverride) && parsedOverride > 0 ? parsedOverride : null;
|
|
9201
|
-
this.timeoutMs = this.httpTimeoutOverrideMs ??
|
|
9265
|
+
this.timeoutMs = this.httpTimeoutOverrideMs ?? DEFAULT_TOOL_CLIENT_TIMEOUT_MS;
|
|
9202
9266
|
const configuredSerpIntelligenceTimeoutMs = Number(process.env.MCP_SCRAPER_SERP_INTELLIGENCE_HTTP_TIMEOUT_MS ?? this.timeoutMs);
|
|
9203
9267
|
this.serpIntelligenceTimeoutMs = Number.isFinite(configuredSerpIntelligenceTimeoutMs) && configuredSerpIntelligenceTimeoutMs > 0 ? configuredSerpIntelligenceTimeoutMs : this.timeoutMs;
|
|
9204
9268
|
}
|
|
@@ -9237,7 +9301,7 @@ var HttpMcpToolExecutor = class {
|
|
|
9237
9301
|
isError: true
|
|
9238
9302
|
};
|
|
9239
9303
|
}
|
|
9240
|
-
return
|
|
9304
|
+
return unclassifiedTransportFailure(path, err);
|
|
9241
9305
|
}
|
|
9242
9306
|
}
|
|
9243
9307
|
async callConnectedMutation(path, body, idempotencyKey, timeoutMs = this.timeoutMs) {
|
|
@@ -9271,8 +9335,8 @@ var HttpMcpToolExecutor = class {
|
|
|
9271
9335
|
return { content: [{ type: "text", text: JSON.stringify(httpErrorPayload(path, res, data)) }], isError: true };
|
|
9272
9336
|
}
|
|
9273
9337
|
return { content: [{ type: "text", text: JSON.stringify(data) }] };
|
|
9274
|
-
} catch {
|
|
9275
|
-
return
|
|
9338
|
+
} catch (err) {
|
|
9339
|
+
return unclassifiedTransportFailure(path, err);
|
|
9276
9340
|
}
|
|
9277
9341
|
}
|
|
9278
9342
|
async getTextArtifact(path, maxBytes, timeoutMs = this.timeoutMs) {
|
|
@@ -9309,7 +9373,7 @@ var HttpMcpToolExecutor = class {
|
|
|
9309
9373
|
}]
|
|
9310
9374
|
};
|
|
9311
9375
|
} catch (err) {
|
|
9312
|
-
return
|
|
9376
|
+
return unclassifiedTransportFailure(path, err);
|
|
9313
9377
|
}
|
|
9314
9378
|
}
|
|
9315
9379
|
harvestPaa(input) {
|
|
@@ -9666,6 +9730,9 @@ var HttpMcpToolExecutor = class {
|
|
|
9666
9730
|
return result;
|
|
9667
9731
|
}
|
|
9668
9732
|
}
|
|
9733
|
+
commonsGetEntityLinkset(input) {
|
|
9734
|
+
return this.getJson(`/commons/entities/${encodeURIComponent(input.idOrSlug)}/linkset?envelope=true`);
|
|
9735
|
+
}
|
|
9669
9736
|
commonsPrepareEntity(input) {
|
|
9670
9737
|
return this.call("/commons/entities/prepare", input);
|
|
9671
9738
|
}
|
|
@@ -14401,6 +14468,7 @@ export {
|
|
|
14401
14468
|
EDITORIAL_READING_ROOM_TEMPLATE_PRESET,
|
|
14402
14469
|
PERSONAL_AUTHORITY_TEMPLATE_PRESET,
|
|
14403
14470
|
NEWSROOM_PUBLISHER_TEMPLATE_PRESET,
|
|
14471
|
+
CommonsClaimInputSchema,
|
|
14404
14472
|
CreateEditorialReadingRoomInputSchema,
|
|
14405
14473
|
RenewEditorialReadingRoomDownloadInputSchema,
|
|
14406
14474
|
CommonsPreparePublicationInputSchema,
|
|
@@ -14423,4 +14491,4 @@ export {
|
|
|
14423
14491
|
ScheduledResultsMcpExecutor,
|
|
14424
14492
|
registerScheduledResultsMcpTools
|
|
14425
14493
|
};
|
|
14426
|
-
//# sourceMappingURL=chunk-
|
|
14494
|
+
//# sourceMappingURL=chunk-44LNKZTE.js.map
|