x402-surface-check 0.2.38 → 0.2.39
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 +1 -1
- package/bin/x402-surface-check.mjs +41 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ npx --yes x402-surface-check --strict-proof https://api.example.com/openapi.json
|
|
|
20
20
|
|
|
21
21
|
## What It Checks
|
|
22
22
|
|
|
23
|
-
- Manifest endpoint discovery from `items[]`, `endpoints[]`, object-valued `endpoints`, string-valued endpoint maps, `tools` maps, `resources[]`, `x402Endpoints`, category arrays, raw resource URL strings, method-prefixed resource strings, and OpenAPI paths
|
|
23
|
+
- Manifest endpoint discovery from `items[]`, `endpoints[]`, marketplace `skills[]` / `catalog.skills[]`, object-valued `endpoints`, string-valued endpoint maps, `tools` maps, `resources[]`, `x402Endpoints`, category arrays, raw resource URL strings, method-prefixed resource strings, and OpenAPI paths
|
|
24
24
|
- Streamable HTTP MCP tool catalogs via safe JSON-RPC `tools/list` probes with `Accept: application/json, text/event-stream`
|
|
25
25
|
- Object-valued manifest endpoint query examples, public catalog/discovery GETs, and payment-bearing two-phase operations without treating expected public catalog reads as failed payment gates
|
|
26
26
|
- Linked discovery documents via `discovery_url`, `discoveryUrl`, `resources_url`, `resourcesUrl`, string `discovery` links, nested `discovery.x402_json` / OpenAPI links, or manifest-level OpenAPI links
|
|
@@ -358,6 +358,24 @@ function manifestEndpointBody(endpoint, document) {
|
|
|
358
358
|
return exampleValue(body, document)
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
+
function marketplaceSkillBody(skill) {
|
|
362
|
+
return skill?.example?.input
|
|
363
|
+
?? skill?.exampleInput
|
|
364
|
+
?? skill?.input?.example
|
|
365
|
+
?? skill?.input?.safe_example
|
|
366
|
+
?? skill?.input?.safeExample
|
|
367
|
+
?? manifestEndpointBody(skill, {})
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
function marketplaceSkillPriceUsd(skill) {
|
|
371
|
+
const value = skill?.price?.amount
|
|
372
|
+
?? skill?.price?.usd
|
|
373
|
+
?? skill?.priceUsd
|
|
374
|
+
?? skill?.price_usd
|
|
375
|
+
?? skill?.pricePerCall
|
|
376
|
+
return numberFromDecimal(value)
|
|
377
|
+
}
|
|
378
|
+
|
|
361
379
|
function manifestEndpointUrl(rawPath, endpoint, baseUrl, sourceUrl) {
|
|
362
380
|
const url = new URL(endpointUrl(rawPath, baseUrl, sourceUrl))
|
|
363
381
|
const parameters = endpoint?.parameters
|
|
@@ -404,6 +422,29 @@ function endpointEntries(document, sourceUrl, limit) {
|
|
|
404
422
|
}
|
|
405
423
|
}
|
|
406
424
|
|
|
425
|
+
const marketplaceSkillLists = [
|
|
426
|
+
document.skills,
|
|
427
|
+
document.services,
|
|
428
|
+
document.catalog?.skills,
|
|
429
|
+
document.catalog?.services,
|
|
430
|
+
].filter(Array.isArray)
|
|
431
|
+
|
|
432
|
+
for (const skillList of marketplaceSkillLists) {
|
|
433
|
+
for (const skill of skillList) {
|
|
434
|
+
if (!skill || typeof skill !== 'object') continue
|
|
435
|
+
const rawPath = skill.endpoint ?? skill.url ?? skill.path
|
|
436
|
+
if (!rawPath) continue
|
|
437
|
+
if (redactedCredentialUrl(rawPath)) continue
|
|
438
|
+
entries.push({
|
|
439
|
+
name: skill.slug ?? skill.id ?? skill.name ?? String(rawPath).split('/').filter(Boolean).at(-1) ?? String(rawPath),
|
|
440
|
+
url: endpointUrl(rawPath, baseUrl, sourceUrl),
|
|
441
|
+
method: String(skill.method ?? 'POST').toUpperCase(),
|
|
442
|
+
expectedPriceUsd: marketplaceSkillPriceUsd(skill),
|
|
443
|
+
requestBody: marketplaceSkillBody(skill),
|
|
444
|
+
})
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
407
448
|
if (Array.isArray(document.endpoints)) {
|
|
408
449
|
for (const endpoint of document.endpoints) {
|
|
409
450
|
const rawPath = endpoint?.url ?? endpoint?.endpoint ?? endpoint?.path
|