Search DevTools

Jump to any tool or page

CartAI MCP Server

Unexplored

Agentic checkout with or without a human in the loop, product catalog, and an agent wallet.

TheCartAI1 stars0 forksAI & Agents
View source

Install

Terminal

$npx -y cartai-mcp-server

mcp_config.json

{
  "mcpServers": {
    "ai-cartai-cartai-mcp-server": {
      "env": {
        "CARTAI_API_KEY": "${CARTAI_API_KEY}"
      },
      "args": [
        "-y",
        "cartai-mcp-server"
      ],
      "command": "npx"
    }
  }
}

Documentation

CartAI MCP Server

CartAI is agentic checkout infrastructure for platforms. One API places orders on merchant sites with no human in the loop. When a checkout needs something it does not have, such as a verification code, an address or a payment detail, it pauses, asks the customer and finishes the order. The merchant stays the merchant of record.

CartAI Powered MCP Server for autonomous product discovery, agentic payments, and checkout. Sign up and try it on the CartAI Portal →


Table of Contents


What is MCP?

Model Context Protocol is an open standard that lets AI assistants call external tools — APIs, databases, file systems — through a common interface. Think of it like a USB-C port for AI: one standard, any device. This server plugs CartAI's checkout capability into that port.


What this server does

ToolDescription
create_checkoutStart an async checkout for one or more product URLs
create_search_checkoutStart an async checkout from product names on a given merchant — no URLs needed
get_checkoutFetch the current state of a checkout task
cancel_checkoutCancel an in-progress checkout
get_status_historyGet the full step-by-step event log for a task
send_interactive_inputsSend an MFA/OTP code to a checkout task that is waiting for it
search_productsDiscover products by name across merchants
get_product_detailsRetrieve detailed info, variants, and pricing for a product URL
get_checkout_estimatesCompute pre-checkout shipping and tax estimates before placing an order
create_payment_sessionCreate a hosted payment session URL for the customer to authorize their card
delete_payment_sessionInvalidate a payment session
get_payment_credentialsRetrieve a scoped payment credential for an authorized payment session
create_credential_sessionCreate a secure vault URL where the customer stores their merchant login

Under the hood every tool maps 1-to-1 to a CartAI REST endpoint — the MCP server is a thin, type-safe bridge with no additional logic.


Prerequisites

RequirementVersion / Notes
Node.js>= 18.0.0 (uses native fetch and ES modules)
CartAI API keyObtain from the CartAI Admin Portal — see API Docs for full reference
MCP hostClaude Desktop, Cursor, VS Code (with MCP extension), or MCP Inspector

Installation

Run with npx (recommended)

You do not need to clone the repo. Point your MCP client at npx -y cartai-mcp-server and set CARTAI_API_KEY. See Configuration.

Local development

# 1. Clone the repo
git clone https://github.com/TheCartAI/cartai-mcp-server.git
cd cartai-mcp-server

# 2. Install dependencies
npm install

# 3. Set your API key
export CARTAI_API_KEY=your_api_key_here

# 4. Verify it starts
npm start
# → [cartai-mcp] Running on stdio ✓

Never commit your API key. The repo ships with a .gitignore that excludes .env.


Configuration

The snippets below use npx. To run a local clone instead, set "command" to node and "args" to ["/absolute/path/to/cartai-mcp-server/src/index.js"].

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "cartai": {
      "command": "npx",
      "args": ["-y", "cartai-mcp-server"],
      "env": {
        "CARTAI_API_KEY": "your_api_key_here"
      }
    }
  }
}

Restart Claude Desktop. You should see the CartAI tools in the tool picker.


Cursor

Add the following to ~/.cursor/mcp.json, or to .cursor/mcp.json in a project:

{
  "mcpServers": {
    "cartai": {
      "command": "npx",
      "args": ["-y", "cartai-mcp-server"],
      "env": {
        "CARTAI_API_KEY": "your_api_key_here"
      }
    }
  }
}

VS Code

Install the MCP extension for VS Code, then add the following to your .vscode/mcp.json (or user-level settings.json under "mcp.servers"):

{
  "servers": {
    "cartai": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "cartai-mcp-server"],
      "env": {
        "CARTAI_API_KEY": "your_api_key_here"
      }
    }
  }
}

Reload the VS Code window. The CartAI tools will be available to any MCP-aware agent running in the editor.


MCP Inspector

MCP Inspector is the official browser-based tool for testing and debugging MCP servers without needing a full AI client.

# Run Inspector against this server in one command
npx @modelcontextprotocol/inspector npx -y cartai-mcp-server

Set the API key in the Environment Variables panel inside Inspector (CARTAI_API_KEY = your_api_key_here), then use the Tools tab to call create_checkout, get_checkout, etc. interactively.

MCP Inspector is the fastest way to validate tool inputs/outputs before wiring up a full client.


Tools

Checkout tools

create_checkout

