AI agents can now help users shop — answering natural language queries like "find me the cheapest MacBook Pro in Singapore" or "which retailer has the Nintendo Switch on sale right now." Building this capability requires a product data API and a tool framework that lets the agent query it naturally. The BuyWhere MCP server provides both.
This guide walks through building an AI shopping agent using the BuyWhere MCP server with Claude Desktop, Cursor, or any MCP-compatible client.
What is an MCP Server?
The Model Context Protocol (MCP) is an open standard for connecting AI models to external tools and data sources. An MCP server exposes your API as a set of tools that an AI agent can call directly.
Prerequisites
- Claude Desktop or any MCP client
- A BuyWhere API key (get one free at buywhere.ai/api-keys)
- Node.js 18+
1. Set Up the BuyWhere MCP Server
Add to your Claude Desktop MCP settings:
{
"mcpServers": {
"buywhere": {
"command": "npx",
"args": ["-y", "@buywhere/mcp-server"]
}
}
}
Set your API key:
export BUYWHERE_API_KEY=your_api_key_here
Or run locally:
npm install -g @buywhere/mcp-server
buywhere-mcp-server
2. Test the Connection
Ask Claude: "Search for Sony WH-1000XM5 headphones in the US and show me the cheapest price."
3. Core Shopping Agent Capabilities
Product Search
{
tool: "buywhere_products_search",
arguments: {
query: "Dyson V15 vacuum cleaner",
country: "SG",
limit: 5
}
}
Cross-Retailer Price Comparison
{
tool: "buywhere_products_search",
arguments: {
query: "iPhone 15 Pro 256GB",
country: "US",
limit: 10
}
}
Deal Discovery
{
tool: "buywhere_products_search",
arguments: {
category: "electronics",
country: "US",
min_discount: 15,
limit: 20
}
}
4. Building a Custom Agent
import { BuyWhere } from "@buywhere/sdk";
import { Anthropic } from "@anthropic-ai/sdk";
const client = new BuyWhere({ apiKey: process.env.BUYWHERE_API_KEY });
async function shoppingAgent(userMessage) {
const response = await anthropic.messages.create({
model: "claude-sonnet-4-20250514",
messages: [{
role: "user",
content: `You are a shopping assistant. Use the BuyWhere API to answer product questions.`,
}],
tools: [{
name: "buywhere_products_search",
description: "Search for products across BuyWhere retailers",
input_schema: {
type: "object",
properties: {
query: { type: "string" },
country: { type: "string" },
limit: { type: "number" },
},
},
}],
});
return response;
}
5. Production Tips
- Cache results to reduce API calls
- Always show stock status
- Prices vary by region
Get Started
- Get your free API key: https://buywhere.ai/api-keys
- MCP setup guide: https://buywhere.ai/integrate
- npm package: https://www.npmjs.com/package/@buywhere/mcp-server
Top comments (0)