DEV Community

BuyWhere
BuyWhere

Posted on

Build an AI Shopping Agent with BuyWhere MCP in 10 Minutes

AI agents are great at conversation, but terrible at shopping. Ask Claude "what's the best 4K monitor under $800 SGD?" and it'll give you a thoughtful essay — but no real prices, no real stock, and no way to actually buy anything.

That's because product data is locked inside e-commerce storefronts, scattered across platform-specific APIs, or hidden behind CAPTCHAs and rate limits. If you've tried to build an agent that answers real commerce questions with real prices, you know the pain.

BuyWhere fixes that. We're an agent-native product catalog API with an MCP server that indexes 1M+ products from Shopee, Lazada, Amazon SG, Carousell, FairPrice, Harvey Norman, Courts, Challenger, and 50+ merchants into a single endpoint.

One tool call. Real product data. No scraping.


What is MCP and why it matters

The Model Context Protocol (MCP) is an open standard that lets AI agents connect to external tools and data sources. Think of it as a USB-C port for AI — one universal connector, thousands of capabilities.

Before MCP, every agent framework had its own tool format. Claude used function calling, OpenAI used plugins, LangChain used its own tool interface. MCP standardizes all of that: any MCP-compatible client can use any MCP server.

For commerce agents, this is a game changer. Instead of building separate integrations for each merchant API, scraping HTML, maintaining parsers, and managing 50 API keys... you point your agent at one MCP server and get structured product data from 1M+ products across Singapore and Southeast Asia.


Setup: Add BuyWhere to your agent

Get your free API key

curl -X POST https://api.buywhere.ai/v1/auth/register -H "Content-Type: application/json" -d '{"agent_name": "my-shopping-agent"}'
Enter fullscreen mode Exit fullscreen mode

No credit card. No approval queue.

Add to Claude Desktop

{
  "mcpServers": {
    "buywhere": {
      "command": "npx",
      "args": ["@buywhere/mcp-server"],
      "env": { "BUYWHERE_API_KEY": "bw_free_..." }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Add to Cursor

Cursor settings → Features → MCP Servers → Add: npx -y @buywhere/mcp-server with BUYWHERE_API_KEY env.

Add to a custom TypeScript agent

import { Client } from "@modelcontextprotocol/sdk/client/index.js";

const client = new Client({ name: "my-shopping-agent", version: "1.0.0" });
await client.connect(new StdioClientProcess({
  command: "npx", args: ["@buywhere/mcp-server"],
  env: { BUYWHERE_API_KEY: "bw_free_..." },
}));
Enter fullscreen mode Exit fullscreen mode

Or via HTTP:

await fetch("https://api.buywhere.ai/mcp", {
  method: "POST",
  headers: { Authorization: "Bearer bw_free_...", "Content-Type": "application/json" },
  body: JSON.stringify({ jsonrpc: "2.0", method: "tools/call",
    params: { name: "search_products", arguments: { q: "wireless headphones", country_code: "SG", limit: 5 } } }),
});
Enter fullscreen mode Exit fullscreen mode

Search products — your first tool call

Ask your agent:

"Find me wireless headphones under $100 SGD on Shopee"

The agent calls:

Tool: search_products
Arguments: { q: "wireless headphones", max_price: 100, domain: "shopee", country_code: "SG", limit: 5 }
Enter fullscreen mode Exit fullscreen mode

Returns structured JSON with real prices, ratings, stock status, and merchant links.

Filter reference

Parameter Description
q Keyword search
domain shopee, lazada, amazon, etc.
country_code SG, US, VN, TH, MY
min_price / max_price Price range
category Laptops, Smartphones, etc.
compact Agent-optimized (smaller response)
limit Max 100, default 20

Pro tip: compact: true for agent-to-agent calls.


Compare prices and find deals

Get product details

Tool: get_product
Arguments: { id: "prod_8f3a2b1c" }
Enter fullscreen mode Exit fullscreen mode

Returns full specs, brand, category, merchant info.

Cross-merchant comparison

Tool: compare_products
Arguments: { ids: ["prod_X", "prod_Y", "prod_Z"] }
Enter fullscreen mode Exit fullscreen mode

Agent output: "Sony WH-1000XM5: $89.90 on Shopee, $94 on Lazada, $109 on Amazon SG. Shopee has the best price."

Deal discovery

Tool: get_deals
Arguments: { min_discount: 30, country: "SG", limit: 10 }
Enter fullscreen mode Exit fullscreen mode

Build a complete shopping agent

Full TypeScript agent using GPT-4o + BuyWhere MCP:

import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
import OpenAI from "openai";

const BUYWHERE_API_KEY = process.env.BUYWHERE_API_KEY!;

const transport = new StdioClientTransport({
  command: "npx", args: ["@buywhere/mcp-server"],
  env: { BUYWHERE_API_KEY },
});
const client = new Client({ name: "shopping-agent", version: "1.0.0" });
await client.connect(transport);
const { tools } = await client.listTools();
const openai = new OpenAI();

async function askShoppingAgent(query: string) {
  const messages = [
    { role: "system", content: "You are a shopping assistant. Use BuyWhere MCP tools. Cite real prices and merchants." },
    { role: "user", content: query },
  ];
  while (true) {
    const resp = await openai.chat.completions.create({
      model: "gpt-4o", messages,
      tools: tools.map(t => ({ type: "function", function: { name: t.name, description: t.description, parameters: t.inputSchema } })),
    });
    const choice = resp.choices[0];
    messages.push(choice.message);
    if (choice.message.tool_calls) {
      for (const call of choice.message.tool_calls) {
        const result = await client.callTool({ name: call.function.name, arguments: JSON.parse(call.function.arguments) });
        messages.push({ role: "tool", tool_call_id: call.id, content: JSON.stringify(result.content) });
      }
    } else return choice.message.content;
  }
}

console.log(await askShoppingAgent("Best laptop under $1500 SGD, compare Shopee/Lazada/Amazon SG"));
Enter fullscreen mode Exit fullscreen mode

Run: BUYWHERE_API_KEY=bw_free_... node agent.mjs


Deploy anywhere

Your agent works as CLI, Telegram bot, Express endpoint, or Slack command. Same MCP tools, any surface.


What's next

You just built an AI shopping agent that:

  • ✅ Searches 1M+ products across 50+ merchants
  • ✅ Compares prices in real-time
  • ✅ Finds deals and discounts
  • ✅ Works with Claude, GPT, or any LLM

All under 10 minutes. No scraping. No merchant integrations.

Resources: GitHub | API Docs | NPM | Smithery

Built something? Tag @buywherehq.


BuyWhere is the agent-native product catalog API for Southeast Asian commerce — one MCP endpoint for 1M+ products across 50+ merchants.


More BuyWhere Articles

More BuyWhere tutorials:


Star BuyWhere MCP on GitHub — the open-source product catalog API for AI agents.

Top comments (0)