Get started
Installation
Install the CLI and the library, and add only the optional peers for the rails you use.
One package ships two things: the agent-commerce CLI (init, import, validate, doctor, demo) and a library for embedding the gateway in your own process. It requires Node ≥ 22.
Install the CLI
npx @devlab.group/agent-commerce --help # no install neededA default install is about 65 MB and pulls no blockchain or wallet dependencies at all. About 17 MB of that is the OpenAPI parser behind import openapi, because onboarding an existing API is the CLI's main job.
Optional peers
The MCP adapter, the x402 provider and AP2 verification live on their own subpaths, because each needs a dependency the rest of the package does not. Install only the rails you use.
| You want | Install | Import from |
|---|---|---|
| gateway, config, receipts, CLI | @devlab.group/agent-commerce | @devlab.group/agent-commerce |
| resources as MCP tools | @modelcontextprotocol/sdk | @devlab.group/agent-commerce/mcp |
| accept x402 payments | @x402/core @x402/evm viem | @devlab.group/agent-commerce/x402 |
| verify AP2 mandates | jose @sd-jwt/core canonicalize | @devlab.group/agent-commerce/ap2 |
| CDP facilitator auth | @coinbase/x402 | no import — loaded on demand |
npm install @devlab.group/agent-commerce @modelcontextprotocol/sdk @x402/core @x402/evm viemimport { mcp } from '@devlab.group/agent-commerce/mcp';
import { x402 } from '@devlab.group/agent-commerce/x402';
import { ap2 } from '@devlab.group/agent-commerce/ap2';Peers are pinned exactlyx402's schemas and EIP-712 domains cross the package boundary, so a version skew is a correctness problem. Import a subpath without its peer installed and Node fails at load, naming the missing package — rather than starting a gateway that silently serves nothing.
Avoid @coinbase/x402 if you canIt is loaded only when
facilitator.auth.type: cdp is configured, and brings @coinbase/cdp-sdk and axios, which carry high-severity advisories. auth.type: bearer covers any facilitator with a static token and installs nothing.Entry points
| Import | Exports |
|---|---|
@devlab.group/agent-commerce | createGateway, loadConfig, parseConfig, receipts, createAcpAdapter, canonical types and error codes |
…/mcp | mcp (alias of createMcpAdapter) |
…/x402 | x402 (alias of createX402PaymentProvider), createPaymentProof, SUPPORTED_NETWORK_IDS |
…/ap2 | ap2 (alias of createAp2AuthorizationProvider), createCheckoutJwt, AP2 constants |
Verify the install
agent-commerce --version # the CLI version
agent-commerce version # plus every pinned protocol and SDK versionNext: run the local demo or go straight to the integration guide.