brand-comparison-server
README.md
# 🛍️ MCP Brand Comparison
An AI-powered brand comparison application built using the **Model Context Protocol (MCP)**.
The application fetches real-time shopping data for two brands using **SerpAPI**, calculates price and rating statistics, determines value for money, and uses an **LLM hosted through Hugging Face** to generate a structured comparison.
## 🚀 Features
- 🔎 Real-time Google Shopping data
- 🏷️ Compare two different brands
- 👟 Supports multiple product categories:
- Shoes
- Watches
- Bags
- Clothing
- 💰 Average price calculation
- ⭐ Average rating calculation
- 📊 Product-level Value Score
- 🏆 Brand-level value comparison
- 🤖 AI-generated comparison and explanation
- 🔌 MCP-based client-server architecture
- 🌐 Streamlit user interface
- ⚠️ Error handling for missing data and API failures
- 🔒 API keys stored securely using environment variables
## 🏗️ Architecture
```
┌─────────────────────┐
│ User │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ Streamlit UI │
│ app.py │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ MCP Client │
│ ClientSession │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ FastMCP Server │
│ compareserver.py │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ SerpAPI │
│ Google Shopping │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ Shopping Data │
│ Price / Rating │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ Python Analysis │
│ Price / Rating / │
│ Value Score │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ LLM │
│ Hugging Face Router │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ AI Comparison │
│ Winner / Reason / │
│ Price / Rating │
└─────────────────────┘
```
## 🖥️ Application Preview
### Brand Comparison Dashboard
The application allows users to select two brands and a product category, then retrieves real-time shopping data for comparison.

### AI Analysis & Product Comparison
The application calculates average price, average rating, and Value Score, then provides an AI-generated comparison and displays the retrieved products.

This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo issues