{"id":50411807,"url":"https://github.com/siddhant-k-code/swiggy-party-agent","last_synced_at":"2026-05-31T04:02:33.145Z","repository":{"id":354841281,"uuid":"1225506837","full_name":"Siddhant-K-code/swiggy-party-agent","owner":"Siddhant-K-code","description":"AI agent that orders food for your entire team","archived":false,"fork":false,"pushed_at":"2026-04-30T11:39:28.000Z","size":55,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-30T02:26:56.117Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://siddhantkhare.com/writing/swiggy-party-agent","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Siddhant-K-code.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-30T10:52:40.000Z","updated_at":"2026-05-03T16:27:16.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/Siddhant-K-code/swiggy-party-agent","commit_stats":null,"previous_names":["siddhant-k-code/swiggy-party-agent"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Siddhant-K-code/swiggy-party-agent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Siddhant-K-code%2Fswiggy-party-agent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Siddhant-K-code%2Fswiggy-party-agent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Siddhant-K-code%2Fswiggy-party-agent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Siddhant-K-code%2Fswiggy-party-agent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Siddhant-K-code","download_url":"https://codeload.github.com/Siddhant-K-code/swiggy-party-agent/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Siddhant-K-code%2Fswiggy-party-agent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33718446,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-31T02:00:06.040Z","response_time":95,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-05-31T04:02:31.969Z","updated_at":"2026-05-31T04:02:33.137Z","avatar_url":"https://github.com/Siddhant-K-code.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# swiggy-party-agent\n\nYour team fills a Google Form. The agent reads it, builds a Swiggy cart, and waits. You confirm. The order is placed.\n\nBuilt on [Swiggy Builders Club](https://mcp.swiggy.com/builders/) MCP + Vercel AI SDK + Anthropic.\n\n---\n\n## How it works\n\n```\nGoogle Form → CSV export → party-agent → Swiggy MCP → Cart → Confirm → Order placed\n```\n\n1. Share a Google Form: name, dietary restrictions, cuisine preferences, spice level.\n2. Team fills it in. Export responses as CSV from Google Sheets.\n3. Run the agent (CLI, Slack bot, web app, or MCP server — pick your surface). The agent:\n   - Resolves the office delivery address via `get_addresses`\n   - Finds a restaurant that fits the group via `search_restaurants`\n   - Picks a dish per person via `search_menu`\n   - Builds the full cart in one `update_food_cart` call\n   - Applies the best available COD coupon\n4. The agent presents a per-person breakdown. You confirm.\n5. Agent calls `place_food_order`.\n\nThe agent never places an order on its own. Cart building and order placement are separate steps.\n\n---\n\n## Integration surfaces\n\nThe core agent logic lives in `src/agent.ts` and is surface-agnostic. The same `buildCartForGroup` and `placeOrder` functions work across every integration below.\n\n### CLI (included)\n\nRun it from a terminal. Best for one-off events or testing.\n\n```bash\nnpm run dev -- --csv responses.csv --event \"v2.0 Launch\" --address \"Office\" --budget 250\n```\n\n### Slack bot\n\nWire the agent to a Slack slash command or workflow. The team lead runs `/party-order` in the team channel, the bot posts the cart summary as a message with Approve / Skip buttons, and calls `placeOrder` on approval.\n\n```\n/party-order event=\"v2.0 Launch\" csv=\u003cGoogle Sheets URL\u003e\n```\n\nSuggested stack: Slack Bolt (Node.js) + Block Kit for the confirmation UI. The agent reads the sheet via Google Sheets API instead of a local CSV export.\n\n### Web app\n\nA Next.js app where the team lead pastes a Google Sheets link, reviews the AI-built cart in a table UI, edits individual items if needed, and clicks Place Order. Each team member's row is editable before confirmation.\n\nSuggested stack: Next.js + Tailwind + Swiggy MCP on the server side.\n\n### MCP server (expose as a tool)\n\nExpose `buildPartyCart` and `placePartyOrder` as MCP tools so any MCP-compatible AI client (Claude Desktop, Cursor, etc.) can trigger a team order from a conversation.\n\n```\nUser: \"Order lunch for the team. Here's the sheet: \u003curl\u003e\"\nAgent: [calls buildPartyCart tool] → presents summary → [calls placePartyOrder on confirmation]\n```\n\nSuggested stack: `@modelcontextprotocol/sdk` server, two tools, same agent logic underneath.\n\n### Scheduled (cron)\n\nRun every Friday at noon. Pull the latest sheet responses, build the cart, post the summary to Slack for approval. If no one rejects within 30 minutes, place the order automatically.\n\nSuggested stack: GitHub Actions cron + Slack incoming webhook for the approval window.\n\n---\n\n## Architecture\n\n```\n┌──────────────────────────────────────────────────────────────────┐\n│                        Integration Surface                       │\n│         CLI  │  Slack Bot  │  Web App  │  MCP Server  │  Cron    │\n└──────────────────────────────┬───────────────────────────────────┘\n                               │\n               ┌───────────────▼───────────────┐\n               │          src/agent.ts         │\n               │                               │\n               │  buildCartForGroup()          │\n               │  placeOrder()                 │\n               └───────────────┬───────────────┘\n                               │\n       ┌───────────────────────┼───────────────────────┐\n       │                       │                       │\n┌──────▼──────┐        ┌───────▼───────┐     ┌────────▼────────┐\n│ src/parser  │        │ Vercel AI SDK │     │  Swiggy Food    │\n│             │        │ + Anthropic   │     │  MCP Server     │\n│ CSV / Sheets│        │ (any model)   │     │                 │\n│ → TeamMember│        │               │     │ get_addresses   │\n│ []          │        │               │     │ search_*        │\n└─────────────┘        └───────────────┘     │ update_cart     │\n                                             │ place_order     │\n                                             └─────────────────┘\n```\n\n### Cart cap\n\nDefaults to ₹5000 per order, configurable via `--cap` (CLI) or the `cartCap` parameter (programmatic). Large teams split into groups automatically — each group gets its own cart and confirmation step.\n\nSwiggy Builders Club v1 sandbox accounts have a ₹1000 hard cap. Pass `--cap 1000` if you're on a sandbox `client_id`.\n\n---\n\n## Setup\n\n### Prerequisites\n\n- Node.js 20+\n- [Anthropic API key](https://console.anthropic.com/)\n- Swiggy account with a saved delivery address labelled \"Office\"\n- Swiggy Builders Club access token ([apply](https://mcp.swiggy.com/builders/docs/operate/access.md), or get one via the [consumer quickstart](https://mcp.swiggy.com/builders/docs/start/consumer/use-in-ai-client.md))\n\n### Install\n\n```bash\ngit clone https://github.com/Siddhant-K-code/swiggy-party-agent.git\ncd swiggy-party-agent\nnpm install\n```\n\n### Configure\n\n```bash\ncp .env.example .env\n```\n\nEdit `.env`:\n\n```bash\nANTHROPIC_API_KEY=sk-ant-...\nSWIGGY_ACCESS_TOKEN=eyJhbGci...   # from Swiggy OAuth flow\n\n# Optional — any Anthropic model ID. Defaults to claude-opus-4-5.\n# ANTHROPIC_MODEL=claude-3-5-haiku-20241022\n```\n\n### Get a Swiggy access token\n\nSwiggy MCP uses OAuth 2.1 with PKCE. Quickest path for testing:\n\n1. Add Swiggy MCP to Claude Desktop via the [consumer config](https://mcp.swiggy.com/builders/docs/start/consumer/use-in-ai-client.md)\n2. Complete the OAuth flow (phone + OTP)\n3. Extract the token from Claude Desktop's MCP config, or run the PKCE flow directly via the [developer quickstart](https://mcp.swiggy.com/builders/docs/start/developer/index.md)\n\nTokens last 5 days. Re-run the OAuth flow when one expires.\n\n---\n\n## CLI usage\n\n### 1. Create the Google Form\n\nUse the template in [`examples/google-form-template.md`](./examples/google-form-template.md).\n\nFields: Name, Dietary Restrictions, Cuisine Preferences, Dish Preferences, Spice Level.\n\n### 2. Export responses as CSV\n\nIn Google Sheets: **File → Download → Comma Separated Values (.csv)**\n\nSee [`examples/responses.csv`](./examples/responses.csv) for the expected format.\n\n### 3. Run\n\n```bash\nnpm run dev -- --csv responses.csv --event \"v2.0 Launch Party\" --address \"Office\" --budget 250\n```\n\nOr after building:\n\n```bash\nnpm run build\nnode dist/cli.js --csv responses.csv --event \"v2.0 Launch Party\" --address \"Office\" --budget 250\n```\n\n**Options:**\n\n| Flag | Default | Description |\n|------|---------|-------------|\n| `--csv` | *(required)* | Path to the exported Google Form CSV |\n| `--event` | `\"Team Party\"` | Event name shown in the summary |\n| `--address` | `\"Office\"` | Label of the saved Swiggy delivery address |\n| `--budget` | `250` | Max spend per person in INR (used to size groups) |\n| `--cap` | `5000` | Max cart total per order in INR |\n\n### 4. Confirm and place\n\n```\n  Order 1 of 2 — Biryani House\n  ─────────────────────────────────────────\n  Rahul Sharma      Chicken Biryani (Half)  ₹249\n  Ankit Gupta       Chicken Fried Rice      ₹199\n  Vikram Singh      Butter Chicken + Naan   ₹329\n  ─────────────────────────────────────────\n  Coupon  : LAUNCH20  -₹50\n  Total   : ₹727\n\n? Place order 1/2 from Biryani House (₹727)? (y/N)\n```\n\n`y` places the order. `n` skips that group.\n\n---\n\n## Programmatic usage\n\nImport the agent directly to build any integration:\n\n```ts\nimport { buildCartForGroup, placeOrder } from \"./src/agent.js\";\nimport { parseCSV, splitIntoGroups } from \"./src/parser.js\";\n\nconst members = parseCSV(\"responses.csv\");\nconst groups = splitIntoGroups(members, 250, 5000);\n\nfor (let i = 0; i \u003c groups.length; i++) {\n  const summary = await buildCartForGroup(\n    groups[i], \"Office\", 250, i, groups.length, 5000\n  );\n\n  // present summary via your surface (Slack, web, etc.)\n  // then on confirmation:\n  const orderId = await placeOrder(summary, 5000);\n}\n```\n\n---\n\n## Dietary restrictions\n\nThe parser normalises free-text entries to canonical tags:\n\n| Input | Tag |\n|-------|-----|\n| Vegetarian, Veg | `vegetarian` |\n| Vegan | `vegan` |\n| Jain | `jain` |\n| Halal | `halal` |\n| Gluten free, Gluten-free | `gluten-free` |\n| No peanuts, Peanut allergy | `no-peanuts` |\n| No dairy, Lactose | `no-dairy` |\n| Eggetarian | `eggetarian` |\n\nTags are enforced in the agent prompt. A member tagged `vegetarian` only receives veg items.\n\n---\n\n## Limitations\n\n- **COD only**: Swiggy MCP v1 supports Cash on Delivery. Online payment coupons are filtered out.\n- **Single restaurant per group**: Each cart is tied to one restaurant. The agent picks the best fit.\n- **Token expiry**: Access tokens last 5 days. No automatic refresh in v1.\n- **India only**: Addresses must be in a Swiggy-serviceable city.\n\n---\n\n## Built with\n\n- [Swiggy Builders Club](https://mcp.swiggy.com/builders/) — Food MCP server\n- [Vercel AI SDK](https://sdk.vercel.ai/) — MCP client + `generateText` with tool use\n- [Anthropic Claude](https://anthropic.com/) — configurable via `ANTHROPIC_MODEL`, defaults to `claude-opus-4-5`\n- [csv-parse](https://csv.js.org/parse/) — CSV parsing\n- [inquirer](https://github.com/SBoudrias/Inquirer.js) — confirmation prompts\n\n---\n\n## Author\n\nSiddhant Khare ([@Siddhant_K_code](https://twitter.com/Siddhant_K_code))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiddhant-k-code%2Fswiggy-party-agent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsiddhant-k-code%2Fswiggy-party-agent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiddhant-k-code%2Fswiggy-party-agent/lists"}