This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is an AI-powered e-commerce product search agent built with Flask, LangChain, and MCP (Model Context Protocol). The application searches across multiple e-commerce platforms (Amazon, Best Buy, eBay, Walmart, Target, Costco, Newegg) using web scraping capabilities through BrightData's MCP server.
- Backend: Flask web application (
app.py) with async MCP client integration - AI Agent: LangGraph ReAct agent using OpenAI GPT-4o with structured output
- MCP Integration: Uses
@brightdata/mcpserver for web scraping and data extraction - Frontend: Jinja2 templates with Bootstrap styling
- Data Models: Pydantic models for structured product search responses
- MCP Client: Connects to BrightData's MCP server via stdio for web scraping tools
- LangChain Integration: Uses
langchain-mcp-adaptersto load MCP tools into LangChain - Structured Output: Returns product results in a structured format using Pydantic models
- Multi-platform Search: Searches across 7 major e-commerce platforms simultaneously
# Using uv (recommended)
uv sync
# Install dependencies manually
pip install flask langchain langchain-mcp-adapters langchain-openai langgraph mcp python-dotenv# Development server
python app.py
# The app runs on http://0.0.0.0:8000 with debug mode enabledRequired in .env file:
OPENAI_API_KEY: OpenAI API key for GPT-4oWEB_UNLOCKER_ZONE: BrightData zone configurationBROWSER_AUTH: BrightData browser authenticationAPI_TOKEN: BrightData API token
The application requires Node.js and the BrightData MCP server:
npx @brightdata/mcpThe MCP server provides tools for:
search_engine: General web search functionalityweb_data_*: Platform-specific product data extraction tools
app.py: Main Flask application with MCP client integrationtemplates/: Jinja2 templates (base.html, index.html)static/: CSS stylingpyproject.toml: Python dependencies and project configuration.env: Environment variables (not committed)
- The app uses async operations for MCP client communication
- Product search results are structured using Pydantic models
- The system prompt guides the agent to use appropriate tools for each platform
- Flask secret key is hardcoded for development (should be changed for production)