Skip to content

MCP Server (AI Agents)

The @swft-checkout/mcp package exposes a Model Context Protocol server that lets AI agents — Claude, GPT-4o, Gemini, or any MCP-compatible runtime — interact with Swft directly. Agents can browse products, inspect analytics, check cart recovery stats, and place orders on behalf of customers.

Terminal window
npm install -g @swft-checkout/mcp

Or run without installing:

Terminal window
npx @swft-checkout/mcp

The MCP server reads your API key from the environment:

Terminal window
export SWFT_API_KEY=sk_swft_live_xxxxxxxxxxxxxxxx

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

{
"mcpServers": {
"swft": {
"command": "npx",
"args": ["-y", "@swft-checkout/mcp"],
"env": {
"SWFT_API_KEY": "sk_swft_live_xxxxxxxxxxxxxxxx"
}
}
}
}

Restart Claude Desktop after saving. You should see “swft” listed in the MCP tools panel.

Returns checkout funnel metrics for the merchant over a given period.

Parameters:

NameTypeDescription
periodstring7d, 30d, 90d, or ISO date range (2026-01-01/2026-03-31)
breakdownstringOptional. template, device, country, source

Example output:

{
"sessions": 4821,
"completions": 2341,
"conversionRate": 0.486,
"revenue": 142850.00,
"avgOrderValue": 61.02,
"topDropOffStep": "payment"
}

Lists recent checkout sessions with status, cart value, and completion state. Useful for diagnosing drop-off.

Parameters:

NameTypeDescription
statusstringall, completed, abandoned, recovering
limitnumberMax results (default 20, max 100)
cursorstringPagination cursor from previous response

Returns the full merchant config: enabled modules, active template, connected Stripe account, and plan details.

Parameters: none.


Returns cart recovery email performance: send rate, open rate, click rate, and recovered revenue.

Parameters:

NameTypeDescription
periodstring7d, 30d, 90d

Searches the merchant’s WooCommerce product catalogue. Returns product name, SKU, price, stock status, and image URL.

Parameters:

NameTypeDescription
querystringSearch term
limitnumberMax results (default 10)
inStockbooleanFilter to in-stock only
categorystringWooCommerce category slug

Creates a Swft checkout session and returns a URL the customer can be directed to. This is the tool an AI agent uses to place an order on behalf of a customer.

Parameters:

NameTypeDescription
lineItemsarrayProduct ID / variation ID + quantity pairs
customerobjectPre-fill: email, name, billing address
couponstringOptional coupon code to apply
b2bbooleanEnable B2B mode for this session
notestringOrder note added by the agent

Example:

{
"lineItems": [
{ "productId": 1842, "quantity": 1 }
],
"customer": {
"email": "[email protected]",
"firstName": "Jane",
"lastName": "Smith"
},
"note": "Placed via AI agent on behalf of customer"
}

Returns:

{
"sessionId": "sess_xxxxxxxx",
"checkoutUrl": "https://checkout.swft.co.uk/s/sess_xxxxxxxx",
"expiresAt": "2026-04-26T14:30:00Z"
}

Here is an example conversation where an AI agent uses the MCP tools to complete a purchase:

User: Can you order me two tins of the Columbian Dark Roast and apply the WELCOME10 discount?

Agent (internal): Calls swft_get_products with query: "Columbian Dark Roast" → gets product ID 2091, price £8.50, in stock.

Calls swft_create_checkout with lineItems: [{productId: 2091, quantity: 2}], coupon: "WELCOME10", customer: {email: "[email protected]"}.

Returns checkout URL.

Agent: I’ve set up your order for 2 × Columbian Dark Roast (£15.30 after 10% discount). Complete payment here: [checkout link]. The link expires in 60 minutes.