Overview
The @atxp/client package is used to create MCP clients with OAuth authentication and payment processing via ATXP.This package depends on types and utilities from @atxp/common. All shared types like
Account, ClientArgs, AuthorizationData, PaymentData, and error types are documented in the common package.Installation
Client
atxpClient
ClientArgs
required
Configuration arguments for the client. See ClientArgs for detailed property information.
Promise<Client>
Returns an object that can be used to call tools on the MCP server, handling authorization and payment.
Payment flow
Payment flow
The payment callbacks handle the payment processing flow:
onPayment- Called when a payment is successfully processedonPaymentFailure- Called when a payment fails or is rejected
Callback functions should not throw unhandled exceptions as they may interrupt the payment flow. Always wrap callback logic in try-catch blocks when necessary.
- Without callbacks
- With callbacks
An example showing how to use the ATXP client without callbacks, passing in only the required arguments.
callTool
Promise<ToolResult> typed object that contains the result of the tool call.
Example usage
ATXPAccount
ATXPAccount
Account Types Moved to Separate Packages
v0.9.0+ Breaking Change: Blockchain-specific account types have been moved to dedicated packages as part of the modular architecture.
BaseAccount→ Moved to@atxp/baseSolanaAccount→ Moved to@atxp/solana(install withnpm install @atxp/solana)
@atxp/client package now focuses on essential features with zero blockchain code (except ATXPLocalAccount), resulting in reduced bundle sizes and eliminated security vulnerabilities for users who don’t need blockchain-specific functionality.