Swiggy Deal Finder

Swiggy Deal Finder

Finds the cheapest nearby option for a dish on your own Swiggy account, ranked by final post-coupon payable amount.

Category
访问服务器

README

Swiggy Deal Finder

Swiggy Deal Finder is an MCP connector that finds the cheapest nearby option for a dish on your own Swiggy account, ranked by final post-coupon payable amount.

It is designed for discovery only:

  • no order placement
  • read + controlled cart mutation for pricing probes
  • automatic cart cleanup after each pricing probe

What this project does

Given a dish and a selected saved delivery address, the connector:

  1. Finds open restaurants within 7 km.
  2. Matches menu items for the requested dish.
  3. Prices top candidates by probing Swiggy cart + coupon application.
  4. Returns ranked options by:
    • lowest final payable amount (to_pay)
    • highest rating as tie-breaker

The MCP server exposes these tools:

  • get_locations()
  • list_dish_variants(dish, address_id, category?)
  • find_deals(dish, address_id, top_n=5, portion="regular", category?)

Architecture overview

Core modules (src/swiggy_deal_finder):

  • server.py
    MCP entrypoint (FastMCP), tool definitions, lifespan-managed persistent Swiggy client.
  • live_client.py
    Real Swiggy adapter over mcp-remote (spawned via npx), wraps MCP tool calls.
  • service.py
    Orchestration pipeline (DealFinder) for candidate discovery → pricing → ranking.
  • candidates.py
    Restaurant/menu discovery, dish-token matching, distance/open filters, portion filtering.
  • pricing.py
    Cart safety guard + coupon probe cycle. Handles empty-cart precondition and cart flush.
  • ranking.py
    Final ordering logic (final_to_pay asc, rating desc).
  • swiggy_client.py
    Protocol and pure parsers for Swiggy responses.
  • models.py
    Pydantic domain models.
  • main.py
    Minimal FastAPI app (/health) for service health checks.

Safety invariants

The project enforces a few critical rules:

  • Never places an order.
  • Refuses pricing if the cart is already non-empty.
  • Never flushes a cart it did not create.
  • Always flushes probe cart items after pricing completes (or on failure path after entry).
  • Uses fresh cart reads for truth after coupon application.

Prerequisites

  • Python >= 3.14 (as defined in pyproject.toml)
  • uv for environment management
  • Node.js / npx (used to spawn mcp-remote)
  • A Swiggy account with saved delivery addresses

Setup

  1. Install dependencies:

    uv sync --dev
    
  2. Create environment file:

    cp .env.example .env
    
  3. Fill required values in .env:

    • Swiggy MCP/OAuth values (as available in your environment)
    • Vertex/Gemini values for model access
    • APP_SECRET_KEY (required)
  4. Validate connectivity:

    uv run python scripts/check_env.py
    

Running locally

1) FastAPI health app

uv run uvicorn swiggy_deal_finder.main:app --reload

Health endpoint:

  • GET /health{"status":"ok"}

2) MCP server (for Claude Desktop / MCP clients)

uv run python -m swiggy_deal_finder.server

This starts the MCP connector and keeps one persistent authenticated Swiggy session for tool calls.


Typical MCP usage flow

  1. Call get_locations() and choose an address_id.
  2. If dish is generic (e.g. dosa, pizza, biryani), call list_dish_variants(...) first.
  3. Call find_deals(...) with the selected specific dish.
  4. Present ranked results to the user.

Notes:

  • category should be a broad cuisine/category term when dish search is too specific.
  • portion="regular" excludes mini/half-style servings unless user explicitly asks.

Scripts

Repository scripts:

  • scripts/check_env.py
    Validates env load + Swiggy MCP reachability + Vertex/Gemini reachability.
  • scripts/smoke_live.py
    Read-only live smoke test against Swiggy MCP bridge.
  • scripts/demo.py
    Runs the full deal-finder engine from CLI.
  • scripts/check_server.py
    End-to-end MCP server check by spawning connector and invoking tools.

See also: DEMO.md for local Claude Desktop demo wiring details.


Development commands

Lint:

uv run ruff check .

Tests:

uv run pytest

Testing scope

Tests in tests/ cover:

  • parser and config behavior
  • candidate filtering and matching
  • pricing/cart guard behavior
  • ranking logic
  • server tool behavior
  • live-client adapter contract assumptions

Troubleshooting

  • uv: command not found
    Install uv from https://docs.astral.sh/uv/installation/ and ensure it is in your PATH.

  • No results for a specific dish phrase
    Retry with a broader category (e.g. dosa, biryani, roll) and then match exact dish via menu scan.

  • Cart-not-empty response from find_deals
    Clear your cart in Swiggy app before pricing; this is a deliberate safety check.

  • No saved addresses
    Add delivery addresses in your Swiggy app first.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选