21:import { IntentsLedger, mountIntents, intentsGate, intentsConfig, intentsKey } from './intents.js'; 22:export { Experiments, IntentsLedger }; 33:const llmsAlso = () => `\n## MCP\n\n- Remote MCP server (Streamable HTTP): POST /mcp on this host. Tools: the endpoints above, same prices; pay with the x402 MCP transport (_meta["x402/payment"]).\n- NEAR Intents (where GET /v1/intents answers 200): pay any endpoint with any token NEAR Intents 1Click routes (e.g. wNEAR). HTTP: POST /v1/intents/quote, fund depositAddress, then send header X-Intents-Deposit. MCP: free tool near_intents_quote, fund depositAddress, then tools/call with params._meta["near-intents/deposit"]. One deposit = one successful call; a replay returns 409 INTENTS_DEPOSIT_USED.\n\n## Also from ScrapeMole\n\n${ALSO_FROM_SCRAPEMOLE.map((e) => `- ${e.method}: ${e.url} (from $${e.priceUsd} per result on Apify): ${e.summary}`).join('\n')}\n`; 130: console.log(`${c.req.method} ${new URL(c.req.url).pathname} ${c.res.status} ${Date.now() - t}ms${paid ? ' paid-header' : ''}${c.get('owner') ? ' owner' : ''}${c.get('trial') ? ' free-trial' : ''}${c.res.headers.get('payment-response') ? ' SETTLED' : ''}${c.get('intents') ? ' SETTLED near-intents' : ''}`); 167: // NEAR Intents rail (intents.js): pay for any paid endpoint with any token 1Click can route. Off unless configured. 168: const intentsInputKey = (ep, sp) => { const q = {}; for (const [k, v] of sp) q[k] = k in q ? [].concat(q[k], v) : v; return stable(ep.toInput(q)); }; 169: mountIntents(app, env, { endpoints: ENDPOINTS, inputKey: intentsInputKey, origin: (c) => new URL(c.req.url).origin }); 195: // NEAR Intents payment (X-Intents-Deposit header): verified against 1Click status, consumed only by a 200. 196: if (c.req.header('x-intents-deposit')) { 198: try { key = intentsInputKey(ep, new URL(c.req.url).searchParams); } catch (err) { return json(c, { error: { code: err.code || 'BAD_INPUT', message: err.message, charged: false } }, 400); } 199: const gate = await intentsGate(c, env, ep, key); 243: // Body only (the x402 header stays standard): the alternative NEAR Intents rail, when configured. 244: const ic = intentsConfig(env); 245: const body = ic ? { ...pr, nearIntents: { network: ic.network, quote: `${new URL(c.req.url).origin}/v1/intents/quote`, docs: `${new URL(c.req.url).origin}/v1/intents`, header: 'X-Intents-Deposit' } } : pr; 284: intents: () => Boolean(intentsConfig(env)), 289: return json(c, { $schema: 'https://static.modelcontextprotocol.io/schemas/mcp-server-card/v1.json', version: '1.0', protocolVersion: '2025-06-18', serverInfo: { name: 'scrapemole', title: 'ScrapeMole', version: '1.0.0' }, description: 'Pay-per-call public web data for agents (YouTube search, channel, playlist, video details, comments, transcript; Google Trends; Amazon product). x402 USDC on Base; failed calls are never charged.', websiteUrl: docs.SERVICE.website, transport: { type: 'streamable-http', endpoint: `${origin}/mcp` }, capabilities: { tools: { listChanged: false } }, authentication: { required: false, schemes: [] }, payments: { protocol: 'x402', version: 2, transport: 'mcp _meta["x402/payment"]', ...(intentsConfig(env) ? { nearIntents: { quoteTool: 'near_intents_quote', transport: 'mcp _meta["near-intents/deposit"]', http: `${origin}/v1/intents` } } : {}) } }); 297:const envKey = (e) => `${e.SVM_PAY_TO}|${e.PAY_TO}|${e.NETWORK}|${e.FACILITATOR_URL}|${e.PUBLIC_URL}|${e.DISABLED_ENDPOINTS}|${e.FACILITATOR}|${intentsKey(e)}`; 348:const KNOWN_PATHS = new Set(['/ab/e', '/ab/stats', '/ab/reset', '/', '/health', '/openapi.json', '/.well-known/x402', '/llms.txt', '/terms', '/robots.txt', '/.well-known/402index-verify.txt', '/.well-known/mcp/server-card.json', '/mcp', '/v1/intents', '/v1/intents/quote']);