Use this page when a Node.js process, not a person, holds the wallet: a backend calling a paid API, a CI job, an agent. The flow is the same as in the browser; only the signing function changes.

Sign with a key from the environment

Any offer above the cap is refused with SpendLimitExceededError before your signing function runs. You can also restrict assets, networks and recipients: spend controls.

A runnable LocalNet example

Quickstart step 5 runs localnet/js_pay.mjs: it funds an account from LocalNet’s KMD, pays a 402 from localnet/server_for_js.py (5,000 microALGO on port 9221), checks the exact balance drop, and shows an over-cap demand being refused.
The server answers 200 with a PAYMENT-RESPONSE header that carries the settlement result, including the transaction id.

Calling MCP tools from Node

x402-avm-js builds and signs payments; it has no MCP client transport. To call paid MCP tools, use paid_mcp_session from Python, or read the tool call’s 402 and pay it yourself.

Next

  • Networks: presets, LocalNet ids and private networks.
  • Identity: prove which address is calling.