@certscore/mcp 0.2.21 → 0.2.22
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 +43 -7
- package/dist/adoption.d.ts +7 -0
- package/dist/adoption.d.ts.map +1 -0
- package/dist/adoption.js +23 -0
- package/dist/certscore-mcp.mjs +657 -251
- package/dist/response-capture.d.ts +3 -0
- package/dist/response-capture.d.ts.map +1 -1
- package/dist/response-capture.js +29 -4
- package/dist/response-guidance.d.ts +4 -0
- package/dist/response-guidance.d.ts.map +1 -0
- package/dist/response-guidance.js +100 -0
- package/dist/server.d.ts +5 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +120 -27
- package/dist/tools.d.ts +7 -1
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +55 -19
- package/package.json +1 -1
- package/server-light.json +1 -1
- package/server.json +2 -2
package/dist/tools.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import { apiV2GpcResponseSchema } from "@certscore/api-contracts";
|
|
1
|
+
import { apiV2GpcResponseSchema, apiV2ChoicePathExecutionSchema } from "@certscore/api-contracts";
|
|
2
2
|
import { withResponseCapture, transferResponseCapture } from "./response-capture.js";
|
|
3
3
|
import { getCertScoreErrorContext, CertScoreError } from "@certscore/sdk";
|
|
4
4
|
function canonicalGpcObservationSummary(value) {
|
|
5
5
|
const parsed = apiV2GpcResponseSchema.safeParse(value);
|
|
6
6
|
return parsed.success && parsed.data.contractVersion === "certscore.gpc-response-assessment.v3" ? parsed.data.summary : null;
|
|
7
7
|
}
|
|
8
|
+
function canonicalChoicePathExecutionText(observation) {
|
|
9
|
+
const parsed = apiV2ChoicePathExecutionSchema.safeParse(observation.execution);
|
|
10
|
+
if (!parsed.success)
|
|
11
|
+
return null;
|
|
12
|
+
const execution = parsed.data;
|
|
13
|
+
return `execution=${execution.status}; click completed=${execution.clickCompleted}; observation completed=${execution.observationCompleted}; consent confirmed=${execution.consentConfirmed}.`;
|
|
14
|
+
}
|
|
8
15
|
const MAX_ERROR_RESPONSE_BODY_CHARS = 2_000;
|
|
9
16
|
export const MAX_EVIDENCE_PACKET_CHARS = 250_000;
|
|
10
17
|
const EVIDENCE_STRING_CHARS = 4_000;
|
|
@@ -15,12 +22,13 @@ const LEGAL_REVIEW_DISCLAIMER = "CertScore results are automated public-web obse
|
|
|
15
22
|
const SCAN_PROVENANCE_GROUNDING = "retrievalMode describes how the current tool response obtained the scan; creationDecision describes whether the original scan request created or reused a scan only when that decision is retained. Never infer an unknown creationDecision from scan_id_lookup. For a reused or retrieved existing scan, use only persisted scanFrom and timestamps. Never infer its original scan region from the current request, the user's location, or a default execution region. If persisted region or timestamps are unavailable, report them as unavailable.";
|
|
16
23
|
const INTERPRETATION_STATEMENT = "The CertScore score covers observable public-web scan signals only. Do not infer technologies that are not listed in the returned evidence or any legal compliance status.";
|
|
17
24
|
const SCAN_BUNDLE_RESPONSE_CONTRACT = `Response contract: Report only observed CertScore evidence and CertScore classifications. criticality, priority, and confidence are CertScore metadata; regulatory review lenses are non-determinative CertScore review context—not legal severity, legal exposure, or a compliance determination. Absence of captured consent-action evidence does not establish what happens after Accept, Reject, or Decline. A confirmed post-action observation with termination.kind=evidence_satisfied means the observer intentionally stopped after retaining qualifying evidence; do not treat that termination as uncertainty about the returned observation. Keep any separately returned coverage limitation scoped to what was not measured. Do not extrapolate an observed embed, vendor, or request into unobserved cookies, fingerprinting, tracking, or processing, and do not infer violations or compliance beyond what CertScore observed. ${SCAN_PROVENANCE_GROUNDING}`;
|
|
25
|
+
const CHOICE_PATH_INTERPRETATION_STATEMENT = "Count execution.status succeeded and succeeded_with_confirmation as successful paths, with confirmation as a separate subset. A click alone is insufficient; registered paths may omit afterAction. Missing legacy execution remains unavailable. ";
|
|
18
26
|
const SCAN_BUNDLE_INTERPRETATION_STATEMENT = "Report only observed CertScore evidence and persisted CertScore classifications. For gpcResponse, use only GPC response, No observable GPC response, or indeterminate; do not call the result a GPC violation or say GPC was not honored. Keep its jurisdiction-neutral comparison separate from any explicitly returned California scoring policy. Without corresponding captured post-action evidence, do not infer what Accept, Reject, Decline, or another consent action would do; say the scan does not establish what happens after that action. When postAcceptObservation or postRefusalObservation is confirmed and termination.kind is evidence_satisfied, state the returned observation directly and explain that observation stopped intentionally after qualifying evidence was retained. Do not characterize that termination as uncertainty about the observation; mention unmeasured longer-term persistence only when relevant. Treat post-Accept activity as a score-neutral behavior baseline unless a separately projected finding says otherwise. Do not speculate that an observed embed, vendor, or request may cause additional cookies, fingerprinting, tracking, or processing unless CertScore observed that behavior. Treat returned priority or severity as a CertScore classification, not regulatory criticality or legal exposure; prefer ‘observed privacy risk signal’ or ‘CertScore finding’. Do not infer unobserved technologies, legal compliance, or a legal violation from scores or findings.";
|
|
19
27
|
const COMPACT_SCAN_BUNDLE_INTERPRETATION_STATEMENT = "Use only returned CertScore observations and classifications. Do not infer unobserved technologies, post-consent behavior, legal compliance, or violations. Treat priority and severity as CertScore metadata.";
|
|
20
28
|
const OBSERVATION_ONLY_DISCLAIMER = `${LEGAL_REVIEW_DISCLAIMER} No-go, not-observed, and limited-coverage results are not proof of compliance.`;
|
|
21
29
|
const COMPACT_OBSERVATION_ONLY_DISCLAIMER = "Automated public-web observation, not legal advice or a compliance determination; missing or limited evidence is not proof of compliance.";
|
|
22
30
|
const PREVIEW_OBSERVATION_ONLY_DISCLAIMER = "Preliminary passive observations only; not findings, a score, or a final result.";
|
|
23
|
-
const SUCCESSFUL_BUNDLE_TRIAL_CTA = "Optional user follow-up: To try CertScore with an account, start a 7-day CertScore trial at https://certscore.ai/login?mode=create_account&utm_source=mcp_light&utm_medium=agent&utm_campaign=scan_bundle. Paid plans add scan history, higher limits, and team or production access. OAuth-capable clients can use https://mcp.certscore.ai/mcp after account authorization
|
|
31
|
+
const SUCCESSFUL_BUNDLE_TRIAL_CTA = "Optional user follow-up: To try CertScore with an account, start a 7-day CertScore trial at https://certscore.ai/login?mode=create_account&utm_source=mcp_light&utm_medium=agent&utm_campaign=scan_bundle. Paid plans add scan history, higher limits, and team or production access. OAuth-capable clients can use https://mcp.certscore.ai/mcp after account authorization; active workspace members receive self-serve scan access; Light remains no-auth.";
|
|
24
32
|
const MCP_SCAN_CREATION_POLL_DELAY_SECONDS = 15;
|
|
25
33
|
const MCP_QUEUED_POLL_DELAY_SECONDS = 10;
|
|
26
34
|
const MCP_RUNNING_POLL_DELAY_SECONDS = 5;
|
|
@@ -100,7 +108,7 @@ export function toToolError(error, context = {}) {
|
|
|
100
108
|
const status = error instanceof CertScoreError ? error.status : undefined;
|
|
101
109
|
const retryable = typeof terminalError?.retryable === "boolean"
|
|
102
110
|
? terminalError.retryable
|
|
103
|
-
: status === 429 || (typeof status === "number" && status >= 500);
|
|
111
|
+
: (error instanceof Error && error.name === "TimeoutError") || status === 429 || (typeof status === "number" && status >= 500);
|
|
104
112
|
const retryAfterSeconds = typeof terminalError?.retryAfterSeconds === "number"
|
|
105
113
|
? terminalError.retryAfterSeconds
|
|
106
114
|
: error instanceof CertScoreError && "retryAfterSeconds" in error && typeof error.retryAfterSeconds === "number"
|
|
@@ -120,10 +128,10 @@ export function toToolError(error, context = {}) {
|
|
|
120
128
|
? reasonCode === "non_public_target"
|
|
121
129
|
? "Ask for a publicly reachable HTTP or HTTPS website, then call certscore_scan_site with that URL. Do not retry this private or ineligible target or try to bypass the public-target checks."
|
|
122
130
|
: 'Check the spelling and DNS of the intended hostname, then call certscore_scan_site with the actual public website URL, for example {"url":"https://example.com"}. A bare domain is accepted, but example.com and www.example.com are different hostnames; use www only if it is the intended site. Do not repeat the same invalid request. If the correct URL is unclear, ask the user.'
|
|
123
|
-
:
|
|
124
|
-
?
|
|
125
|
-
:
|
|
126
|
-
?
|
|
131
|
+
: creationRateLimit
|
|
132
|
+
? `No scan was created. Wait at least ${retryAfterSeconds ?? 30} seconds before retrying. To answer now, use certscore_get_latest_domain_scan if an existing scan meets the user's needs. Do not reconnect or create duplicate requests to bypass a quota.`
|
|
133
|
+
: typeof terminalError?.recommendedNextAction === "string"
|
|
134
|
+
? terminalError.recommendedNextAction
|
|
127
135
|
: retryable
|
|
128
136
|
? `Wait ${retryAfterSeconds ?? 30} seconds, then retry the same request. Stop and contact support@certscore.ai if the error repeats.`
|
|
129
137
|
: "Correct the request using the error details, then retry only if the requested operation is still appropriate.";
|
|
@@ -135,9 +143,13 @@ export function toToolError(error, context = {}) {
|
|
|
135
143
|
retryable: targetRejected ? false : retryable,
|
|
136
144
|
retryAfterSeconds: targetRejected ? null : retryAfterSeconds,
|
|
137
145
|
recommendedNextAction,
|
|
146
|
+
...((status === 403 || status === 429) ? { upgradeSupportEmail: "support@certscore.ai" } : {}),
|
|
147
|
+
...(context.scanCreation && status === 403 ? { scanStarted: false, alternativeTool: "certscore_get_latest_domain_scan" } : {}),
|
|
138
148
|
...(targetRejected ? { field: "url", scanStarted: false, inputCorrectionRequired: true } : {}),
|
|
139
149
|
...(creationRateLimit
|
|
140
|
-
? { creationRateLimit
|
|
150
|
+
? { creationRateLimit, scanStarted: false, quotaConsumed: false,
|
|
151
|
+
alternativeTool: "certscore_get_latest_domain_scan",
|
|
152
|
+
recovery: { action: "wait_for_quota", retryAfterSeconds, requiresReauthorization: false } }
|
|
141
153
|
: {}),
|
|
142
154
|
...(error instanceof CertScoreError ? {
|
|
143
155
|
name: error.name,
|
|
@@ -795,6 +807,10 @@ export function findingsFromReport(report) {
|
|
|
795
807
|
export function exportFindings(report) {
|
|
796
808
|
return {
|
|
797
809
|
type: "certscore_mcp_findings_export",
|
|
810
|
+
exportVersion: "certscore.findings-export.v1",
|
|
811
|
+
exportedAt: new Date().toISOString(),
|
|
812
|
+
returnedFindingCount: findingsFromReport(report).length,
|
|
813
|
+
completeness: "canonical findings returned by the report; not a complete inventory of website behavior",
|
|
798
814
|
scanId: scanIdFromPulse(report),
|
|
799
815
|
domain: report.domain ?? report.request?.domain ?? null,
|
|
800
816
|
summary: report.summary ?? null,
|
|
@@ -973,7 +989,11 @@ function findingText(finding, priorityLabel = "criticality") {
|
|
|
973
989
|
const nextStep = typeof finding.nextStep === "string" && finding.nextStep.trim()
|
|
974
990
|
? `; canonical next step=${boundedText(finding.nextStep.trim(), 180)}`
|
|
975
991
|
: "";
|
|
976
|
-
|
|
992
|
+
const identity = typeof finding.id === "string" ? `; findingId=${finding.id}` : "";
|
|
993
|
+
if (finding.plainEnglish == null && evidence.summary == null) {
|
|
994
|
+
return `- ${finding.label ?? finding.id ?? "Projected finding"}${identity}; ${priorityLabel}=${finding.criticality ?? "unknown"}; confidence=${finding.confidence ?? "unknown"}; description and evidence detail are not included in this response tier.`;
|
|
995
|
+
}
|
|
996
|
+
return `- ${finding.label ?? finding.id ?? "Projected finding"}${identity}; ${priorityLabel}=${finding.criticality ?? "unknown"}; confidence=${finding.confidence ?? "unknown"}; observation=${finding.plainEnglish ?? evidence.summary ?? "No compact description available"}; evidence=${evidence.basis ?? "unknown"}/${evidence.phase ?? "phase unknown"}: ${evidence.summary ?? "No compact evidence summary available"}; review lenses=${lenses}${nextStep}.`;
|
|
977
997
|
}
|
|
978
998
|
function executiveOverviewText(summary) {
|
|
979
999
|
if (!summary)
|
|
@@ -1109,6 +1129,9 @@ function terminalLaneResultTextLines(value) {
|
|
|
1109
1129
|
? value[field]
|
|
1110
1130
|
: null;
|
|
1111
1131
|
if (observation && typeof observation.interpretation === "string") {
|
|
1132
|
+
const execution = canonicalChoicePathExecutionText(observation);
|
|
1133
|
+
if (execution)
|
|
1134
|
+
lines.push(`${label} execution: ${execution}`);
|
|
1112
1135
|
lines.push(`${label}: ${observation.interpretation}`);
|
|
1113
1136
|
}
|
|
1114
1137
|
}
|
|
@@ -1298,7 +1321,10 @@ export function pulseReportText(value, label = "CertScore report") {
|
|
|
1298
1321
|
const body = [
|
|
1299
1322
|
...(overview ? [overview] : []),
|
|
1300
1323
|
`Canonical projected findings returned in this ${label.toLocaleLowerCase()}: ${findings.length}.`,
|
|
1301
|
-
...findings.map((finding) => findingText(finding))
|
|
1324
|
+
...findings.map((finding) => findingText(finding)),
|
|
1325
|
+
...(findings.some((finding) => finding.plainEnglish == null && finding.evidence?.summary == null)
|
|
1326
|
+
? [`For finding descriptions and evidence, call certscore_list_findings with scanId=${scanId}, or certscore_explain_finding with that scanId and a returned findingId. No new scan is needed.`]
|
|
1327
|
+
: [])
|
|
1302
1328
|
];
|
|
1303
1329
|
return boundedResultText(`${label} for ${domain}; scanId=${scanId}${score === null ? "" : `; CertScore score=${score}`}.`, body, value);
|
|
1304
1330
|
}
|
|
@@ -1308,15 +1334,19 @@ export function markdownReportText(value) {
|
|
|
1308
1334
|
const excerpt = markdown.length > excerptLimit ? `${markdown.slice(0, excerptLimit)}\n…[markdown truncated for MCP TextContent]` : markdown;
|
|
1309
1335
|
return boundedResultText(`CertScore report for scanId=${extractScanId(value) ?? "unknown"}. The following is a bounded canonical report excerpt.`, excerpt ? [excerpt] : ["No Markdown report body was returned."], value);
|
|
1310
1336
|
}
|
|
1311
|
-
export function scanBundleText(bundle) {
|
|
1337
|
+
export function scanBundleText(bundle, options = {}) {
|
|
1312
1338
|
const noGoText = canonicalNoGoText(bundle);
|
|
1313
1339
|
if (noGoText)
|
|
1314
1340
|
return noGoText;
|
|
1315
1341
|
const score = typeof bundle.score === "number" ? `; CertScore score=${bundle.score}` : "";
|
|
1316
|
-
const footer = [SUCCESSFUL_BUNDLE_TRIAL_CTA, OBSERVATION_ONLY_DISCLAIMER, SCAN_BUNDLE_INTERPRETATION_STATEMENT];
|
|
1342
|
+
const footer = [...(options.lightTrialCta ? [SUCCESSFUL_BUNDLE_TRIAL_CTA] : []), OBSERVATION_ONLY_DISCLAIMER, SCAN_BUNDLE_INTERPRETATION_STATEMENT];
|
|
1317
1343
|
const lines = [
|
|
1318
1344
|
SCAN_BUNDLE_RESPONSE_CONTRACT,
|
|
1319
1345
|
`CertScore scan bundle for ${bundle.domain ?? "unknown domain"}; status=${bundle.status ?? "unknown"}${score}; scanId=${bundle.scanId ?? "unknown"}.`,
|
|
1346
|
+
`Risk: ${bundle.riskLevel ?? "unknown"}. Finding IDs (returned): ${Array.isArray(bundle.findings) ? bundle.findings.slice(0, 20).map((finding) => String(finding.id ?? "unknown").slice(0, 120)).join(", ") || "none" : "unavailable"}.`,
|
|
1347
|
+
bundle.preConsentCookiesTrackers
|
|
1348
|
+
? `Pre-consent inventory: total=${bundle.preConsentCookiesTrackers.total ?? "unknown"}; returned=${bundle.preConsentCookiesTrackers.rows?.length ?? "unknown"}. Counts describe retained coverage, not consent compliance.`
|
|
1349
|
+
: `Pre-consent inventory: ${bundle.mcpMetadata?.omittedSections?.includes("preConsentCookiesTrackers") ? "omitted to fit the response byte limit" : "not included in this response"}. Call certscore_get_pre_consent_cookies_trackers with scanId=${bundle.scanId ?? "unknown"} for retained rows and counts; no new scan is needed.`,
|
|
1320
1350
|
canonicalScanProvenanceText(bundle),
|
|
1321
1351
|
`Full report: ${bundle.reportUrl ?? (bundle.scanId ? `https://certscore.ai/scan/${encodeURIComponent(String(bundle.scanId))}` : "not available")}.`
|
|
1322
1352
|
];
|
|
@@ -1357,6 +1387,9 @@ export function scanBundleText(bundle) {
|
|
|
1357
1387
|
const intentionalEvidenceStop = termination?.kind === "evidence_satisfied" && termination.intentional === true
|
|
1358
1388
|
? " The observation then stopped intentionally because qualifying evidence had been captured."
|
|
1359
1389
|
: "";
|
|
1390
|
+
const execution = canonicalChoicePathExecutionText(postAccept);
|
|
1391
|
+
if (execution)
|
|
1392
|
+
append(`Accept Path execution: ${execution}`);
|
|
1360
1393
|
append(`Accept Path: ${postAccept.interpretation}${intentionalEvidenceStop}`);
|
|
1361
1394
|
for (const limitation of Array.isArray(postAccept.coverageLimitations)
|
|
1362
1395
|
? postAccept.coverageLimitations.slice(0, 3)
|
|
@@ -1374,6 +1407,9 @@ export function scanBundleText(bundle) {
|
|
|
1374
1407
|
const intentionalEvidenceStop = termination?.kind === "evidence_satisfied" && termination.intentional === true
|
|
1375
1408
|
? " The observation then stopped intentionally because qualifying evidence had been captured."
|
|
1376
1409
|
: "";
|
|
1410
|
+
const execution = canonicalChoicePathExecutionText(postRefusal);
|
|
1411
|
+
if (execution)
|
|
1412
|
+
append(`Reject Path execution: ${execution}`);
|
|
1377
1413
|
append(`Reject Path: ${postRefusal.interpretation}${intentionalEvidenceStop}`);
|
|
1378
1414
|
for (const limitation of Array.isArray(postRefusal.coverageLimitations)
|
|
1379
1415
|
? postRefusal.coverageLimitations.slice(0, 3)
|
|
@@ -1438,9 +1474,6 @@ export function scanBundleText(bundle) {
|
|
|
1438
1474
|
append(`${rows.length - rowsRendered} additional returned pre-consent row${rows.length - rowsRendered === 1 ? " was" : "s were"} omitted from TextContent to preserve the size limit; see structuredContent or the report URL.`);
|
|
1439
1475
|
}
|
|
1440
1476
|
}
|
|
1441
|
-
else {
|
|
1442
|
-
append("No row-level pre-consent inventory was available for this result; review coverage and limitations before interpreting absence.");
|
|
1443
|
-
}
|
|
1444
1477
|
lines.push(...footer);
|
|
1445
1478
|
return lines.join("\n");
|
|
1446
1479
|
}
|
|
@@ -1572,9 +1605,10 @@ export function buildScanBundle(input) {
|
|
|
1572
1605
|
postAcceptObservation: input.scan.postAcceptObservation ?? null,
|
|
1573
1606
|
postRefusalObservation: input.scan.postRefusalObservation ?? null,
|
|
1574
1607
|
provenance: scanProvenance(input.scan, "existing_scan_retrieved"),
|
|
1575
|
-
interpretationGuidance: interpretationGuidance(input.scan.
|
|
1576
|
-
|
|
1577
|
-
|
|
1608
|
+
interpretationGuidance: interpretationGuidance((input.scan.postAcceptObservation || input.scan.postRefusalObservation ? CHOICE_PATH_INTERPRETATION_STATEMENT : "") +
|
|
1609
|
+
(input.scan.gpcResponse?.contractVersion === "certscore.gpc-response-assessment.v3"
|
|
1610
|
+
? SCAN_BUNDLE_INTERPRETATION_STATEMENT.replace("For gpcResponse,", "For the paired gpcResponse.status,") + " Report the separate bounded observation, CMP-recorded state and directly observed requests. Observation completion does not mean GPC was honored."
|
|
1611
|
+
: SCAN_BUNDLE_INTERPRETATION_STATEMENT)),
|
|
1578
1612
|
resultDisposition: input.scan.resultDisposition ?? null,
|
|
1579
1613
|
noGo: input.scan.noGo ?? null,
|
|
1580
1614
|
coverage: input.scan.coverage ?? null,
|
|
@@ -1755,7 +1789,9 @@ export function buildScanBundle(input) {
|
|
|
1755
1789
|
}
|
|
1756
1790
|
if (bundle.mcpMetadata.actualBytes > maxBytes) {
|
|
1757
1791
|
markBudgetOmitted("duplicateGuidance", "guidance_compacted_to_preserve_priority_content");
|
|
1758
|
-
bundle.interpretationGuidance = interpretationGuidance(
|
|
1792
|
+
bundle.interpretationGuidance = interpretationGuidance((bundle.postAcceptObservation || bundle.postRefusalObservation
|
|
1793
|
+
? "Both execution success statuses count; confirmation is separate. Missing execution is unavailable. " : "") +
|
|
1794
|
+
COMPACT_SCAN_BUNDLE_INTERPRETATION_STATEMENT);
|
|
1759
1795
|
bundle.observationOnlyDisclaimer = COMPACT_OBSERVATION_ONLY_DISCLAIMER;
|
|
1760
1796
|
bundle.disclaimer = null;
|
|
1761
1797
|
refresh();
|
package/package.json
CHANGED
package/server-light.json
CHANGED
package/server.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"url": "https://github.com/ergoveritas1-alt/certscore.ai",
|
|
9
9
|
"source": "github"
|
|
10
10
|
},
|
|
11
|
-
"version": "0.2.
|
|
11
|
+
"version": "0.2.22",
|
|
12
12
|
"remotes": [
|
|
13
13
|
{
|
|
14
14
|
"type": "streamable-http",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"registryType": "npm",
|
|
21
21
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
22
22
|
"identifier": "@certscore/mcp",
|
|
23
|
-
"version": "0.2.
|
|
23
|
+
"version": "0.2.22",
|
|
24
24
|
"transport": {
|
|
25
25
|
"type": "stdio"
|
|
26
26
|
},
|