Skip to content
gentic.news — AI News Intelligence Platform
Connecting to the Living Graph…

Listen to today's AI briefing

Daily podcast — 5 min, AI-narrated summary of top stories

Code editor showing a LangChain agent script for cross-retailer price comparison using the BuyWhere MCP server
Open SourceScore: 66

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.

·21h ago·5 min read··11 views·AI-Generated·Report error
Share:
Source: dev.tovia devto_mcpCorroborated
How do I build a price-comparison agent with BuyWhere MCP and LangChain?

Use the BuyWhere MCP server with LangChain's MultiServerMCPClient and create_react_agent to build a price-comparison agent in ~30 lines. It searches Amazon, Shopee, Best Buy, and more via four tools: search_prices, compare_product, list_cheapest, and get_product.

TL;DR

Wire up a LangChain ReAct agent using BuyWhere MCP to query 9 retailers across 9 countries for real-time price comparisons.

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

Install

pip install langchain langchain-anthropic langchain-mcp-adapters langgraph mcp

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())

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

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, ...   │
                                            └────────────────────────────┘

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.

Source: gentic.news · · author= · citation.json

AI-assisted reporting. Generated by gentic.news from multiple verified sources, fact-checked against the Living Graph of 4,300+ entities. Edited by Ala SMITH.

Following this story?

Get a weekly digest with AI predictions, trends, and analysis — free.

AI Analysis

Claude Code users should add this BuyWhere MCP server to their toolkit for any project that needs live pricing data. The key advantage is that you don't need to write custom scrapers or retailer-specific logic — BuyWhere handles all the integrations. Use the `MultiServerMCPClient` from `langchain-mcp-adapters` to connect the MCP server to your LangChain agent in just a few lines. For Claude Code specifically, consider creating a CLAUDE.md snippet that defines a custom command like `/prices` that runs the agent with a default query. This way, you can quickly ask for price comparisons without writing the full agent code each time. Also, note that the agent uses Claude Sonnet 4-6 as the reasoning model — you can swap this for Opus 4.6 for more complex queries that require deeper reasoning about product specifications or multi-country comparisons.
This story is part of
The AI Infrastructure War Shifts from Chips to Developer Tools
Nvidia's enterprise pivot and AWS's OpenAI bet collide with Cursor's quiet ascent
Compare side-by-side
BuyWhere vs Amazon
Enjoyed this article?
Share:

AI Toolslive

Five one-click lenses on this article. Cached for 24h.

Pick a tool above to generate an instant lens on this article.

Related Articles

From the lab

The framework underneath this story

Every article on this site sits on top of one engine and one framework — both built by the lab.

More in Open Source

View all