Creates a new async checkout task from product page URLs. CartAI runs the checkout in the background and emits status updates via webhooks. Multi-merchant carts are split into one task per merchant.

Required inputs:

FieldTypeDescription
customerobjectCustomer contact, addresses, shipping method, and payment — see Customer object
tasks[].urlstring (URI)Full product page URL
tasks[].quantityintegerUnits to purchase (min 1)

Optional inputs:

FieldTypeDefaultDescription
tasks[].selectedVariant.colorstring—Variant color
tasks[].selectedVariant.sizestring—Variant size
optionsobject—Checkout behaviour flags — see Checkout options
addons.couponCodestring[]—Coupon / promo codes to apply, e.g. ["SUMMER15"]

Returns: a groupId and a tasks[] list — one entry per merchant with taskId, executionId, merchant, initial status (queued), and a liveUrl to watch the checkout run live.


create_search_checkout

Creates an async checkout task from product names instead of URLs. Give it the merchant website and a list of item names — the CartAI agent searches the merchant's catalog, resolves each item (and any selected variant), assembles the cart, and completes shipping, payment and order confirmation in one call.

When to use: this is the go-to tool when the user already knows what they want to buy and from which store (e.g. "order X, Y and Z from Kylie Cosmetics"). There's no need to call search_products first.

Required inputs:

FieldTypeDescription
customerobjectSame as create_checkout — see Customer object
merchantstring (URI)Merchant website URL, e.g. https://kyliecosmetics.com/
itemList[].namestringProduct name to search for on the merchant's site

Optional inputs:

FieldTypeDefaultDescription
itemList[].quantityinteger1Units to purchase (min 1)
itemList[].selectedVariantobject—Free-form key/value pairs using the option names shown on the merchant's site, e.g. { "Shade": "candy k" } or { "Color": "Black", "Size": "M" }
optionsobject—Same as create_checkout — see Checkout options
addons.couponCodestring[]—Coupon / promo codes to apply

Returns: same shape as create_checkout — groupId plus taskId, merchant, status, and liveUrl per task.


Customer object

Shared by create_checkout and create_search_checkout.

FieldTypeDescription
customer.contact.firstNamestring—
customer.contact.lastNamestring—
customer.contact.phonestringDigits, spaces, hyphens, leading + (7–20 chars)
customer.contact.emailstring—
customer.shippingAddress.addressLine1string—
customer.shippingAddress.addressLine2string—
customer.shippingAddress.citystring—
customer.shippingAddress.provincestringState/province code e.g. NY
customer.shippingAddress.postalCodestringZIP or postal code
customer.shippingAddress.countrystringCountry code e.g. US
customer.billingAddressobjectSame shape as shippingAddress
customer.shippingMethod.strategystringe.g. "cheapest" | "fastest" | "standard"
customer.payment.data.sessionIdstringAgentic payments: sessionId from create_payment_session, after the customer has authorized their card. No provider needed.
customer.payment.providerstringSet to "test" to pass raw card details (cardNumber, cvv, name, expiryMonth, expiryYear) in data instead of a sessionId
Checkout options

All flags default to false.

FieldDescription
options.verifyBeforePlacementAgent asks for confirmation just before placing the order
options.useSavedCredentialToLoginAgent signs in to the merchant using credentials stored via create_credential_session
options.useGuestCheckoutIfLoginFailsIf the stored credentials don't work, fall back to guest checkout when the merchant offers it
options.allowInteractionInteractive flow instead of fire-and-forget — the agent can pause and request input (e.g. an OTP via send_interactive_inputs)
options.allowPartialCheckoutIf some items fail (e.g. out of stock), still complete checkout for the remaining items

get_checkout

Retrieves the full state of a checkout task.

Required: taskId — returned by create_checkout or create_search_checkout.

Tip: hook this to a CartAI webhook event rather than polling.

Returns: current status, merchant, execution iterations, derivedDetails (pricing, shipping method, selected shipping option), addons, and the original customer and task data.


cancel_checkout

Cancels an in-progress checkout task.

Required: taskId

Returns: Confirmation that the checkout task has been stopped and will not proceed further.


get_status_history

Returns the full step-by-step event log for a checkout task.

Required: taskId

Returns: a data[] list of steps, each with status (the checkout step, e.g. CREDIT_CARD_INPUT, ORDER_CONFIRMED), systemStatus (e.g. IN_PROGRESS, FAILED), createdAt, isFailed, note, creditsConsumed, and retryCount.


send_interactive_inputs

Sends input from the customer to a checkout task that is paused and waiting for it. Only applies to tasks created with options.allowInteraction: true. Currently the only supported input is an MFA/OTP code.

Required inputs:

FieldTypeDescription
taskIdstringID of the checkout task that is waiting for input
otpstringThe OTP/MFA code, 4–8 characters (surrounding spaces are trimmed)

Optional inputs:

FieldTypeDefaultDescription
intentstring"mfa"Type of input being sent. Supported: mfa

Returns: confirmation message and the task's updated status (e.g. mfa_received).

