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.
87 lines • 3.59 kB
TypeScript
/**
* Single audit surface for the optional paid-fetch dependency stack.
*
* Every `viem` / `@x402/*` / `mppx` import the SDK performs flows through
* this file. Concentrating the imports here lets a reviewer enumerate the
* SDK's direct attack surface to those packages from one place, and lets
* the package.json declare them as `optionalPeerDependencies` — consumers
* who never make on-chain paid requests do not need to install them.
*
* Adding a new import here is the only way to grow the surface; doing so
* also widens what consumers must install to enable paid fetch. Keep this
* list minimal. When a symbol is small enough to inline (e.g. the
* `viem/chains` constants are ~5-line objects), prefer inlining over
* adding a new dependency edge.
*/
type FetchFn = typeof globalThis.fetch;
export declare class PaidStackUnavailable extends Error {
readonly missingPackages: readonly string[];
constructor(missing: readonly string[]);
}
export interface X402Stack {
privateKeyToAccount: (pk: `0x${string}`) => unknown;
createPublicClient: (opts: unknown) => {
readContract: (args: unknown) => Promise<bigint>;
};
http: (url?: string) => unknown;
base: unknown;
baseSepolia: unknown;
x402Client: new () => {
setSpendControls?: (controls: unknown) => unknown;
register: (network: string, scheme: unknown) => void;
registerPolicy: (fn: (version: number, reqs: unknown[]) => unknown[]) => void;
createPaymentPayload: (required: unknown) => Promise<unknown>;
};
wrapFetchWithPayment: (fetch: FetchFn, client: unknown) => FetchFn;
ExactEvmScheme: new (signer: unknown) => unknown;
toClientEvmSigner: (account: unknown, client: unknown) => unknown;
offerReceipt: {
extractOffersFromPaymentRequired: (required: unknown) => unknown[];
decodeSignedOffers: (offers: unknown[]) => unknown[];
findAcceptsObjectFromSignedOffer: (offer: unknown, accepts: unknown[]) => unknown | undefined;
isEIP712SignedOffer: (offer: unknown) => boolean;
isEIP712SignedReceipt: (receipt: unknown) => boolean;
verifyOfferSignatureEIP712: (offer: unknown) => Promise<{
signer: `0x${string}`;
payload: Record<string, unknown>;
}>;
verifyReceiptSignatureEIP712: (receipt: unknown) => Promise<{
signer: `0x${string}`;
payload: Record<string, unknown>;
}>;
extractReceiptFromResponse: (response: Response) => unknown | undefined;
};
}
export interface MppStack {
privateKeyToAccount: (pk: `0x${string}`) => unknown;
Mppx: {
create: (opts: unknown) => {
fetch: FetchFn;
};
};
tempo: (opts: unknown) => unknown;
}
export declare function loadX402Stack(): Promise<X402Stack>;
export interface LightningStack {
Challenge: {
deserialize: (value: string) => {
method: string;
intent: string;
expires?: string;
request?: Record<string, unknown>;
};
serialize: (challenge: unknown) => string;
};
Credential: {
from: (parameters: {
challenge: unknown;
payload: unknown;
}) => unknown;
serialize: (credential: unknown) => string;
};
}
/** The MPP challenge/credential codecs the Lightning rail needs (no Tempo, no viem). */
export declare function loadLightningStack(): Promise<LightningStack>;
export declare function loadMppStack(): Promise<MppStack>;
export {};
//# sourceMappingURL=_paid-stack.d.ts.map