返回 MCP 目录
public公开dns本地运行

food402

一个MCP服务器,允许AI助手通过TGO Yemek平台浏览餐厅、构建订单并完成食品订购,支持Claude、ChatGPT和Codex CLI。

article

README

🚀 Food402 MCP 服务器

Food402 MCP 服务器是一个基于模型上下文协议(MCP)的服务器,它能让 AI 助手从 TGO Yemek 订餐。你只需和 AI 助手聊天,就能浏览餐厅、创建订单并完成结账。该服务器通过 MCP 与 Claude、ChatGPT(开发者模式)和 Codex CLI 兼容。

npm version ClawHub


🚀 快速开始

准备工作

在使用此 MCP 服务器之前,你必须拥有一个 TGO Yemek 账户,并满足以下条件:

  1. TGO Yemek 账户:如果你还没有账户,可以在 tgoyemek.com 上注册。
  2. 绑定支付卡:结账过程需要使用已保存的支付卡,你不能在下单时输入卡的详细信息。
  3. 至少保存一个配送地址(推荐):你可以通过 MCP 添加地址,但预先配置好一个地址可以让下单更快。

订餐流程

以下是通过 AI 助手订餐的典型工作流程:

  1. 选择配送地址
"Show me my saved addresses"
"Select my home address for delivery"
  1. 查找餐厅
"What restaurants are near me?"
"Search for pizza restaurants"
"Find places that serve lahmacun"
  1. 浏览菜单并添加菜品
"Show me the menu for [restaurant name]"
"Add 2 lahmacun to my cart"
"What customization options are available for this item?"
  1. 查看并结账
"Show me my basket"
"Remove the drink from my order"
"I'm ready to checkout"
  1. 下单
"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 安装
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 服务器信息。

  • 选项 A:通过 CLI 安装
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 评论集成功能,需要进行以下配置:

  1. Google Cloud Console 获取一个 Google Places API 密钥。
  2. 为你的项目启用两个 API(两个都需要):
    • Places API (New) - 用于文本搜索以查找餐厅。
    • Places API - 用于获取地点详细信息和评论。
  3. 将密钥添加到你的 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 评论
    1. Google Cloud Console 获取一个 Google Places API 密钥。
    2. 为你的项目同时启用两个 API(两个都需要):
      • Places API (New) - 用于文本搜索以查找餐厅。
      • Places API - 用于获取地点详细信息和评论。
    3. 将密钥添加到你的 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

# 构建 TypeScript
npm run build

测试

该项目使用 Vitest 进行集成测试和安全测试。

# 运行所有测试
npm test

# 仅运行安全测试
npm run test:security

# 运行带覆盖率的测试
npm run test:coverage

测试设置

  1. test/.env.test.example 复制到 test/.env.test
  2. test/.env.test 中添加你的 TGO 凭证。
  3. 运行 npm test

测试涵盖以下方面:

  • 地址管理(城市、行政区、社区)
  • 餐厅发现和菜单浏览
  • 购物车操作
  • 支付卡检索和结账准备
  • 订单历史
  • 凭证处理的安全检查

📄 许可证

本项目采用 MIT 许可证。

help

运行方式说明

cloud

托管运行

托管运行通常表示这个 MCP Server 由服务方环境承载,用户一般按页面提供的连接方式或授权流程接入,不需要在本地长期启动一个 MCP 进程

  1. 打开服务方连接页
  2. 完成授权或复制端点
  3. 在 MCP 客户端中连接
terminal

本地运行 / 其它方式

本地运行通常需要用户在自己的电脑或服务器上安装依赖,把 server_config 复制到 MCP 客户端,并按 env_schema 补齐环境变量、密钥或其它配置

  1. 复制 server_config
  2. 安装所需依赖
  3. 补齐环境变量后重启客户端