Errors: 400 bad intent / OTP length / extra fields · 403 task belongs to another account or is past the OTP stage · 404 task not found · 409 an OTP was already submitted for this task.


Catalog tools

search_products

Searches for products by name across merchants. Returns ranked results with pricing, images, and purchase links.

When to use: for discovery — browsing, comparing, or exploring products before deciding what to buy. If the user already has a list of products to buy from a specific store, use create_search_checkout instead.

Required inputs:

FieldTypeDescription
namestringProduct name or search query

Optional inputs:

FieldTypeDescription
merchantstringMerchant name to prioritize results (e.g. "Macy's"). Other retailers are still returned.

Returns: Ranked products[] each with name, brand, merchant, image, priceFrom, currency, and directUrl (use as url in create_checkout or get_product_details). Also returns targetMerchant and targetMatchCount.


get_product_details

Retrieves detailed product information for a given product page URL, including all available variants, pricing, and availability.

Required inputs:

FieldTypeDescription
urlstring (URI)Full product page URL

Optional inputs:

FieldTypeDescription
allVariantsbooleanWhen true, returns all available variants (color, size, etc.)

Returns: Product metadata (name, brand, retailer, image, url), directUrl, canCheckout (login / guest modes the retailer supports), variant dimensions (e.g. ["Color", "Size"]), and a variants[] list with per-variant variantId, price, available, image, attributes, url, and monetizationUrl.


get_checkout_estimates

Computes a pre-checkout cost estimate for a given merchant, destination ZIP, and list of items — before placing an order.

Required inputs:

FieldTypeDescription
merchantstringMerchant name to estimate costs for (e.g. "Alo Yoga")
destination.zipstringDestination ZIP code
items[].urlstring (URI)Product page URL
items[].quantityintegerNumber of units (min 1)
items[].unitPricenumberPrice per unit (e.g. from get_product_details)
items[].categorystringProduct category, e.g. "clothing"

Returns: subtotal, shipping, shippingKnown, tax, taxKnown, total, currency, the resolved destination (zip, state, country), and a per-item items[] breakdown with lineSubtotal and tax.


Payment tools

create_payment_session

Creates a hosted payment session and returns a secure URL for the customer to authorize their card. The session automatically starts Visa Intelligent Commerce or Mastercard Agent Pay based on the card on file for the customer's email — no additional integration required.

The tool result includes the session url as a clickable markdown link — present it as-is (a clickable "Open" button) rather than rewriting or reformatting it, so the customer can click through to authorize their card.

Required inputs:

FieldTypeDescription
emailstringCustomer's email address
pricestringPayment amount in USD, no currency symbol, e.g. "700"
purposestringWhat the payment is for (e.g. agent name or product) — shown to the customer

Optional inputs:

FieldTypeDefaultDescription
currencystring"USD"Currency code
expirystring (ISO 8601)1 week from creationWhen the session URL stops being valid
merchantUrlstring—Website URL of the merchant the payment is for
merchantNamestring—Display name of the merchant the payment is for

Returns: sessionId, a hosted url (formatted as a clickable link for the customer), mode (production / test), created_at, and the session's authorization details (price, currency, purpose, expiry).


delete_payment_session

Deletes an existing payment session. Once deleted, the hosted payment URL stops working and payment credentials can no longer be retrieved for the session.

Required: sessionId — returned by create_payment_session.

Returns: confirmation message. Returns 404 if the session doesn't exist.


get_payment_credentials

Retrieves a scoped payment credential for a session the customer has authorized. The credential is an agentic PAN from Visa Intelligent Commerce or Mastercard Agent Pay, or a card from the customer's Stripe Link wallet. It is limited to the approved amount and merchant. The customer's real card number is never returned.

Required inputs:

FieldTypeDescription
sessionIdstringThe sessionId returned by create_payment_session

Optional inputs:

FieldTypeDescription
merchantUrlstringWebsite URL of the merchant the credentials will be used on

Returns: type (e.g. "card") and info with cardNumber, cvv, expiryMonth, and expiryYear.


Credential tools

create_credential_session

Creates a credential vault session for a merchant and returns a secure URL where the customer stores their login for that merchant. Checkouts created with options.useSavedCredentialToLogin: true then sign in with those credentials.

Required inputs:

FieldTypeDescription
merchantDomainstringMerchant website URL the credentials belong to, e.g. https://saltiebeauty.com
emailstringCustomer's email address

Returns: iframeUrl (presented as a clickable link for the customer) and expiresIn — session validity in minutes.


Example prompts

Once the server is connected, try these in Claude:

I want to buy the Velvet Brew Eau De Parfum Pen Spray, the Face Brush Trio,
and 2 Blush Wood Eau De Parfum from Kylie Cosmetics.
Ship to Carol Sturka, 609 Royal Crest Dr, Richardson TX 75081.
Show me some high-rise jeans, preferably from Macy's.
Order 2 units of htt

Sourced from the repository README.

More in AI & Agents