Obtain an access token via the commercetools OAuth 2.0 token endpoint using client credentials (POST to https://auth.{region}.commercetools.com/oauth/token).
Create a cart via POST to https://api.{region}.commercetools.com/{projectKey}/carts with a CartDraft containing currency, country, and optionally customerId or anonymousId.
Add a line item via the addLineItem cart update action: POST to the cart's endpoint with version, actions: [{action: 'addLineItem', productId, variantId, quantity}].
Read lineItems[].totalPrice and totalPrice on the cart response to display pricing; prices are resolved from the product's embedded prices based on the cart's currency and country.
Use the addCustomLineItem action to add items without a catalog product (e.g., for fees or custom services) by specifying a name, quantity, money, and taxCategory.
Consult current commercetools Carts API docs for version conflict handling; every update requires sending the current cart version and increments it.
Known gotchas
Price resolution depends on the cart's currency and country matching an embedded price on the product variant; if no matching price exists, addLineItem will return a PriceNotFound error.
Cart version must be kept in sync: always use the version returned in the latest cart response when submitting updates, or you will receive a ConcurrentModification error.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp