Basket AI. Built for the
agents that buy.
Basket AI is our agent surface: four named agents (Discovery, Bundle, Insight, Replenishment) over eight typed MCP tools including substitution lookup. Real auth, SSRF-guarded base URL, timeout-bounded retries. Claude Desktop / Claude Code / Cursor / Cline / OpenAI Agent SDK all query the same recommendation API backed by the merchant's actual order history, not a hallucinated product catalog.
npm install @marketbasketanalysis/mcp · one snippet, one restart
LLMs are great at copy. Bad at recommendations.
Ask GPT-4 or Claude to recommend products for an ecommerce store and you'll get a plausible-looking list. Half the SKUs won't exist. The pairings won't match what customers actually buy together. The model doesn't know your catalog and has no way to learn it from a prompt.
MBA's MCP server is the missing tool. The agent callsget_recommendationsorget_bundle_for_cartand gets back real co-purchase rules from the merchant's order history, ranked by support / confidence / lift. The LLM's job is what it's good at, explaining or composing copy around those recommendations.
Basket AI: four named agents
Discovery, Bundle, Insight, and Replenishment. Each agent groups two-to-three MCP tools by job-to-be-done. Your MCP host still discovers and calls the individual tool functions by name.
Surfaces what customers buy together and what they buy instead. Powers the 'what goes with X?' and 'this SKU is unavailable, what's the fallback?' flows.
get_recommendationsfind_substitutesProposes complete kits from a partial cart or RFQ. Covers consumer pre-checkout upsell and B2B requisition flows on Magento.
get_bundle_for_cartpropose_quote_bundleScores and audits proposed bundles before they ship. Returns lift, confidence, and cohesion for any candidate basket. A score_return_risk tool is on the roadmap.
score_cross_sellanalyze_basketPredicts reorder cadence per customer and proposes subscription kits tuned to their predicted refresh schedule. Opens the subscription-segment surface.
predict_reorderpropose_subscription_bundleEight tools, fully typed
get_recommendationsGiven a product ID, return top N complement products by lift. Used in chat-style 'what goes with the X?' flows.
find_substitutesGiven a product ID, return top N items that could replace it when it's unavailable. Reason-coded by context similarity, category, vendor match.
get_bundle_for_cartGiven a list of cart items, propose a bundle that ranks high by support + confidence. Used in pre-checkout upsell flows.
propose_quote_bundleB2B-aware: given a customer ID + product set, propose a bundle tuned to that account's purchase history. Built for sales-rep agents on Magento B2B.
score_cross_sellGiven a candidate (product_a, product_b), return the lift + confidence. Used for 'should I bundle these?' decisions.
analyze_basketScore a cart's cohesion, how well its items move together historically. Useful for flagging mis-bundled carts.
predict_reorderGiven a customer ID, return predicted next-purchase dates per product. For reorder-reminder agents. Shopify first; cross-platform in flight.
propose_subscription_bundleGiven a customer's first-order items, propose a recurring kit tuned to their predicted reorder cadence. Subscription-segment-aware bundle proposal.
What makes this agent-safe
SSRF-guarded base URL
The MBA_API_BASE env var is validated against an allow-list: rejects loopback (127.0.0.1, ::1), link-local (169.254.0.0/16 metadata services), private networks, non-http(s) schemes. Operators can't accidentally point the agent at their own internal network.
Sanitized error surface
Errors returned to the agent are static strings: MBA API 401, MBA API unreachable. Upstream response bodies are logged to stderr only, never echoed back into the agent's context where they could leak rate-limit IDs or auth headers.
Real auth + per-integration revocation
Bearer API key minted in your MBA admin (Shopify, Magento, or WC). Hashed at storage; plaintext only shown once at creation. Revoke a single integration without affecting other agent hosts using the same store's data.
Runtime response validation
Every API response is zod-validated at the MCP boundary. Malformed payloads throw a sanitized error rather than silently passing undefined fields into the agent's reasoning step.
Install once, query from anywhere
Add the MCP server to your agent host's config. One snippet, one restart.
{
"mcpServers": {
"marketbasketanalysis": {
"command": "npx",
"args": ["-y", "@marketbasketanalysis/mcp"],
"env": {
"MBA_API_KEY": "mba_live_...",
"MBA_API_BASE": "https://your-shopify-store.fly.dev"
}
}
}
}Full MCP quick startRead the agentic-commerce buyer's guide
10-page free guide on what to ask vendors about MCP, agent-callable APIs, SSRF hardening, and where the buyer-side procurement agents actually land in 2026.
Read the guideReady 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.