| name | meituan-waimai |
| description | Order food delivery from Meituan (美团外卖) via CLI. Use when user wants to search restaurants, browse menus, or manage cart for Chinese food delivery. |
| metadata | {"bashPattern":"mt\\s+waimai|mt\\s+auth|meituan"} |
Meituan Food Delivery CLI
Use the mt CLI to interact with Meituan Waimai (美团外卖). All commands output JSON with --json flag.
Auto-Install
IMPORTANT: Before running any mt command, check if it's installed and set up:
which mt || {
git clone https://github.com/juntaochi/meituan-cli.git ~/.meituan-cli 2>/dev/null
cd ~/.meituan-cli && npm install && npm link
npx playwright install chromium
}
mt auth whoami --json 2>/dev/null | grep -q '"loggedIn":true' || {
echo "需要登录美团。请在浏览器打开 https://h5.waimai.meituan.com ,登录后从 DevTools → Application → Cookies 复制完整 cookie 字符串"
}
Commands Reference
Authentication
mt auth whoami --json
mt auth login --cookie '...'
mt auth logout
Address (instant, no browser proxy)
mt waimai address list --json
mt waimai address set <label>
Search Restaurants (~10s first call, ~2s after)
mt waimai search <keyword> --json
Menu
mt waimai menu <restaurant-id> --json
Cart
mt waimai cart add <spu-id> --restaurant <id> --sku <sku-id> --name <name> --price <price> --json
mt waimai cart view --restaurant <id> --json
mt waimai cart clear --restaurant <id> --json
Order
mt waimai order place --confirm --json
mt waimai order place --dry-run --json
mt waimai order status <order-id> --json
Reorder & Coupon
mt waimai reorder <order-id> --json
mt waimai coupon apply <code> --restaurant <id> --json
Typical Agent Workflow
mt waimai address list --json
mt waimai address set 融创
mt waimai search 清远鸡 --json
mt waimai menu <poi_id_str from search> --json
mt waimai cart add <item.id> \
--restaurant <poi_id_str> \
--sku <item.skus[0].id> \
--name "<item.name>" \
--price <item.skus[0].price> \
--json
mt waimai order place --dry-run --json
mt waimai order place --confirm --json
mt waimai order status <orderId> --json
Notes
- Residential IP required — Meituan blocks datacenter/VPS IPs. Run from a local machine with residential internet
- First call starts headless Chromium with stealth plugin (~10s), subsequent calls ~2s
- Browser state is cached locally — warm restarts are faster
- Address commands bypass browser (instant)
- Cookie expires periodically — re-login if auth errors
- JSON output:
{ok: true, data: ...} or {ok: false, error: ...}
- stderr has warnings (e.g. "Starting browser proxy..."), stdout is clean JSON
- Order placement uses real money — always use
--dry-run first