UNPKG

run402-mcp

Version:

MCP server for Run402 — full-stack backend infrastructure for AI agents: Postgres, auth, storage, serverless functions and atomic deploys. Paid with x402/MPP. Includes $0.03 image generation.

40 lines • 2 kB
import { type PayExecutor } from "../namespaces/pay.js"; import { type PaymentAttemptStore } from "./payment-attempts.js"; import { type PaymentOffer } from "./payment-offers.js"; type FetchFn = typeof globalThis.fetch; /** The part of an mppx prepared payment this executor reads. */ export interface PreparedMppPayment { challenge: { id: string; method: string; intent: string; request: unknown; expires?: string; }; createCredential: () => Promise<string>; setCredential: (request: RequestInit, credential: string) => RequestInit; } export interface MppPayExecutorOptions { /** mppx `preparePayment` over the wallet's Tempo method; selection includes the balance ordering. */ prepare: (response: Response, request: RequestInit) => Promise<PreparedMppPayment>; /** The paying wallet's address. */ payer: string; baseFetch: FetchFn; /** Thrown when a 402 offers nothing this rail pays. */ unsupported: (offers: PaymentOffer[]) => Error; /** Stable identity of an identical request (URL, method, body, caps). */ fingerprint: (url: string, init: RequestInit | undefined, maxUsdMicros: number, requireReceipt: boolean) => Promise<string>; store?: PaymentAttemptStore; createAttemptId?: () => string; now?: () => string; sleep?: (ms: number) => Promise<void>; /** Tests only: trust a Run402 pending answer from `http://localhost`. */ allowTestLocalhost?: boolean; } /** Bounded waits for the gateway's "settlement still pending" answer to the paid request. */ export declare const MPP_PENDING_RETRY_LIMIT = 4; export declare function createMppPayExecutor(options: MppPayExecutorOptions): PayExecutor; /** Test seam: a stable fingerprint for callers without the paid-fetch one. */ export declare function simpleMppFingerprint(url: string, init: RequestInit | undefined, maxUsdMicros: number, requireReceipt: boolean): Promise<string>; export {}; //# sourceMappingURL=mpp-pay-executor.d.ts.map