diff --git a/app/api/v1/paid/[product]/route.ts b/app/api/v1/paid/[product]/route.ts index 65076eb..ad850c3 100644 --- a/app/api/v1/paid/[product]/route.ts +++ b/app/api/v1/paid/[product]/route.ts @@ -24,6 +24,136 @@ function paymentRequired(req: NextRequest, product: NonNullable ({ + ...tool, + priority: index + 1, + product_id: index === 0 ? primaryProductId : `${vendorId}-${tool.name}`, + why: index === 0 + ? 'Best first paid surface: clear value, low integration risk, and easy preview flow.' + : 'Useful follow-up once the first paid route is live and measurable.', + })), + pricing: { + model: 'per-call USDC on Base', + starter_price: candidates[0]?.suggested_price_usdc || '$0.05-$0.25', + affiliate_bps: 2500, + note: 'Start cheap enough for buyer agents to test, then add higher-priced deep-analysis tools.', + }, + x402_route_shape: { + unpaid_request: `GET ${candidates[0]?.route || '/api/paid/tool'} returns HTTP 402`, + retry_headers: ['X-PAYMENT', 'X-PAYMENT-TX'], + accepts_fields: ['x402Version', 'scheme', 'network', 'asset', 'maxAmountRequired', 'resource', 'payTo'], + network: 'base', + asset: 'USDC', + }, + catalog_metadata: { + vendor_id: vendorId, + product_id: primaryProductId, + category: targetType === 'github-repository' ? 'devtools' : 'mcp', + tags: ['mcp', 'x402', 'paid-tools', 'base-usdc'], + endpoint: `https://your-service.example${candidates[0]?.route || '/api/paid/tool'}`, + affiliate_bps: 2500, + output_schema: { + type: 'object', + properties: { + result: { type: 'object' }, + routed_by: { const: 'pyrimid' }, + }, + }, + }, + risk_notes: [ + 'Keep a free preview tool so buyer agents can evaluate value before paying.', + 'Do not expose secrets, API keys, private repo data, or raw crawler credentials in paid output.', + 'Cache expensive upstream calls or set a price that covers model, crawling, and rate-limit costs.', + 'Return deterministic JSON with stable keys so agents can safely parse purchased results.', + ], + launch_checklist: [ + 'Add a preview_* MCP tool with schema, sample output, and price.', + 'Add one paid HTTP route that returns HTTP 402 with x402 accepts[] metadata.', + 'Accept X-PAYMENT or X-PAYMENT-TX on retry and verify payment before returning paid output.', + 'Publish llms.txt, agents.txt, and server card links to the paid route.', + 'Register vendor and product metadata in the Pyrimid catalog.', + ], + }; +} + function payload(productId: string, req: NextRequest, proof: string) { const query = Object.fromEntries(req.nextUrl.searchParams.entries()); @@ -65,17 +195,7 @@ function payload(productId: string, req: NextRequest, proof: string) { case 'mcp-server-audit': { const url = query.url || 'https://example.com/mcp'; return { - audit: { - url, - recommended_paid_tools: ['search', 'enrich', 'export', 'analyze'], - pricing: '$0.01-$0.25 per call depending on compute/data cost', - integration_steps: [ - 'Add 402 response with x402 accepts[] metadata', - 'Register vendor/product in Pyrimid catalog', - 'Expose tool schema in MCP server card', - 'Add affiliateBps for distribution agents', - ], - }, + audit: buildMcpServerAudit(url), }; } case 'x402-integration-plan': {