DEV Community

gentic news
gentic news

Posted on • Originally published at gentic.news

Build a Cross-Retailer Price-Comparison Agent with BuyWhere MCP in 30 Lines

Connect BuyWhere MCP to a LangChain ReAct agent in 30 lines. Claude picks the right tool from four (search_prices, compare_product, list_cheapest, get_product) to compare prices across 9 retailers in 9 countries.

Key Takeaways

  • Connect BuyWhere MCP to a LangChain ReAct agent in 30 lines.
  • Claude picks the right tool from four (search_prices, compare_product, list_cheapest, get_product) to compare prices across 9 retailers in 9 countries.

What Changed — BuyWhere MCP Server for Cross-Retailer Price Comparison

The BuyWhere MCP server (@buywhere/mcp-server) is now available, allowing you to build a LangChain ReAct agent that queries 9 retailers across 9 countries for real-time price comparisons. The server exposes four tools: search_prices, compare_product, list_cheapest, and get_product. It uses the Model Context Protocol (MCP) to standardize tool calls, meaning Claude (or any MCP-compatible model) can reason about which tool to use and when.

What It Means For You — Concrete Impact on Daily Claude Code Usage

If you're building shopping agents, price trackers, or any app that needs live pricing data, this MCP server saves you from writing custom scrapers or retailer-specific adapters. BuyWhere handles the retailer integrations (Amazon, Shopee, Best Buy, Lazada, Apple Store, and more) — you just wire it up to your agent.

For Claude Code users, this means you can now add price-comparison capabilities to your terminal-based workflows. For example, you could ask Claude Code to "Find me the cheapest 14-inch laptop under SGD 1500 in Singapore" and get a structured answer with merchant, price, and a direct link.

Try It Now — Step-by-Step Setup

Prerequisites

  • Python 3.10+
  • A BuyWhere API key (free) from buywhere.ai/api-keys
  • An Anthropic API key for Claude
  • Node.js 18+ (the MCP server runs via npx)

Install

pip install langchain langchain-anthropic langchain-mcp-adapters langgraph mcp
Enter fullscreen mode Exit fullscreen mode

The langchain-mcp-adapters package is the official LangChain bridge for MCP servers. It wraps any stdio-based MCP server as a list of LangChain BaseTool objects.

The Full Agent (30 Lines)

import asyncio
from langchain_mcp_adapters.client import MultiServerMCPClient
from langchain_anthropic import ChatAnthropic
from langgraph.prebuilt import create_react_agent

BUYWHERE_API_KEY = "sk-buywhere-your-key"  # from buywhere.ai/api-keys
ANTHROPIC_API_KEY = "sk-ant-your-key"

async def main():
    # 1. Connect to the BuyWhere MCP server (stdio transport)
    client = MultiServerMCPClient({
        "buywhere": {
            "command": "npx",
            "args": ["-y", "@buywhere/mcp-server"],
            "env": {"BUYWHERE_API_KEY": BUYWHERE_API_KEY},
            "transport": "stdio",
        }
    })

    # 2. Load MCP tools as LangChain BaseTool objects
    tools = await client.get_tools()
    print(f"Loaded {len(tools)} BuyWhere tools: {[t.name for t in tools]}")
    # Loaded 4 BuyWhere tools: ['search_prices', 'compare_product', 'list_cheapest', 'get_product']

    # 3. Build a Claude-backed ReAct agent
    model = ChatAnthropic(model="claude-sonnet-4-6", api_key=ANTHROPIC_API_KEY)
    agent = create_react_agent(model, tools)

    # 4. Ask
    response = await agent.ainvoke({
        "messages": [("user",
            "What's the cheapest 14-inch laptop under SGD 1500 in Singapore right now? "
            "Show me the top 3 with merchant, price, and a link."
        )]
    })
    print(response["messages"][-1].content)

asyncio.run(main())
Enter fullscreen mode Exit fullscreen mode

That's the whole agent. The MCP server handles all the retailer adapters — Claude just decides which tool to call and reads the result.

What the Tools Look Like to the Agent

Tool What it does When the agent uses it
search_prices Free-text search across all retailers in a country, sorted by price "Find me cheap noise-cancelling headphones"
compare_product Resolve a product to a canonical SKU and return its price across all merchants "Compare the iPhone 17 Pro across stores"
list_cheapest Top N cheapest products in a category, country-scoped "What's the cheapest laptop right now in SG?"
get_product Detailed product info, including stock, rating, and spec list "Tell me more about that Dyson V15 listing"

The agent reads the tool descriptions (which the MCP server ships as part of the protocol) and picks the right one based on the user's question. You don't have to write any custom routing logic.

How the Pieces Fit

┌─────────────────────┐    stdio (JSON-RPC)    ┌───────────────────────┐
│  LangChain agent    │ ─────────────────────▶ │  BuyWhere MCP server  │
│  (Claude + ReAct)   │ ◀───────────────────── │  (@buywhere/mcp-server)│
└─────────────────────┘    tool calls/returns  └──────────┬────────────┘
                                                            │
                                            ┌───────────────┴────────────┐
                                            │  Per-retailer adapters:     │
                                            │  Amazon, Shopee, Best Buy,  │
                                            │  Lazada, Apple Store, ...   │
                                            └────────────────────────────┘
Enter fullscreen mode Exit fullscreen mode

When to Use This

  • Shopping agents: Ask "What's the cheapest 14-inch laptop under SGD 1500 in Singapore?"
  • Price monitoring: Compare prices across countries for the same product
  • Inventory checks: Ask "Where can I buy an iPhone 17 with USB-C, in stock today, in Malaysia?"

The BuyWhere MCP server is free to use with an API key, and the langchain-mcp-adapters package makes it trivial to integrate into any LangChain agent.


Source: dev.to

[Updated 13 Jun via devto_mcp]

The same week BuyWhere launched its MCP server, an independent developer released mcp-hub, a self-hosted MCP server registry and proxy written in TypeScript. Unlike BuyWhere's approach of exposing retailer-specific tools via a single MCP server, mcp-hub lets you register any MCP server (SSE, HTTP, stdio) and proxy all tool calls through a single endpoint with auth forwarding. It streams every call live via WebSocket and monitors server health with BullMQ [per dev.to]. The project is open-source on GitHub and runs with docker compose up.

[Updated 14 Jun via devto_mcp]

A separate MCP server for aviation weather has also appeared, built by a commercial pilot. The free, no-signup server exposes six tools (get_metar, get_airport, get_aircraft, get_glossary_term, practice_questions, quiz_of_the_day) via Apify Standby Actor with Streamable HTTP transport. It wraps the Rotate Pilot API, letting agents answer real-time VFR/IFR queries for any ICAO airport [per dev.to/perufitlife].


Originally published on gentic.news

Top comments (0)