🚀 Food402 MCP 服務器
Food402 MCP 服務器是一個基於模型上下文協議(MCP)的服務器,它能讓 AI 助手從 TGO Yemek 訂餐。你只需和 AI 助手聊天,就能瀏覽餐廳、創建訂單並完成結賬。該服務器通過 MCP 與 Claude、ChatGPT(開發者模式)和 Codex CLI 兼容。

🚀 快速開始
準備工作
在使用此 MCP 服務器之前,你必須擁有一個 TGO Yemek 賬戶,並滿足以下條件:
- TGO Yemek 賬戶:如果你還沒有賬戶,可以在 tgoyemek.com 上註冊。
- 綁定支付卡:結賬過程需要使用已保存的支付卡,你不能在下單時輸入卡的詳細信息。
- 至少保存一個配送地址(推薦):你可以通過 MCP 添加地址,但預先配置好一個地址可以讓下單更快。
訂餐流程
以下是通過 AI 助手訂餐的典型工作流程:
- 選擇配送地址
"Show me my saved addresses"
"Select my home address for delivery"
- 查找餐廳
"What restaurants are near me?"
"Search for pizza restaurants"
"Find places that serve lahmacun"
- 瀏覽菜單並添加菜品
"Show me the menu for [restaurant name]"
"Add 2 lahmacun to my cart"
"What customization options are available for this item?"
- 查看並結賬
"Show me my basket"
"Remove the drink from my order"
"I'm ready to checkout"
- 下單
"Place my order using my saved card"
注意:會彈出一個瀏覽器窗口進行 3D 安全驗證。完成驗證後即可完成訂單。
6. 跟蹤訂單
"What's the status of my order?"
"Show me my recent orders"
✨ 主要特性
- 支持與 Claude、ChatGPT(開發者模式)和 Codex CLI 等 AI 助手集成,通過聊天實現訂餐功能。
- 提供豐富的工具,涵蓋地址管理、餐廳查找、菜單瀏覽、購物車操作、支付和訂單跟蹤等各個環節。
- 支持 Google 評論集成,可對比 TGO 評分和 Google 評分。
📦 安裝指南
Clawdbot / OpenClaw (AgentSkills)
Food402 也可以作為 ClawHub 上的 AgentSkill 使用,適用於 Clawdbot (OpenClaw)、Claude Code、Cursor、Codex、Gemini CLI 和其他支持 AgentSkills 的工具。
clawhub install rersozlu/food402
- 手動安裝:將
skill/ 文件夾複製到 ~/.openclaw/skills/food402/,並在 ~/.openclaw/openclaw.json 中配置你的憑證。
本地 MCP 服務器(npm 包)
Claude Desktop
在你的 Claude Desktop 配置文件(macOS 上為 ~/Library/Application Support/Claude/claude_desktop_config.json)中添加以下內容:
{
"mcpServers": {
"food402": {
"command": "npx",
"args": ["-y", "food402"],
"env": {
"TGO_EMAIL": "your-email@example.com",
"TGO_PASSWORD": "your-password",
"GOOGLE_PLACES_API_KEY": "your-google-api-key"
}
}
}
}
請將憑證替換為你自己的。GOOGLE_PLACES_API_KEY 是可選的(請參閱 可選功能)。
Claude Code
對於使用 Claude Code 進行項目特定安裝:
npm install food402
這會自動將 food402 添加到你的 .mcp.json 文件中。打開該文件並更新你的憑證:
{
"mcpServers": {
"food402": {
"command": "node",
"args": ["./node_modules/food402/dist/src/index.js"],
"env": {
"TGO_EMAIL": "your-email@example.com",
"TGO_PASSWORD": "your-password",
"GOOGLE_PLACES_API_KEY": "your-google-api-key"
}
}
}
}
GOOGLE_PLACES_API_KEY 是可選的(請參閱 可選功能)。
Codex CLI (終端)
Codex 從你的全局配置文件 ~/.codex/config.toml 中讀取 MCP 服務器信息。
codex mcp add food402 --env TGO_EMAIL=your-email@example.com --env TGO_PASSWORD=your-password --env GOOGLE_PLACES_API_KEY=your-google-api-key -- npx -y food402
- 選項 B:手動配置
在
~/.codex/config.toml 中添加以下內容:
[mcp_servers.food402]
command = "npx"
args = ["-y", "food402"]
[mcp_servers.food402.env]
TGO_EMAIL = "your-email@example.com"
TGO_PASSWORD = "your-password"
GOOGLE_PLACES_API_KEY = "your-google-api-key"
💻 使用示例
基礎用法
以下是一些與 AI 助手交互進行訂餐的示例:
"Show me my saved addresses"
"Select my home address for delivery"
"What restaurants are near me?"
"Show me the menu for [restaurant name]"
"Add 2 lahmacun to my cart"
"Show me my basket"
"I'm ready to checkout"
"Place my order using my saved card"
"What's the status of my order?"
高級用法
如果你想使用 Google 評論集成功能,需要進行以下配置:
- 從 Google Cloud Console 獲取一個 Google Places API 密鑰。
- 為你的項目啟用兩個 API(兩個都需要):
- Places API (New) - 用於文本搜索以查找餐廳。
- Places API - 用於獲取地點詳細信息和評論。
- 將密鑰添加到你的 MCP 服務器配置中:
{
"mcpServers": {
"food402": {
"command": "npx",
"args": ["-y", "food402"],
"env": {
"TGO_EMAIL": "your-email@example.com",
"TGO_PASSWORD": "your-password",
"GOOGLE_PLACES_API_KEY": "your-google-api-key"
}
}
}
}
📚 詳細文檔
可用工具
| 工具 |
描述 |
參數 |
get_addresses |
獲取用戶保存的配送地址 |
無 |
select_address |
選擇配送地址(下單前必須調用) |
addressId |
get_restaurants |
搜索附近的餐廳 |
latitude, longitude, page? |
search_restaurants |
按關鍵字搜索餐廳和菜品 |
searchQuery, latitude, longitude, page? |
get_restaurant_menu |
獲取餐廳的完整菜單 |
restaurantId, latitude, longitude |
get_product_details |
獲取菜品的定製選項 |
restaurantId, productId, latitude, longitude |
get_product_recommendations |
獲取“搭配推薦”建議 |
restaurantId, productIds[] |
add_to_basket |
將菜品添加到購物車 |
storeId, items[], latitude, longitude, 等 |
get_basket |
獲取當前購物車的內容 |
無 |
remove_from_basket |
從購物車中移除菜品 |
itemId |
clear_basket |
清空整個購物車 |
無 |
get_cities |
獲取所有可用於地址選擇的城市列表 |
無 |
get_districts |
獲取某個城市的行政區列表 |
cityId |
get_neighborhoods |
獲取某個行政區的社區列表 |
districtId |
add_address |
添加一個新的配送地址 |
name, surname, phone, addressName, addressLine, cityId, districtId, neighborhoodId, latitude, longitude, 等 |
get_saved_cards |
獲取用戶保存的支付卡(掩碼顯示) |
無 |
checkout_ready |
準備結賬並提供支付上下文 |
無 |
set_order_note |
設置訂單備註和配送偏好 |
note?, noServiceWare?, contactlessDelivery?, dontRingBell? |
place_order |
使用 3D 安全驗證下單(會打開瀏覽器進行驗證) |
cardId |
get_orders |
獲取用戶的訂單歷史和狀態 |
page? |
get_order_detail |
獲取訂單的詳細信息,包括配送狀態 |
orderId |
可選功能
Google 評論集成
get_google_reviews 工具允許你獲取餐廳的 Google 評論,從而對比 TGO 評分和 Google 評分。此功能是可選的,需要一個 Google Places API 密鑰。
- 啟用 Google 評論:
- 從 Google Cloud Console 獲取一個 Google Places API 密鑰。
- 為你的項目同時啟用兩個 API(兩個都需要):
- Places API (New) - 用於文本搜索以查找餐廳。
- Places API - 用於獲取地點詳細信息和評論。
- 將密鑰添加到你的 MCP 服務器配置中:
{
"mcpServers": {
"food402": {
"command": "npx",
"args": ["-y", "food402"],
"env": {
"TGO_EMAIL": "your-email@example.com",
"TGO_PASSWORD": "your-password",
"GOOGLE_PLACES_API_KEY": "your-google-api-key"
}
}
}
}
- 沒有 API 密鑰時:該工具將返回一條提示信息,表明該功能不可用,但不會導致任何錯誤。沒有該密鑰,其餘的訂餐功能仍可正常使用。
🔧 技術細節
倉庫結構
food402/
├── src/ # MCP 服務器(標準輸入輸出傳輸)
│ ├── index.ts # MCP 入口點,包含工具定義
│ ├── auth.ts # 帶有令牌緩存的 TGO 認證
│ ├── api.ts # 對 shared/api.ts 的輕量級封裝
│ └── postinstall.ts # 在 npm 安裝時自動配置 .mcp.json
├── shared/ # 共享 API 代碼
│ ├── api.ts # 帶有令牌參數的 TGO API 函數
│ └── types.ts # TypeScript 接口
├── test/ # 測試套件
│ ├── integration/ # API 集成測試
│ ├── security/ # 安全驗證測試
│ └── setup/ # 測試工具和夾具
├── package.json # 根包(npm: food402)
├── README.md
└── CLAUDE.md
本地服務器開發
npm install
npm start
npm run build
測試
該項目使用 Vitest 進行集成測試和安全測試。
npm test
npm run test:security
npm run test:coverage
測試設置:
- 將
test/.env.test.example 複製到 test/.env.test。
- 在
test/.env.test 中添加你的 TGO 憑證。
- 運行
npm test。
測試涵蓋以下方面:
- 地址管理(城市、行政區、社區)
- 餐廳發現和菜單瀏覽
- 購物車操作
- 支付卡檢索和結賬準備
- 訂單歷史
- 憑證處理的安全檢查
📄 許可證
本項目採用 MIT 許可證。