MCP for Ecommerce Part 2: Build a Real Shopping Agent in 15 Minutes
Part 1 covered why ecommerce needs MCP infrastructure. This part shows you how to build an agent that actually shops.
You have an MCP server. You have product data. Now what?
This tutorial walks you through building a real AI shopping agent — one that searches products, compares prices across markets, and finds the best deals. All in 15 minutes.
What You'll Build
A shopping agent that can:
- Search for any product across 50M+ items
- Compare prices across US, Singapore, Japan, Korea markets
- Find active deals and promotions
- Return structured results your UI can render
Prerequisites
- Node.js 18+
- A free BuyWhere API key (get one here)
- An MCP client (Claude Desktop, Cursor, VS Code, or a custom agent)
Step 1: Install the MCP Server (30 seconds)
npx -y @buywhere/mcp-server
This starts the MCP server. It exposes 5 tools to any connected AI agent.
Step 2: Configure Your MCP Client (2 minutes)
Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"buywhere": {
"command": "npx",
"args": ["-y", "@buywhere/mcp-server"],
"env": {
"BUYWHERE_API_KEY": "your-api-key-here"
}
}
}
}
Cursor / VS Code
Add to .cursor/mcp.json:
{
"mcpServers": {
"buywhere": {
"command": "npx",
"args": ["-y", "@buywhere/mcp-server"],
"env": {
"BUYWHERE_API_KEY": "your-api-key-here"
}
}
}
}
Step 3: Your First Query (1 minute)
Ask your agent:
"Find me the best laptop under $1000 available in the US right now."
The agent will call search_products with filters and return real-time results.
Step 4: Cross-Market Price Comparison (3 minutes)
Now the interesting part. Ask:
"Compare the price of Sony WH-1000XM6 headphones across US, Singapore, and Japan. Show me the cheapest option including shipping estimates."
The agent calls compare_products across markets and returns a structured comparison.
Example response structure:
{
"comparisons": [
{
"market": "US",
"price": "$348.00",
"retailer": "Amazon",
"in_stock": true
},
{
"market": "Singapore",
"price": "SGD 459.00",
"retailer": "Shopee",
"in_stock": true
},
{
"market": "Japan",
"price": "¥42,800",
"retailer": "Rakuten",
"in_stock": true
}
]
}
Step 5: Deals & Promotions (2 minutes)
Ask:
"Show me active deals on gaming monitors this week. Sort by discount percentage."
The agent calls get_deals and returns live promotions.
Step 6: Build a Custom Agent (5 minutes)
Here's a minimal Node.js agent that uses the MCP server programmatically:
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
const transport = new StdioClientTransport({
command: 'npx',
args: ['-y', '@buywhere/mcp-server'],
env: { BUYWHERE_API_KEY: process.env.BUYWHERE_API_KEY }
});
const client = new Client({
name: 'my-shopping-agent',
version: '1.0.0'
});
await client.connect(transport);
// Search for products
const result = await client.callTool({
name: 'search_products',
arguments: {
query: 'mechanical keyboard under $100',
market: 'US',
limit: 5
}
});
console.log(result.content[0].text);
The 5 MCP Tools at Your Disposal
| Tool | What It Does |
|---|---|
search_products |
Natural language search with price, category, market filters |
get_product |
Full product details — specs, price history, availability |
compare_products |
Cross-market price comparison |
get_deals |
Active promotions and price drops |
get_categories |
Category taxonomy and browse structure |
Real World Examples
Price tracking bot: Ask your agent to monitor a product daily and alert you on price drops.
Gift finder: "Find a birthday gift under $50 for a gamer in Singapore."
Travel shopper: "Compare electronics prices US vs Japan — I'm traveling next week."
Ecommerce research: "What are the top 5 best-selling air purifiers in Singapore under SGD 300?"
Why This Matters
MCP is becoming the standard for agent-tool communication. Ecommerce is the single largest category of tools humans use online. Connecting them is inevitable — and BuyWhere makes it real today.
Every AI agent should have access to real product data. Not scraped HTML. Not stale datasets. Not crypto-only catalogs. Real, structured, merchant-direct data.
Get Started
npx -y @buywhere/mcp-server
- GitHub: github.com/buywhere/buywhere-mcp
- API Key: buywhere.ai/api-keys
- Docs: docs.buywhere.ai
Built with BuyWhere MCP. Star us on GitHub — it helps agents find us.
Top comments (0)