Skip to content

Google Shopping Agent Demo #99

@yenayuu

Description

@yenayuu

Feature: Shopping Agent MCP Tool

Feature Description

Finding and comparing products across multiple retailers is time-consuming and overwhelming. Users need personalized recommendations that consider their budget, preferences, and requirements without manually browsing dozens of websites.

Proposed Solution

Implement a Shopping Agent MCP server that provides AI-powered product recommendations by orchestrating multi-step workflows using LangGraph, automatically parsing queries, searching across retailers, and generating curated suggestions.

Workflow

The agent will do the following:

  • Accept natural language shopping queries (e.g., "I want to buy a scarf for 40 dollars")
  • Parse query to extract product type and budget constraints
  • Search across multiple retailers using real-time product search
  • Analyze results and generate personalized recommendations with reasoning
  • Return structured JSON with product details, prices, and purchase links

Specifications

MCP Tools

recommend_products

  • Input: query (string), maxResults (integer, default: 5, max: 20)
  • Output: JSON array with product name, price, description, URL, and recommendation reason
  • Uses LangGraph multi-node workflow for intelligent processing

search_products

  • Input: query (string), maxResults (integer, default: 10, max: 100)
  • Output: Raw search results for advanced users
  • Lower-level tool for custom processing

LangGraph Workflow

parse_query → search_products → generate_recommendations → END

Three-node state graph with typed state management:

  • messages: Conversation history with message reducer
  • search_results: Raw product data from searches
  • recommendations: Final curated product list

Configuration

# Required environment variables
SERPAPI_API_KEY="your-key"

# Optional configuration
HOST="0.0.0.0"              # Server host
PORT="8000"                  # Server port
MCP_TRANSPORT="http"         # Transport type
LOG_LEVEL="INFO"             # Logging level

Example Query/Response

Input:

{
  "query": "wireless headphones under $100 with noise cancellation",
  "maxResults": 5
}

Output:

{
  "query": "wireless headphones under $100 with noise cancellation",
  "recommendations": [
    {
      "name": "Sony WH-CH710N",
      "price": "$88.00",
      "description": "Wireless noise-canceling headphones with 35hr battery",
      "url": "https://...",
      "reason": "Excellent noise cancellation within budget, high ratings"
    }
  ],
  "count": 5
}

Testing Modes

  • MCP Inspector: Connect to http://localhost:8000 for visual testing
  • Direct Testing: Run simple_test.py to test workflow without MCP layer
  • Client Testing: Use test_client.py for protocol-level testing

Deployment

  • Docker support with single-command deployment
  • Environment-based configuration
  • Stateless design for horizontal scaling

APIs

  • SerpAPI: Real-time product search across multiple retailers
  • LangChain: LLM framework for agent orchestration and message management
  • LangGraph: Multi-step workflow with state management and node execution
  • SentenceTransformers: (Future) Enhanced product categorization and similarity matching
  • FastMCP: MCP server framework for tool exposure and protocol handling

Documentation

  • README.md: Complete setup and usage guide
  • ARCHITECTURE.md: System design with data flow diagrams (449 lines)
  • QUICKSTART.md: Step-by-step getting started guide
  • TROUBLESHOOTING.md: Common issues and MCP protocol explanations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions