MBA
All docs
MCP stdionpm: @marketbasketanalysis/mcp

MCP server

An MCP server that exposes the recommendations API as a tool any MCP-compatible agent can call. Works with Claude Desktop, Claude Code, the OpenAI Agent SDK, Cursor, Cline, and any other MCP stdio host.

Basket AI: four named agents

Basket AI is our agent surface. Four named agents group the eight MCP tools by job-to-be-done. The agents are a marketing layer for buyers and operators, your MCP host still discovers and calls the individual tool functions by name (get_recommendations, find_substitutes, and so on). All eight tools are registered with the agent host on first connection.

Discovery Agent

Surfaces what customers buy together and what they buy instead. Tools: get_recommendations, find_substitutes.

Bundle Agent

Proposes complete kits from a partial cart or RFQ. Tools: get_bundle_for_cart, propose_quote_bundle.

Insight Agent

Scores and audits proposed bundles before they ship. Tools: score_cross_sell, analyze_basket. (A score_return_risk tool is on the roadmap.)

Replenishment Agent

Predicts reorder cadence and proposes subscription kits. Tools: predict_reorder, propose_subscription_bundle.

The eight tools, by agent

Function signatures and behavior of every tool the MCP host registers.

Discovery Agent
get_recommendations(product_id: string, limit?: number)

Returns the top N complementary products customers also bought with the given product, derived from real co-purchase association rules mined from the merchant's order history.

find_substitutes(product_id: string, limit?: number)

For a given product, return the top items that could replace it, not complement it. The inverse of get_recommendations. Each result includes a similarity score and a reason code (context_similar, category_match, vendor_match). Critical for B2B procurement agents resolving unavailable SKUs without escalating to a human.

Bundle Agent
get_bundle_for_cart(product_ids: string[], limit?: number)

Given a multi-item cart, returns the products most likely to complete a high-confidence kit. Aggregates per-product recommendations by “pairs with multiple cart items × average confidence.”

B2B
propose_quote_bundle(seed_product_ids: string[], complement_limit?: number)

Given the seed products in an RFQ / quote / requisition, returns a fleshed-out bundle proposal: seeds plus complementary products that pair with the cart as a whole, plus a seed-set cohesion score.

Insight Agent
score_cross_sell(product_a: string, product_b: string)

Validates a proposed (a, b) pair. Returns the merchant's real co-purchase confidence for the pair plus a strength verdict: strong, moderate, weak, or no signal.

analyze_basket(product_ids: string[])

Scores the overall cohesion of a proposed basket / bundle on a 0..1 scale. Returns coverage (% of pairs with statistical signal), average confidence of matched pairs, and an overall cohesion = coverage × avg_confidence verdict.

Replenishment Agent
predict_reorder(customer_id: string)

Given a customer ID, returns predicted next-purchase dates per product. Built for reorder-reminder agents and subscription cadence pre-population. Shopify first; WooCommerce + Magento ports in flight.

propose_subscription_bundle(customer_id: string, limit?: number)

Given a customer's first-order items, propose a recurring subscription kit tuned to their predicted reorder cadence. The subscription-segment-aware bundle proposal.

Notify me when new MCP tools ships

We ship a new MCP tool roughly monthly. score_return_risk and propose_visual_bundle are next. Get a one-line email when each one lands.

One email when it ships. No drip campaign.

1. Mint an API key

In the MBA admin on your platform, open API keys, click Create key, and copy the plaintext mba_live_.... It's shown once.

2. Add to your MCP host

Claude Desktop / Claude Code

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or the equivalent path on your OS:

{
  "mcpServers": {
    "marketbasketanalysis": {
      "command": "npx",
      "args": ["-y", "@marketbasketanalysis/mcp"],
      "env": {
        "MBA_API_KEY": "mba_live_YOUR_KEY_HERE"
      }
    }
  }
}

Restart Claude Desktop / Claude Code. The marketbasketanalysis server should appear in the tools list.

Cursor

Open Settings → Features → MCP, click Add server, and paste the same shape:

{
  "mcpServers": {
    "marketbasketanalysis": {
      "command": "npx",
      "args": ["-y", "@marketbasketanalysis/mcp"],
      "env": {
        "MBA_API_KEY": "mba_live_YOUR_KEY_HERE"
      }
    }
  }
}

Cline / Continue / other MCP hosts

Use the same command (npx -y @marketbasketanalysis/mcp) and pass MBA_API_KEY as an environment variable. The exact UI varies by host; consult your host's MCP docs.

OpenAI Agent SDK

import { Agent } from "@openai/agent-sdk";

const agent = new Agent({
  mcpServers: [
    {
      command: "npx",
      args: ["-y", "@marketbasketanalysis/mcp"],
      env: { MBA_API_KEY: process.env.MBA_API_KEY },
    },
  ],
  // ...
});

3. Try it

In Claude Desktop, paste:

Use marketbasketanalysis to find what customers also buy with product 8472918765.

Claude will invoke the get_recommendations tool, parse the structured JSON response, and surface the top complementary products in plain English. No prompt engineering required, the tool description is written so the agent picks it for natural co-purchase phrasings.

Environment variables

VariableRequiredDefault
MBA_API_KEYYes,
MBA_API_BASENohttps://app.marketbasketanalysis.com

Source

Ready to turn your order data into revenue?

Install on your platform in under 10 minutes. Or book a consulting call and we'll do the launch for you.