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 openapi, validate, start, doctor, reconcile, resolve, backup, demo, version) 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 needed

The default install excludes the optional protocol, payment and authorization peers, so it pulls no blockchain or wallet dependencies. The OpenAPI parser behind import openapi is a regular dependency, because import is part of the CLI.

Optional peers

The MCP adapter, the x402 and MPP providers and AP2 verification live on their own subpaths, because each needs a dependency the rest of the package does not. A gateway serving free HTTP resources installs none of them. Install only the rails you use.

You wantInstallImport from
gateway, config, receipts, A2A/ACP, CLI@devlab.group/agent-commerce@devlab.group/agent-commerce
resources as MCP tools@modelcontextprotocol/server@devlab.group/agent-commerce/mcp
accept x402 payments@x402/core @x402/evm viem@devlab.group/agent-commerce/x402
accept x402 on Solanax402 peers + @x402/svm @solana/kitno import — loaded for a Solana offer
accept x402 on NEARx402 peers + @x402/nearno import — loaded for a NEAR offer
accept MPP paymentsmppx viem @x402/core @x402/evm@devlab.group/agent-commerce/mpp
verify AP2 mandates, sign checkout JWTsjose @sd-jwt/core canonicalize@devlab.group/agent-commerce/ap2
CDP facilitator auth@coinbase/x402no import — loaded on demand

The x402 entry needs @x402/core, @x402/evm and viem even when every offer is on Solana or NEAR. MPP settles through an x402 facilitator, so its entry also needs the x402 peers.

MCP + x402bash
npm install @devlab.group/[email protected] @modelcontextprotocol/[email protected] @x402/[email protected] @x402/[email protected] [email protected]
typescript
import { mcp } from '@devlab.group/agent-commerce/mcp';
import { x402 } from '@devlab.group/agent-commerce/x402';
import { mpp } from '@devlab.group/agent-commerce/mpp';
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.
Install @coinbase/x402 only for CDPIt is loaded only when facilitator.auth.type: cdp is configured, and it adds @coinbase/cdp-sdk, axios and a Solana dependency tree. Audit that installation before you use it. auth.type: bearer covers any facilitator with a static token and installs nothing.

Entry points

ImportExports
@devlab.group/agent-commercecreateGateway, loadConfig, parseConfig, receipts (alias of createSqliteReceiptStore), createA2aAdapter, createAcpAdapter, canonical types and error codes
…/mcpmcp (alias of createMcpAdapter)
…/x402x402 (alias of createX402PaymentProvider), createPaymentProof, SUPPORTED_NETWORK_IDS
…/mppmpp (alias of createMppPaymentProvider), MPP profile and spec constants
…/ap2ap2 (alias of createAp2AuthorizationProvider), createCheckoutJwt, AP2 constants
…/testingreceiptStoreConformanceCases for a custom ReceiptStore (experimental); imports no test runner or SQLite driver

Verify the install

bash
agent-commerce --version   # the CLI version
agent-commerce version     # plus every pinned protocol and SDK version

Next: run the local demo or go straight to the integration guide.