daraz-mcp

daraz-mcp

Enables searching Daraz.pk products with smart cheapest detection and category support using documented API patterns.

Category
访问服务器

README

Daraz MCP Server - Clean & Fast

A streamlined Model Context Protocol (MCP) server for searching Daraz.pk products. Built using documented Daraz API patterns for maximum reliability and performance.

✨ Features

  • 🎯 Simple & Clean: Just 2 tools instead of 6 confusing ones
  • 📡 Official API Patterns: Uses documented mods.listItems structure and ajax=true endpoints
  • 💸 Smart Cheapest Search: Auto-detects "cheapest" queries and searches extensively
  • 🚫 No Cache: Always fresh results, no .db files created
  • 🔄 Multi-method: JSON API primary, Playwright browser fallback
  • 🎨 Beautiful Output: Human-readable results with clickable links
  • ⚡ Fast: Optimized using officially documented endpoints

🛠️ Tools Available

1. search_daraz - The Main Search Tool

Smart search that handles everything automatically:

# Regular search
search_daraz("wireless mouse")

# Auto-detects cheapest requests  
search_daraz("cheapest wireless mouse")  # Searches 15 pages, sorts by price

# Explicit cheapest mode
search_daraz("mouse", cheapest=True)

# Price filtering
search_daraz("laptops", max_price=50000)

# Category search (uses documented category endpoints)
search_daraz("TV", category="televisions")

Features:

  • Auto-detects "cheapest" in query and switches to extensive search mode
  • Searches 15 pages for cheapest queries vs 5 for regular
  • Sorts results by price for cheapest queries
  • Returns formatted, clickable results

2. product_details - Get Product Info

product_details("https://www.daraz.pk/products/product-url")

📡 API Implementation

This server uses officially documented Daraz.pk endpoints:

Search Endpoint

GET https://www.daraz.pk/catalog/
    ?ajax=true
    &q=query
    &page=1
    &_keyori=ss

Category Endpoint

GET https://www.daraz.pk/{category}/
    ?ajax=true
    &page=1
    &q=search_within_category

Response Structure: data.mods.listItems[] contains product array

🚀 Quick Setup

  1. Install dependencies:
pip install fastmcp requests beautifulsoup4 playwright
  1. Add to LM Studio mcp.json:
{
  "mcpServers": {
    "daraz-search": {
      "command": "C:\\path\\to\\python.exe",
      "args": ["C:\\path\\to\\server_merged.py"]
    }
  }
}
  1. Test in LM Studio:
    • "Find cheapest Nothing phone case"
    • "Search for wireless mice under 2000 PKR"
    • "Show me gaming laptops"

🎯 Improvements from Previous Version

Before (Confusing):

❌ 6 different tools: search_daraz, search_daraz_structured, search_daraz_formatted, search_cheapest_daraz, search_most_expensive_daraz, product_details ❌ Cache causing stale results
❌ AI couldn't decide which tool to use

After (Clean):

✅ 2 simple tools: search_daraz (smart), product_details ✅ No cache - always fresh results ✅ Auto-detection of user intent ✅ Uses documented API patterns

📊 Search Behavior

Query Type Pages Searched Results Sorting
Regular search 5 pages Up to 10 As found
"Cheapest" query 15 pages 1 item Price (lowest first)
With cheapest=True 15 pages 1 item Price (lowest first)
With max_price 5 pages Filtered As found

🔧 No Cache = Always Fresh

  • ✅ No .db files created
  • ✅ Every search hits Daraz API fresh
  • ✅ Latest prices and stock status
  • ✅ No stale cached results

🛡️ Anti-Bot Protection

  • User-Agent rotation (5 different browsers)
  • Random delays between requests (1.0-2.5s)
  • Proper headers and referrers
  • Graceful fallback to browser automation

📖 Usage Examples

For Users in LM Studio:

  • "Find me the cheapest Nothing phone 1 case"
  • "Search for wireless mice under 1500 PKR"
  • "What are some good gaming laptops?"
  • "Show me TVs in the television category"

For Developers:

# The AI will automatically choose the right parameters
search_daraz("cheapest phone cases")  # cheapest=True, max_results=1
search_daraz("phone cases")           # regular search, max_results=10
search_daraz("cases", max_price=500)  # price filtering

🎉 Ready to Use

This server is production-ready and uses officially documented Daraz.pk API patterns for maximum reliability. No seller account required - works with public endpoints only.

Start LM Studio, add the MCP server, and start shopping! 🛍️

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选