You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A Model Context Protocol (MCP) server that provides intelligent shopping recommendations using LangChain, LangGraph, OpenAI, and SerpAPI.
3
+
A Model Context Protocol (MCP) server that provides product search capabilities using SerpAPI. The server returns structured product data, and the calling agent provides intelligent reasoning and recommendations.
4
4
5
5
## Features
6
6
7
-
-**AI-Powered Recommendations**: Uses OpenAI's GPT-4 to understand natural language queries and generate personalized product recommendations
8
-
-**Real-time Search**: Leverages SerpAPI to search across multiple retailers for the best products
9
-
-**LangGraph Agent**: Implements a sophisticated multi-step agent workflow with:
10
-
- Query parsing and understanding
11
-
- Product search across retailers
12
-
- Recommendation generation with reasoning
13
-
-**Configurable Results**: Limit recommendations (default 5, max 20) based on your needs
7
+
-**Product Search**: Leverages SerpAPI (Google Shopping) to search across multiple retailers
8
+
-**Structured Data**: Returns rich product info including titles, prices, descriptions, thumbnails, ratings, and reviews
9
+
-**Agent-Driven Analysis**: The MCP server returns raw data; your AI agent analyzes and provides reasoning
10
+
-**Budget Awareness**: Product data includes prices for the agent to consider constraints
11
+
-**Configurable Results**: Limit search results (default 10, max 20) based on your needs
14
12
15
13
## Tools
16
14
17
15
### 1. `recommend_products`
18
16
19
-
Recommends products based on a natural language query with budget and preferences.
17
+
Searches for products based on a natural language query and returns structured product data. The calling agent should analyze this data and provide intelligent reasoning.
20
18
21
19
**Parameters:**
22
20
-`query` (string, required): Natural language product request (e.g., "I want to buy a scarf for 40 dollars")
23
-
-`maxResults` (integer, optional): Maximum number of recommendations (default: 5, max: 20)
21
+
-`maxResults` (integer, optional): Maximum number of results (default: 10, max: 20)
24
22
25
23
**Returns:**
26
24
```json
27
25
{
28
26
"query": "I want to buy a scarf for 40 dollars",
29
-
"recommendations": [
27
+
"products": [
30
28
{
31
29
"name": "Cashmere Blend Scarf",
32
30
"price": "$35.99",
33
-
"description": "Soft and warm cashmere blend scarf in multiple colors",
31
+
"description": "Soft and warm cashmere blend scarf in multiple colors...",
34
32
"url": "https://example.com/product",
35
-
"reason": "High quality within budget with excellent reviews"
33
+
"thumbnail": "https://example.com/image.jpg",
34
+
"source": "Amazon",
35
+
"rating": 4.5,
36
+
"reviews": 120
36
37
}
37
38
],
38
39
"count": 5
39
40
}
40
41
```
41
42
43
+
**Features:**
44
+
- Returns rich structured product data including thumbnails and ratings
45
+
- The calling agent should analyze products and provide reasoning
46
+
- Products include names, prices, descriptions, and purchase URLs
47
+
- Only requires `SERPAPI_API_KEY` to function
48
+
42
49
### 2. `search_products`
43
50
44
51
Search for products across retailers (lower-level tool for raw search results).
@@ -56,13 +63,11 @@ Raw search results from SerpAPI.
56
63
57
64
- Python 3.10 or higher
58
65
-[uv](https://docs.astral.sh/uv/) package manager
59
-
- OpenAI API key
60
-
- SerpAPI key
66
+
- SerpAPI key (required for product search)
61
67
62
68
### Installation
63
69
64
-
1.**Get API Keys:**
65
-
- OpenAI API key: https://platform.openai.com/api-keys
70
+
1.**Get API Key:**
66
71
- SerpAPI key: https://serpapi.com/manage-api-key
67
72
68
73
2.**Install Dependencies:**
@@ -74,16 +79,15 @@ uv pip install -e .
74
79
75
80
### Configuration
76
81
77
-
Set the required environment variables:
82
+
Set the required environment variable:
78
83
79
84
```bash
80
-
export OPENAI_API_KEY="your-openai-api-key"
81
85
export SERPAPI_API_KEY="your-serpapi-key"
82
86
```
83
87
84
88
Optional configuration:
85
89
```bash
86
-
export HOST="0.0.0.0"# Server host (default: 0.0.0.0)
90
+
export HOST="0.0.0.0"# Server host (default: 0.0.0.0)
87
91
export PORT="8000"# Server port (default: 8000)
88
92
export MCP_TRANSPORT="http"# Transport type (default: http, Inspector-ready)
89
93
export MCP_JSON_RESPONSE="1"# Force JSON responses (default: enabled)
0 commit comments