mcp-scraper 0.66.7 → 0.67.1
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/CHANGELOG.md +16 -1
- package/README.md +1 -1
- package/dist/bin/api-server.cjs +260 -43
- package/dist/bin/api-server.js +3 -3
- package/dist/bin/mcp-scraper-cli.cjs +1 -1
- package/dist/bin/mcp-scraper-cli.js +1 -1
- package/dist/bin/mcp-scraper-install.cjs +2 -2
- package/dist/bin/mcp-scraper-install.js +2 -2
- package/dist/bin/mcp-stdio-server.cjs +70 -14
- package/dist/bin/mcp-stdio-server.js +6 -6
- package/dist/bin/paa-harvest.cjs +6 -0
- package/dist/bin/paa-harvest.js +3 -3
- package/dist/{chunk-F434YJPV.js → chunk-2L4C4DAZ.js} +1 -1
- package/dist/{chunk-LVXRWJJJ.js → chunk-2LXTOAKS.js} +1 -1
- package/dist/{chunk-CGOMGGOF.js → chunk-62LEXS5O.js} +2 -2
- package/dist/{chunk-HZDJ5UZ4.js → chunk-65FTMB7G.js} +25 -1
- package/dist/{chunk-U2UHJWFW.js → chunk-ES25GP6C.js} +1 -1
- package/dist/{chunk-O7ZC5Y3Z.js → chunk-HUNXSVKU.js} +1 -1
- package/dist/{chunk-HWGQVP3Q.js → chunk-LCGTNWOT.js} +1 -1
- package/dist/{chunk-EVOBJYBE.js → chunk-LN6N3YLK.js} +1 -1
- package/dist/{chunk-Z5QQEWXA.js → chunk-STQQOEHC.js} +47 -15
- package/dist/{chunk-JZPSG4NR.js → chunk-UL4ZKAWZ.js} +1 -1
- package/dist/{chunk-7KB5QTHP.js → chunk-VES63X4Q.js} +1 -1
- package/dist/{chunk-HBZENASD.js → chunk-Y46YNQMM.js} +1 -1
- package/dist/{db-MNNNIWVS.js → db-ZGZAKYBW.js} +1 -1
- package/dist/{extract-bundle-RW7CVIRF.js → extract-bundle-QQIYJSBW.js} +3 -3
- package/dist/index.cjs +6 -0
- package/dist/index.js +3 -3
- package/dist/{lead-list-enrichment-repository-PZYE6TDP.js → lead-list-enrichment-repository-CXLVIV3R.js} +2 -2
- package/dist/{location-data-repository-EPCNGMOM.js → location-data-repository-G72M7DTN.js} +2 -2
- package/dist/{server-KSVJ4X4V.js → server-ROIJWWJG.js} +206 -48
- package/dist/{site-extract-repository-CZ7SVT3Z.js → site-extract-repository-7EP6UX6I.js} +2 -2
- package/dist/{worker-IBLGV272.js → worker-JGWV2LID.js} +5 -5
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
renderInstallTerminal
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-HUNXSVKU.js";
|
|
5
5
|
import {
|
|
6
6
|
PACKAGE_VERSION
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-VES63X4Q.js";
|
|
8
8
|
|
|
9
9
|
// bin/mcp-scraper-install.ts
|
|
10
10
|
var noColor = process.argv.includes("--no-color") || process.env.NO_COLOR !== void 0 || process.env.FORCE_COLOR === "0" || !process.stdout.isTTY;
|
|
@@ -107,6 +107,12 @@ var PUBLIC_ERROR_CODES = [
|
|
|
107
107
|
"image_redirect_limit",
|
|
108
108
|
"image_base64_invalid",
|
|
109
109
|
"image_source_missing",
|
|
110
|
+
"image_source_ambiguous",
|
|
111
|
+
"image_source_type_invalid",
|
|
112
|
+
"image_artifact_not_found",
|
|
113
|
+
"image_page_too_large",
|
|
114
|
+
"page_image_not_found",
|
|
115
|
+
"page_image_candidates_unusable",
|
|
110
116
|
"image_format_unsupported",
|
|
111
117
|
"image_storage_unconfigured",
|
|
112
118
|
"featured_image_unhostable"
|
|
@@ -214,6 +220,12 @@ function publicErrorType(code) {
|
|
|
214
220
|
case "image_redirect_limit":
|
|
215
221
|
case "image_base64_invalid":
|
|
216
222
|
case "image_source_missing":
|
|
223
|
+
case "image_source_ambiguous":
|
|
224
|
+
case "image_source_type_invalid":
|
|
225
|
+
case "image_artifact_not_found":
|
|
226
|
+
case "image_page_too_large":
|
|
227
|
+
case "page_image_not_found":
|
|
228
|
+
case "page_image_candidates_unusable":
|
|
217
229
|
case "image_format_unsupported":
|
|
218
230
|
case "image_storage_unconfigured":
|
|
219
231
|
case "featured_image_unhostable":
|
|
@@ -310,7 +322,19 @@ function publicErrorMessage(code) {
|
|
|
310
322
|
case "image_base64_invalid":
|
|
311
323
|
return "The supplied inline image bytes are invalid.";
|
|
312
324
|
case "image_source_missing":
|
|
313
|
-
return "Provide
|
|
325
|
+
return "Provide exactly one of a public image or webpage URL, inline image bytes, or an owner-scoped image artifact.";
|
|
326
|
+
case "image_source_ambiguous":
|
|
327
|
+
return "Provide only one image source: sourceUrl, imageBase64, or artifactId.";
|
|
328
|
+
case "image_source_type_invalid":
|
|
329
|
+
return "Use sourceType only with inline image bytes or an owner-scoped image artifact.";
|
|
330
|
+
case "image_artifact_not_found":
|
|
331
|
+
return "The image artifact was not found, expired, or does not belong to this account.";
|
|
332
|
+
case "image_page_too_large":
|
|
333
|
+
return "The webpage is too large for bounded Commons image discovery.";
|
|
334
|
+
case "page_image_not_found":
|
|
335
|
+
return "The webpage did not expose a usable featured or content image.";
|
|
336
|
+
case "page_image_candidates_unusable":
|
|
337
|
+
return "The webpage exposed image candidates, but none returned supported public image bytes.";
|
|
314
338
|
case "image_format_unsupported":
|
|
315
339
|
return "Commons accepts JPEG, PNG, GIF, or WebP image bytes.";
|
|
316
340
|
case "image_storage_unconfigured":
|
|
@@ -473,6 +497,18 @@ async function readResponseData(res) {
|
|
|
473
497
|
return text;
|
|
474
498
|
}
|
|
475
499
|
}
|
|
500
|
+
function attachJsonStructuredContent(result) {
|
|
501
|
+
if (result.isError || result.structuredContent) return result;
|
|
502
|
+
const text = result.content.find((part) => part.type === "text");
|
|
503
|
+
if (!text || text.type !== "text") return result;
|
|
504
|
+
try {
|
|
505
|
+
const parsed = JSON.parse(text.text);
|
|
506
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return result;
|
|
507
|
+
return { ...result, structuredContent: parsed };
|
|
508
|
+
} catch {
|
|
509
|
+
return result;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
476
512
|
function httpErrorPayload(path, res, data) {
|
|
477
513
|
const objectData = data && typeof data === "object" && !Array.isArray(data) ? data : null;
|
|
478
514
|
const rawCode = objectData?.code ?? objectData?.errorCode ?? objectData?.error_code;
|
|
@@ -1083,8 +1119,8 @@ var HttpMcpToolExecutor = class {
|
|
|
1083
1119
|
commonsGetProposal(input) {
|
|
1084
1120
|
return this.getJson(`/commons/proposals/${encodeURIComponent(input.proposalId)}`);
|
|
1085
1121
|
}
|
|
1086
|
-
commonsHostImage(input) {
|
|
1087
|
-
return this.call("/commons/images", input);
|
|
1122
|
+
async commonsHostImage(input) {
|
|
1123
|
+
return attachJsonStructuredContent(await this.call("/commons/images", input));
|
|
1088
1124
|
}
|
|
1089
1125
|
commonsUpdateEditorialArticle(input) {
|
|
1090
1126
|
const { idempotencyKey, ...body } = input;
|
|
@@ -1286,7 +1322,7 @@ render();
|
|
|
1286
1322
|
}
|
|
1287
1323
|
|
|
1288
1324
|
// src/version.ts
|
|
1289
|
-
var PACKAGE_VERSION = "0.
|
|
1325
|
+
var PACKAGE_VERSION = "0.67.1";
|
|
1290
1326
|
|
|
1291
1327
|
// src/mcp/input-field-descriptions.ts
|
|
1292
1328
|
var import_zod = require("zod");
|
|
@@ -8272,9 +8308,10 @@ seam is noted so you can chain them.
|
|
|
8272
8308
|
guidance, recommended sections, optional sections, and heading guidance before any write occurs.
|
|
8273
8309
|
- Host a featured image -> **commons_host_image**. The normal write sequence is **commons_prepare_entity ->
|
|
8274
8310
|
compose the payload -> commons_host_image -> commons_validate_entity -> commons_submit_entity**. Put the
|
|
8275
|
-
permanent returned URL in featuredImage.url. Use imageBase64 for
|
|
8276
|
-
|
|
8277
|
-
|
|
8311
|
+
permanent returned URL in featuredImage.url. Use imageBase64 for pasted or AI-generated bytes, artifactId for an
|
|
8312
|
+
owner-scoped MCP Scraper image artifact, or sourceUrl for either a public HTTPS image or a webpage containing one.
|
|
8313
|
+
Webpage discovery tries Open Graph, Twitter, JSON-LD, then meaningful content images. Never pass a caller-local
|
|
8314
|
+
path, opaque chat attachment reference, or private/authenticated URL.
|
|
8278
8315
|
- Validate a composed entity without writing -> **commons_validate_entity**. Use it after image hosting and before
|
|
8279
8316
|
submit. Validation does not fetch or store image bytes; an external/unregistered featured image is reported in
|
|
8280
8317
|
imageDiagnostics as not publishable until commons_host_image returns its permanent Commons URL. Validation also
|
|
@@ -10181,7 +10218,7 @@ var CommonsGetEntityLinksetInputSchema = {
|
|
|
10181
10218
|
idOrSlug: import_zod8.z.string().trim().min(1).max(180).describe("Transparent Commons TPW-Q entity id or /wiki/ slug whose governed RFC 9264 linkset should be read.")
|
|
10182
10219
|
};
|
|
10183
10220
|
var CommonsFeaturedImageInputSchema = import_zod8.z.object({
|
|
10184
|
-
url: import_zod8.z.string().url().describe("For a publish-ready entity, use the permanent URL returned by commons_host_image.
|
|
10221
|
+
url: import_zod8.z.string().url().describe("For a publish-ready entity, use the permanent URL returned by commons_host_image. Validation reports any unregistered external URL as not ready. Do not use a chat attachment reference, caller-local path, private URL, or HTML page URL here; pass the original image or webpage source to commons_host_image first."),
|
|
10185
10222
|
alt: import_zod8.z.string().trim().max(500).optional(),
|
|
10186
10223
|
caption: import_zod8.z.string().trim().max(1e3).optional(),
|
|
10187
10224
|
sourceUrl: import_zod8.z.string().url().optional(),
|
|
@@ -10280,7 +10317,7 @@ var CommonsSubmitEntityInputSchema = {
|
|
|
10280
10317
|
entityId: import_zod8.z.string().trim().max(80).optional().describe("Existing Transparent Public Wiki entity id when proposing an edit. New entities normally omit this and receive a TPW-Q id."),
|
|
10281
10318
|
entityType: import_zod8.z.string().trim().max(120).default("PublicArticle").describe("Backend Wikidata-style type. Prefer precise entity classes such as SoftwareApplication, Organization, Person, Event, Place, Taxon, ScienceConcept, MathConcept, TechArticle, or PublicArticle; the public article structure should match the selected type."),
|
|
10282
10319
|
disambiguationName: import_zod8.z.string().trim().max(240).optional().describe("Clarifying name used when the concept could be confused with another entity."),
|
|
10283
|
-
featuredImage: CommonsFeaturedImageInputSchema.optional().describe("Required for auto-published public entities. First call commons_host_image
|
|
10320
|
+
featuredImage: CommonsFeaturedImageInputSchema.optional().describe("Required for auto-published public entities. First call commons_host_image with attachment bytes, an image artifact, a direct image URL, or a webpage URL, then place its returned permanent URL here. Validation does not fetch external images and reports unregistered URLs as not publishable. Submit retains a compatibility fallback for public URLs. The image is also added to the media manifest if absent."),
|
|
10284
10321
|
source: CommonsSourceInputSchema.optional().describe("Source provenance. Store original URL, source byline, and origin canonical here; canonical does not replace rights review."),
|
|
10285
10322
|
tags: import_zod8.z.array(import_zod8.z.string().trim().min(1).max(80)).max(24).optional().describe("Standardized topic tags. Use existing/searchable concepts when possible."),
|
|
10286
10323
|
keywords: import_zod8.z.array(import_zod8.z.string().trim().min(1).max(120)).max(50).optional().describe("SEO and retrieval keywords."),
|
|
@@ -10342,12 +10379,31 @@ var CommonsGetEntityLedgerInputSchema = {
|
|
|
10342
10379
|
idOrSlug: import_zod8.z.string().trim().min(1).max(180).describe("Published entity id or /wiki/ slug whose contribution ledger should be read.")
|
|
10343
10380
|
};
|
|
10344
10381
|
var CommonsHostImageInputSchema = {
|
|
10345
|
-
sourceUrl: import_zod8.z.string().url().optional().describe("
|
|
10346
|
-
imageBase64: import_zod8.z.string().min(16).optional().describe("Base64 image bytes for an image
|
|
10382
|
+
sourceUrl: import_zod8.z.string().url().optional().describe("Public HTTPS direct image URL or webpage URL. A direct image is hosted as-is; an HTML page is inspected for Open Graph, Twitter, JSON-LD, and meaningful content images, then the first usable candidate is hosted. Temporary signed URLs are consumed immediately and query credentials are not retained as provenance."),
|
|
10383
|
+
imageBase64: import_zod8.z.string().min(16).optional().describe("Base64 image bytes for an image already available to the caller, including a pasted attachment or AI-generated image. Use sourceType to preserve whether it was uploaded or generated. Keep the complete serialized request within the client transport limit."),
|
|
10384
|
+
artifactId: import_zod8.z.string().trim().min(1).max(500).optional().describe("Owner-scoped image artifact returned by an MCP Scraper media or screenshot workflow. The server reauthorizes ownership and reads the bytes directly; do not construct an artifact ID."),
|
|
10385
|
+
sourceType: import_zod8.z.enum(["uploaded", "ai_generated"]).optional().describe("Provenance for imageBase64 or artifactId. Use ai_generated only when an image model created the supplied bytes; otherwise use uploaded or omit it."),
|
|
10347
10386
|
alt: import_zod8.z.string().trim().max(500).optional().describe("Alt text describing the image for readers who cannot see it."),
|
|
10348
10387
|
license: import_zod8.z.string().trim().max(240).optional().describe("License or usage terms of the original image, preserved with the hosted copy."),
|
|
10349
10388
|
attribution: import_zod8.z.string().trim().max(500).optional().describe("Credit line for the original photographer, publication, or archive.")
|
|
10350
10389
|
};
|
|
10390
|
+
var CommonsHostImageOutputSchema = {
|
|
10391
|
+
ok: import_zod8.z.boolean(),
|
|
10392
|
+
data: import_zod8.z.object({
|
|
10393
|
+
id: import_zod8.z.string().describe("Stable Commons image ID."),
|
|
10394
|
+
url: import_zod8.z.string().url().describe("Permanent Commons URL to use as featuredImage.url."),
|
|
10395
|
+
contentType: import_zod8.z.enum(["image/jpeg", "image/png", "image/gif", "image/webp"]),
|
|
10396
|
+
bytes: import_zod8.z.number().int().positive(),
|
|
10397
|
+
digest: import_zod8.z.string(),
|
|
10398
|
+
sourceUrl: import_zod8.z.string().url().nullable().describe("Sanitized direct asset URL that supplied the hosted bytes, when applicable."),
|
|
10399
|
+
sourcePageUrl: import_zod8.z.string().url().nullable().describe("Sanitized webpage URL from which the image was discovered, when applicable."),
|
|
10400
|
+
sourceKind: import_zod8.z.enum(["uploaded", "ai_generated", "artifact", "direct_url", "webpage", "registered"]),
|
|
10401
|
+
selectionSource: import_zod8.z.enum(["provided_bytes", "artifact", "direct_url", "og:image", "twitter:image", "json-ld", "content-image", "registered"]),
|
|
10402
|
+
reused: import_zod8.z.boolean().describe("True when identical image bytes were already stored.")
|
|
10403
|
+
}).optional(),
|
|
10404
|
+
error: import_zod8.z.string().optional(),
|
|
10405
|
+
message: import_zod8.z.string().optional()
|
|
10406
|
+
};
|
|
10351
10407
|
var CommonsGetProposalInputSchema = {
|
|
10352
10408
|
proposalId: import_zod8.z.string().trim().min(1).max(120).describe("Proposal id returned by commons_submit_entity, in the form commons-proposal-<uuid>.")
|
|
10353
10409
|
};
|
|
@@ -14144,9 +14200,9 @@ function registerPaaExtractorMcpTools(server, executor, options = {}) {
|
|
|
14144
14200
|
}, async (input) => executor.commonsGetEntityLedger(input));
|
|
14145
14201
|
server.registerTool("commons_host_image", {
|
|
14146
14202
|
title: "Host a Transparent Commons Image",
|
|
14147
|
-
description: "
|
|
14203
|
+
description: "Turn one supplied image source into a permanent Transparent Commons image before validation and submission. Provide exactly one of imageBase64 for a pasted or AI-generated image, artifactId for an owner-scoped MCP Scraper image artifact, or sourceUrl for either a direct public HTTPS image or a webpage containing the desired image. Webpages are inspected in deterministic order for Open Graph, Twitter, JSON-LD, and meaningful content images; unusable candidates fall through to the next candidate. Returns the permanent URL for featuredImage.url plus source and selection provenance. JPEG, PNG, GIF, and WebP are accepted up to 10 MB; SVG is rejected. Identical bytes are stored once. Never pass a caller-local path or private/authenticated URL.",
|
|
14148
14204
|
inputSchema: CommonsHostImageInputSchema,
|
|
14149
|
-
outputSchema: recordOutputSchema("commons_host_image",
|
|
14205
|
+
outputSchema: recordOutputSchema("commons_host_image", CommonsHostImageOutputSchema),
|
|
14150
14206
|
annotations: {
|
|
14151
14207
|
title: "Host a Transparent Commons Image",
|
|
14152
14208
|
readOnlyHint: false,
|
|
@@ -18752,7 +18808,7 @@ var HostedMemoryMcpToolExecutor = class {
|
|
|
18752
18808
|
|
|
18753
18809
|
// release-message.json
|
|
18754
18810
|
var release_message_default = {
|
|
18755
|
-
message: "Transparent Commons now
|
|
18811
|
+
message: "Transparent Commons image hosting now accepts the source a user has and returns the same permanent-image result in both readable and typed MCP channels."
|
|
18756
18812
|
};
|
|
18757
18813
|
|
|
18758
18814
|
// src/install-terminal.ts
|
|
@@ -13,21 +13,21 @@ import {
|
|
|
13
13
|
registerScheduledResultsMcpTools,
|
|
14
14
|
registerSerpIntelligenceCaptureTools,
|
|
15
15
|
resolveDeploymentProfile
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-STQQOEHC.js";
|
|
17
17
|
import "../chunk-PGJQDMC2.js";
|
|
18
|
-
import "../chunk-
|
|
19
|
-
import "../chunk-
|
|
18
|
+
import "../chunk-2L4C4DAZ.js";
|
|
19
|
+
import "../chunk-ES25GP6C.js";
|
|
20
20
|
import {
|
|
21
21
|
renderInstallTerminal
|
|
22
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-HUNXSVKU.js";
|
|
23
23
|
import "../chunk-VXLU74YZ.js";
|
|
24
24
|
import "../chunk-GGZEC22A.js";
|
|
25
25
|
import {
|
|
26
26
|
PACKAGE_VERSION
|
|
27
|
-
} from "../chunk-
|
|
27
|
+
} from "../chunk-VES63X4Q.js";
|
|
28
28
|
import "../chunk-DNM65UCK.js";
|
|
29
29
|
import "../chunk-AYJHI2FK.js";
|
|
30
|
-
import "../chunk-
|
|
30
|
+
import "../chunk-65FTMB7G.js";
|
|
31
31
|
|
|
32
32
|
// bin/mcp-stdio-server.ts
|
|
33
33
|
import { readFileSync } from "fs";
|
package/dist/bin/paa-harvest.cjs
CHANGED
|
@@ -311,6 +311,12 @@ var PUBLIC_ERROR_CODES = [
|
|
|
311
311
|
"image_redirect_limit",
|
|
312
312
|
"image_base64_invalid",
|
|
313
313
|
"image_source_missing",
|
|
314
|
+
"image_source_ambiguous",
|
|
315
|
+
"image_source_type_invalid",
|
|
316
|
+
"image_artifact_not_found",
|
|
317
|
+
"image_page_too_large",
|
|
318
|
+
"page_image_not_found",
|
|
319
|
+
"page_image_candidates_unusable",
|
|
314
320
|
"image_format_unsupported",
|
|
315
321
|
"image_storage_unconfigured",
|
|
316
322
|
"featured_image_unhostable"
|
package/dist/bin/paa-harvest.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
harvest
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-62LEXS5O.js";
|
|
5
5
|
import {
|
|
6
6
|
browserServiceApiKey
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-ES25GP6C.js";
|
|
8
8
|
import "../chunk-77LQV73B.js";
|
|
9
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-65FTMB7G.js";
|
|
10
10
|
|
|
11
11
|
// src/cli.ts
|
|
12
12
|
import { Command } from "commander";
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
currentCostContext,
|
|
7
7
|
recordKernelSession,
|
|
8
8
|
runWithCostContext
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ES25GP6C.js";
|
|
10
10
|
import {
|
|
11
11
|
DEFAULT_PROXY_MODE,
|
|
12
12
|
HarvestOptionsSchema,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
RECAPTCHA_INSTRUCTIONS,
|
|
22
22
|
RequestAbortedError,
|
|
23
23
|
sanitizeVendorName
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-65FTMB7G.js";
|
|
25
25
|
|
|
26
26
|
// src/driver/BrowserDriver.ts
|
|
27
27
|
import { chromium } from "playwright-extra";
|
|
@@ -53,6 +53,12 @@ var PUBLIC_ERROR_CODES = [
|
|
|
53
53
|
"image_redirect_limit",
|
|
54
54
|
"image_base64_invalid",
|
|
55
55
|
"image_source_missing",
|
|
56
|
+
"image_source_ambiguous",
|
|
57
|
+
"image_source_type_invalid",
|
|
58
|
+
"image_artifact_not_found",
|
|
59
|
+
"image_page_too_large",
|
|
60
|
+
"page_image_not_found",
|
|
61
|
+
"page_image_candidates_unusable",
|
|
56
62
|
"image_format_unsupported",
|
|
57
63
|
"image_storage_unconfigured",
|
|
58
64
|
"featured_image_unhostable"
|
|
@@ -187,6 +193,12 @@ function publicErrorType(code) {
|
|
|
187
193
|
case "image_redirect_limit":
|
|
188
194
|
case "image_base64_invalid":
|
|
189
195
|
case "image_source_missing":
|
|
196
|
+
case "image_source_ambiguous":
|
|
197
|
+
case "image_source_type_invalid":
|
|
198
|
+
case "image_artifact_not_found":
|
|
199
|
+
case "image_page_too_large":
|
|
200
|
+
case "page_image_not_found":
|
|
201
|
+
case "page_image_candidates_unusable":
|
|
190
202
|
case "image_format_unsupported":
|
|
191
203
|
case "image_storage_unconfigured":
|
|
192
204
|
case "featured_image_unhostable":
|
|
@@ -283,7 +295,19 @@ function publicErrorMessage(code) {
|
|
|
283
295
|
case "image_base64_invalid":
|
|
284
296
|
return "The supplied inline image bytes are invalid.";
|
|
285
297
|
case "image_source_missing":
|
|
286
|
-
return "Provide
|
|
298
|
+
return "Provide exactly one of a public image or webpage URL, inline image bytes, or an owner-scoped image artifact.";
|
|
299
|
+
case "image_source_ambiguous":
|
|
300
|
+
return "Provide only one image source: sourceUrl, imageBase64, or artifactId.";
|
|
301
|
+
case "image_source_type_invalid":
|
|
302
|
+
return "Use sourceType only with inline image bytes or an owner-scoped image artifact.";
|
|
303
|
+
case "image_artifact_not_found":
|
|
304
|
+
return "The image artifact was not found, expired, or does not belong to this account.";
|
|
305
|
+
case "image_page_too_large":
|
|
306
|
+
return "The webpage is too large for bounded Commons image discovery.";
|
|
307
|
+
case "page_image_not_found":
|
|
308
|
+
return "The webpage did not expose a usable featured or content image.";
|
|
309
|
+
case "page_image_candidates_unusable":
|
|
310
|
+
return "The webpage exposed image candidates, but none returned supported public image bytes.";
|
|
287
311
|
case "image_format_unsupported":
|
|
288
312
|
return "Commons accepts JPEG, PNG, GIF, or WebP image bytes.";
|
|
289
313
|
case "image_storage_unconfigured":
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// release-message.json
|
|
2
2
|
var release_message_default = {
|
|
3
|
-
message: "Transparent Commons now
|
|
3
|
+
message: "Transparent Commons image hosting now accepts the source a user has and returns the same permanent-image result in both readable and typed MCP channels."
|
|
4
4
|
};
|
|
5
5
|
|
|
6
6
|
// src/install-terminal.ts
|
|
@@ -8,13 +8,13 @@ import {
|
|
|
8
8
|
} from "./chunk-PGJQDMC2.js";
|
|
9
9
|
import {
|
|
10
10
|
sanitizeOutboundDiagnostics
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-2L4C4DAZ.js";
|
|
12
12
|
import {
|
|
13
13
|
browserServiceProfileName,
|
|
14
14
|
browserServiceProfileSaveChanges,
|
|
15
15
|
recordVendorUsage,
|
|
16
16
|
vendorCostUsd
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-ES25GP6C.js";
|
|
18
18
|
import {
|
|
19
19
|
buildSerpEmailQuery,
|
|
20
20
|
classifyEmailScope,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
} from "./chunk-VXLU74YZ.js";
|
|
26
26
|
import {
|
|
27
27
|
PACKAGE_VERSION
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-VES63X4Q.js";
|
|
29
29
|
import {
|
|
30
30
|
createPrivateArtifact,
|
|
31
31
|
privateArtifactOwnerId,
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
normalizePublicErrorCode,
|
|
46
46
|
publicErrorMessage,
|
|
47
47
|
sanitizeVendorName
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-65FTMB7G.js";
|
|
49
49
|
|
|
50
50
|
// src/harvest-timeout.ts
|
|
51
51
|
var SCRAPE_FUNCTION_MAX_MS = 8e5;
|
|
@@ -390,9 +390,10 @@ seam is noted so you can chain them.
|
|
|
390
390
|
guidance, recommended sections, optional sections, and heading guidance before any write occurs.
|
|
391
391
|
- Host a featured image -> **commons_host_image**. The normal write sequence is **commons_prepare_entity ->
|
|
392
392
|
compose the payload -> commons_host_image -> commons_validate_entity -> commons_submit_entity**. Put the
|
|
393
|
-
permanent returned URL in featuredImage.url. Use imageBase64 for
|
|
394
|
-
|
|
395
|
-
|
|
393
|
+
permanent returned URL in featuredImage.url. Use imageBase64 for pasted or AI-generated bytes, artifactId for an
|
|
394
|
+
owner-scoped MCP Scraper image artifact, or sourceUrl for either a public HTTPS image or a webpage containing one.
|
|
395
|
+
Webpage discovery tries Open Graph, Twitter, JSON-LD, then meaningful content images. Never pass a caller-local
|
|
396
|
+
path, opaque chat attachment reference, or private/authenticated URL.
|
|
396
397
|
- Validate a composed entity without writing -> **commons_validate_entity**. Use it after image hosting and before
|
|
397
398
|
submit. Validation does not fetch or store image bytes; an external/unregistered featured image is reported in
|
|
398
399
|
imageDiagnostics as not publishable until commons_host_image returns its permanent Commons URL. Validation also
|
|
@@ -7505,7 +7506,7 @@ var CommonsGetEntityLinksetInputSchema = {
|
|
|
7505
7506
|
idOrSlug: z6.string().trim().min(1).max(180).describe("Transparent Commons TPW-Q entity id or /wiki/ slug whose governed RFC 9264 linkset should be read.")
|
|
7506
7507
|
};
|
|
7507
7508
|
var CommonsFeaturedImageInputSchema = z6.object({
|
|
7508
|
-
url: z6.string().url().describe("For a publish-ready entity, use the permanent URL returned by commons_host_image.
|
|
7509
|
+
url: z6.string().url().describe("For a publish-ready entity, use the permanent URL returned by commons_host_image. Validation reports any unregistered external URL as not ready. Do not use a chat attachment reference, caller-local path, private URL, or HTML page URL here; pass the original image or webpage source to commons_host_image first."),
|
|
7509
7510
|
alt: z6.string().trim().max(500).optional(),
|
|
7510
7511
|
caption: z6.string().trim().max(1e3).optional(),
|
|
7511
7512
|
sourceUrl: z6.string().url().optional(),
|
|
@@ -7604,7 +7605,7 @@ var CommonsSubmitEntityInputSchema = {
|
|
|
7604
7605
|
entityId: z6.string().trim().max(80).optional().describe("Existing Transparent Public Wiki entity id when proposing an edit. New entities normally omit this and receive a TPW-Q id."),
|
|
7605
7606
|
entityType: z6.string().trim().max(120).default("PublicArticle").describe("Backend Wikidata-style type. Prefer precise entity classes such as SoftwareApplication, Organization, Person, Event, Place, Taxon, ScienceConcept, MathConcept, TechArticle, or PublicArticle; the public article structure should match the selected type."),
|
|
7606
7607
|
disambiguationName: z6.string().trim().max(240).optional().describe("Clarifying name used when the concept could be confused with another entity."),
|
|
7607
|
-
featuredImage: CommonsFeaturedImageInputSchema.optional().describe("Required for auto-published public entities. First call commons_host_image
|
|
7608
|
+
featuredImage: CommonsFeaturedImageInputSchema.optional().describe("Required for auto-published public entities. First call commons_host_image with attachment bytes, an image artifact, a direct image URL, or a webpage URL, then place its returned permanent URL here. Validation does not fetch external images and reports unregistered URLs as not publishable. Submit retains a compatibility fallback for public URLs. The image is also added to the media manifest if absent."),
|
|
7608
7609
|
source: CommonsSourceInputSchema.optional().describe("Source provenance. Store original URL, source byline, and origin canonical here; canonical does not replace rights review."),
|
|
7609
7610
|
tags: z6.array(z6.string().trim().min(1).max(80)).max(24).optional().describe("Standardized topic tags. Use existing/searchable concepts when possible."),
|
|
7610
7611
|
keywords: z6.array(z6.string().trim().min(1).max(120)).max(50).optional().describe("SEO and retrieval keywords."),
|
|
@@ -7666,12 +7667,31 @@ var CommonsGetEntityLedgerInputSchema = {
|
|
|
7666
7667
|
idOrSlug: z6.string().trim().min(1).max(180).describe("Published entity id or /wiki/ slug whose contribution ledger should be read.")
|
|
7667
7668
|
};
|
|
7668
7669
|
var CommonsHostImageInputSchema = {
|
|
7669
|
-
sourceUrl: z6.string().url().optional().describe("
|
|
7670
|
-
imageBase64: z6.string().min(16).optional().describe("Base64 image bytes for an image
|
|
7670
|
+
sourceUrl: z6.string().url().optional().describe("Public HTTPS direct image URL or webpage URL. A direct image is hosted as-is; an HTML page is inspected for Open Graph, Twitter, JSON-LD, and meaningful content images, then the first usable candidate is hosted. Temporary signed URLs are consumed immediately and query credentials are not retained as provenance."),
|
|
7671
|
+
imageBase64: z6.string().min(16).optional().describe("Base64 image bytes for an image already available to the caller, including a pasted attachment or AI-generated image. Use sourceType to preserve whether it was uploaded or generated. Keep the complete serialized request within the client transport limit."),
|
|
7672
|
+
artifactId: z6.string().trim().min(1).max(500).optional().describe("Owner-scoped image artifact returned by an MCP Scraper media or screenshot workflow. The server reauthorizes ownership and reads the bytes directly; do not construct an artifact ID."),
|
|
7673
|
+
sourceType: z6.enum(["uploaded", "ai_generated"]).optional().describe("Provenance for imageBase64 or artifactId. Use ai_generated only when an image model created the supplied bytes; otherwise use uploaded or omit it."),
|
|
7671
7674
|
alt: z6.string().trim().max(500).optional().describe("Alt text describing the image for readers who cannot see it."),
|
|
7672
7675
|
license: z6.string().trim().max(240).optional().describe("License or usage terms of the original image, preserved with the hosted copy."),
|
|
7673
7676
|
attribution: z6.string().trim().max(500).optional().describe("Credit line for the original photographer, publication, or archive.")
|
|
7674
7677
|
};
|
|
7678
|
+
var CommonsHostImageOutputSchema = {
|
|
7679
|
+
ok: z6.boolean(),
|
|
7680
|
+
data: z6.object({
|
|
7681
|
+
id: z6.string().describe("Stable Commons image ID."),
|
|
7682
|
+
url: z6.string().url().describe("Permanent Commons URL to use as featuredImage.url."),
|
|
7683
|
+
contentType: z6.enum(["image/jpeg", "image/png", "image/gif", "image/webp"]),
|
|
7684
|
+
bytes: z6.number().int().positive(),
|
|
7685
|
+
digest: z6.string(),
|
|
7686
|
+
sourceUrl: z6.string().url().nullable().describe("Sanitized direct asset URL that supplied the hosted bytes, when applicable."),
|
|
7687
|
+
sourcePageUrl: z6.string().url().nullable().describe("Sanitized webpage URL from which the image was discovered, when applicable."),
|
|
7688
|
+
sourceKind: z6.enum(["uploaded", "ai_generated", "artifact", "direct_url", "webpage", "registered"]),
|
|
7689
|
+
selectionSource: z6.enum(["provided_bytes", "artifact", "direct_url", "og:image", "twitter:image", "json-ld", "content-image", "registered"]),
|
|
7690
|
+
reused: z6.boolean().describe("True when identical image bytes were already stored.")
|
|
7691
|
+
}).optional(),
|
|
7692
|
+
error: z6.string().optional(),
|
|
7693
|
+
message: z6.string().optional()
|
|
7694
|
+
};
|
|
7675
7695
|
var CommonsGetProposalInputSchema = {
|
|
7676
7696
|
proposalId: z6.string().trim().min(1).max(120).describe("Proposal id returned by commons_submit_entity, in the form commons-proposal-<uuid>.")
|
|
7677
7697
|
};
|
|
@@ -11599,9 +11619,9 @@ function registerPaaExtractorMcpTools(server, executor, options = {}) {
|
|
|
11599
11619
|
}, async (input) => executor.commonsGetEntityLedger(input));
|
|
11600
11620
|
server.registerTool("commons_host_image", {
|
|
11601
11621
|
title: "Host a Transparent Commons Image",
|
|
11602
|
-
description: "
|
|
11622
|
+
description: "Turn one supplied image source into a permanent Transparent Commons image before validation and submission. Provide exactly one of imageBase64 for a pasted or AI-generated image, artifactId for an owner-scoped MCP Scraper image artifact, or sourceUrl for either a direct public HTTPS image or a webpage containing the desired image. Webpages are inspected in deterministic order for Open Graph, Twitter, JSON-LD, and meaningful content images; unusable candidates fall through to the next candidate. Returns the permanent URL for featuredImage.url plus source and selection provenance. JPEG, PNG, GIF, and WebP are accepted up to 10 MB; SVG is rejected. Identical bytes are stored once. Never pass a caller-local path or private/authenticated URL.",
|
|
11603
11623
|
inputSchema: CommonsHostImageInputSchema,
|
|
11604
|
-
outputSchema: recordOutputSchema("commons_host_image",
|
|
11624
|
+
outputSchema: recordOutputSchema("commons_host_image", CommonsHostImageOutputSchema),
|
|
11605
11625
|
annotations: {
|
|
11606
11626
|
title: "Host a Transparent Commons Image",
|
|
11607
11627
|
readOnlyHint: false,
|
|
@@ -12116,6 +12136,18 @@ async function readResponseData(res) {
|
|
|
12116
12136
|
return text;
|
|
12117
12137
|
}
|
|
12118
12138
|
}
|
|
12139
|
+
function attachJsonStructuredContent(result) {
|
|
12140
|
+
if (result.isError || result.structuredContent) return result;
|
|
12141
|
+
const text = result.content.find((part) => part.type === "text");
|
|
12142
|
+
if (!text || text.type !== "text") return result;
|
|
12143
|
+
try {
|
|
12144
|
+
const parsed = JSON.parse(text.text);
|
|
12145
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return result;
|
|
12146
|
+
return { ...result, structuredContent: parsed };
|
|
12147
|
+
} catch {
|
|
12148
|
+
return result;
|
|
12149
|
+
}
|
|
12150
|
+
}
|
|
12119
12151
|
function httpErrorPayload(path, res, data) {
|
|
12120
12152
|
const objectData = data && typeof data === "object" && !Array.isArray(data) ? data : null;
|
|
12121
12153
|
const rawCode = objectData?.code ?? objectData?.errorCode ?? objectData?.error_code;
|
|
@@ -12726,8 +12758,8 @@ var HttpMcpToolExecutor = class {
|
|
|
12726
12758
|
commonsGetProposal(input) {
|
|
12727
12759
|
return this.getJson(`/commons/proposals/${encodeURIComponent(input.proposalId)}`);
|
|
12728
12760
|
}
|
|
12729
|
-
commonsHostImage(input) {
|
|
12730
|
-
return this.call("/commons/images", input);
|
|
12761
|
+
async commonsHostImage(input) {
|
|
12762
|
+
return attachJsonStructuredContent(await this.call("/commons/images", input));
|
|
12731
12763
|
}
|
|
12732
12764
|
commonsUpdateEditorialArticle(input) {
|
|
12733
12765
|
const { idempotencyKey, ...body } = input;
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
downloadAsset,
|
|
5
5
|
embedCommonsTexts,
|
|
6
6
|
publicizeExtractionFailure
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-LN6N3YLK.js";
|
|
8
8
|
import "./chunk-OZJMVCDK.js";
|
|
9
9
|
import {
|
|
10
10
|
computeIssues,
|
|
@@ -18,12 +18,12 @@ import {
|
|
|
18
18
|
createSiteExtractContentReader,
|
|
19
19
|
createSiteExtractImageArtifact,
|
|
20
20
|
extractJobLimitInfo
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-LCGTNWOT.js";
|
|
22
22
|
import "./chunk-DNM65UCK.js";
|
|
23
23
|
import "./chunk-AYJHI2FK.js";
|
|
24
24
|
import {
|
|
25
25
|
getDb
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-65FTMB7G.js";
|
|
27
27
|
|
|
28
28
|
// src/api/extract-bundle.ts
|
|
29
29
|
import { createWriteStream, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "fs";
|
package/dist/index.cjs
CHANGED
|
@@ -321,6 +321,12 @@ var PUBLIC_ERROR_CODES = [
|
|
|
321
321
|
"image_redirect_limit",
|
|
322
322
|
"image_base64_invalid",
|
|
323
323
|
"image_source_missing",
|
|
324
|
+
"image_source_ambiguous",
|
|
325
|
+
"image_source_type_invalid",
|
|
326
|
+
"image_artifact_not_found",
|
|
327
|
+
"image_page_too_large",
|
|
328
|
+
"page_image_not_found",
|
|
329
|
+
"page_image_candidates_unusable",
|
|
324
330
|
"image_format_unsupported",
|
|
325
331
|
"image_storage_unconfigured",
|
|
326
332
|
"featured_image_unhostable"
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
harvest
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-62LEXS5O.js";
|
|
4
4
|
import {
|
|
5
5
|
recordVendorUsage
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ES25GP6C.js";
|
|
7
7
|
import "./chunk-77LQV73B.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-65FTMB7G.js";
|
|
9
9
|
|
|
10
10
|
// src/video/VideoGenerator.ts
|
|
11
11
|
import { execSync as execSync2 } from "child_process";
|