agents
Version:
A home for your AI agents
123 lines (121 loc) • 3.8 kB
TypeScript
import {
n as LegacyCallToolResultSchema,
t as CompatibleMcpClient
} from "../../invoker-CG0_p_Wq.js";
import { ZodRawShape } from "zod";
import {
CallToolRequest,
CallToolRequestOptions
} from "@modelcontextprotocol/client";
import {
CallToolResult,
ToolAnnotations
} from "@modelcontextprotocol/sdk/types.js";
import {
McpServer,
RegisteredTool,
ToolCallback
} from "@modelcontextprotocol/sdk/server/mcp.js";
import {
FacilitatorConfig,
FacilitatorConfig as FacilitatorConfig$1
} from "@x402/core/server";
import {
Network,
Network as Network$1,
PaymentRequired,
PaymentRequirements,
PaymentRequirements as PaymentRequirements$1
} from "@x402/core/types";
import {
ClientEvmSigner,
ClientEvmSigner as ClientEvmSigner$1
} from "@x402/evm";
//#region src/mcp/client/x402.d.ts
/**
* Normalize a network identifier to CAIP-2 format.
* Accepts both legacy v1 names ("base-sepolia") and CAIP-2 ("eip155:84532").
*/
declare function normalizeNetwork(network: string): Network$1;
type X402Config = {
/**
* Network identifier.
* Accepts both legacy names ("base-sepolia") and CAIP-2 format ("eip155:84532").
*/
network: string /** Payment recipient address */;
recipient: `0x${string}` /** Facilitator configuration. Defaults to https://x402.org/facilitator */;
facilitator?: FacilitatorConfig$1 /** @deprecated No longer used in v2. The protocol version is determined automatically. */;
version?: number;
};
interface X402AugmentedServer {
paidTool<Args extends ZodRawShape>(
name: string,
description: string,
priceUSD: number,
paramsSchema: Args,
annotations: ToolAnnotations,
cb: ToolCallback<Args>
): RegisteredTool;
}
declare function withX402<T extends McpServer>(
server: T,
cfg: X402Config
): T & X402AugmentedServer;
interface X402AugmentedClient {
callTool(
x402ConfirmationCallback:
| ((payment: PaymentRequirements$1[]) => Promise<boolean>)
| null,
params: CallToolRequest["params"],
options?: CallToolRequestOptions
): Promise<CallToolResult>;
/**
* @deprecated Prefer the request-options overload. Explicit legacy result
* schemas remain honored through the SDK v2 request funnel.
*/
callTool(
x402ConfirmationCallback:
| ((payment: PaymentRequirements$1[]) => Promise<boolean>)
| null,
params: CallToolRequest["params"],
resultSchema: LegacyCallToolResultSchema,
options?: CallToolRequestOptions
): Promise<CallToolResult>;
}
type X402ClientConfig = {
/**
* EVM account/signer for signing payment authorizations.
* Use `privateKeyToAccount()` from viem/accounts to create one.
*/
account: ClientEvmSigner$1;
/**
* Preferred network identifier (optional).
* Accepts both legacy names ("base-sepolia") and CAIP-2 format ("eip155:84532").
* When set, the client prefers payment requirements matching this network.
* If omitted, the client automatically selects from available requirements.
*/
network?: string /** Maximum payment value in atomic units (default: 0.10 USDC = 100000) */;
maxPaymentValue?: bigint /** @deprecated No longer used in v2. The protocol version is determined automatically. */;
version?: number /** Confirmation callback for payment approval */;
confirmationCallback?: (payment: PaymentRequirements$1[]) => Promise<boolean>;
};
declare function withX402Client<T extends CompatibleMcpClient>(
client: T,
x402Config: X402ClientConfig
): X402AugmentedClient & T;
//#endregion
export {
type ClientEvmSigner,
type FacilitatorConfig,
type Network,
type PaymentRequired,
type PaymentRequirements,
X402AugmentedClient,
X402AugmentedServer,
X402ClientConfig,
X402Config,
normalizeNetwork,
withX402,
withX402Client
};
//# sourceMappingURL=x402.d.ts.map