关于 recipe-mcp
recipe-mcp 是面向食谱生成与调整的 MCP 服务,可根据饮食偏好、过敏信息和营养目标创建或修改食谱。它提供生成与转换两类工具,匿名使用无需 API 密钥,但有请求频率限制。
主要功能
- 01按自然语言生成食谱
- 02按指令调整现有食谱
- 03支持饮食限制与过敏信息
- 04设定热量、蛋白质和份数
- 05匿名访问,无需 API 密钥
适用场景
- 01根据饮食偏好构思新食谱
- 02将现有食谱改为纯素
- 03按热量或蛋白质目标调整菜谱
MCP 相关
作为 MCP 服务,recipe-mcp 向客户端提供生成食谱和转换食谱两种工具。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
工具
还没有获取到工具列表
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
Recipe MCP Server
一个 MCP(Model Context Protocol)服务,提供 AI 驱动的食谱生成与转换工具。根据饮食偏好生成个性化食谱,将现有食谱调整为符合营养目标的版本,等等。
功能
- 🍳 生成食谱 - 根据自然语言描述创建自定义食谱
- 🔄 转换食谱 - 修改现有食谱(改为纯素、调整热量等)
- 🥗 饮食支持 - 处理过敏、饮食限制和食物偏好
- 📊 营养目标 - 满足特定的热量和蛋白质要求
- 🆓 开放访问 - 无需 API 密钥(有速率限制)
安装
用于 Claude Desktop
- 安装 MCP 服务:
npm install -g @cookwith/recipe-mcp
- 添加到 Claude Desktop 配置中:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
{
"mcpServers": {
"recipe-mcp": {
"command": "npx",
"args": ["@cookwith/recipe-mcp"],
"env": {
"COOKWITH_API_URL": "https://cookwith.co"
}
}
}
}
- 重启 Claude Desktop
用于开发
# Clone the repository
git clone https://github.com/cookwith/recipe-mcp.git
cd recipe-mcp
# Install dependencies
npm install
# Run in development mode
npm run dev
使用示例
生成食谱
// In Claude Desktop, you can say:
"Generate a healthy Mediterranean pasta dish with lots of vegetables"
// The tool will be called with:
{
"prompt": "A healthy Mediterranean pasta dish with lots of vegetables",
"dietaryRestrictions": ["vegetarian"],
"calories": "450",
"servings": 4
}
转换食谱
// After generating or providing a recipe:
"Make this recipe vegan and reduce the calories by 200"
// The tool will be called with:
{
"recipe": { /* existing recipe object */ },
"instructions": "Make this vegan and reduce calories by 200",
"calories": "350"
}
工具
generate_recipe
根据自然语言指令生成新食谱。
参数:
prompt(string,必填)- 自然语言描述dietaryRestrictions(string[],可选)- 例如,["vegetarian", "gluten-free"]allergies(string[],可选)- 需要避免的食材dislikes(string[],可选)- 需要排除的食物calories(string,可选)- 每份目标热量protein(string,可选)- 目标蛋白质克数servings(number,可选)- 份数(1-20,默认:4)
transform_recipe
根据指令转换现有食谱。
参数:
recipe(object,必填)- 要转换的食谱instructions(string,必填)- 如何修改食谱calories(string,可选)- 新的目标热量protein(string,可选)- 新的目标蛋白质克数servings(number,可选)- 新的份数
速率限制
公共 API 有以下速率限制:
- 匿名访问:每个 IP 地址每小时 20 次请求
- 无需身份验证
- 超出限制时会提供 Retry-After 标头
食谱对象格式
interface Recipe {
title: string;
description: string;
ingredients: string[]; // e.g., ["2 cups flour", "1 tsp salt"]
instructions: string[]; // Step-by-step instructions
servings: number;
prepTime?: number; // Minutes
cookTime?: number; // Minutes
totalTime?: number; // Minutes
cuisine?: string; // e.g., "Italian", "Mexican"
course?: string; // e.g., "main", "dessert"
difficulty?: string; // e.g., "easy", "medium", "hard"
calories?: number; // Per serving
protein?: number; // Grams per serving
carbs?: number; // Grams per serving
fat?: number; // Grams per serving
fiber?: number; // Grams per serving
sugar?: number; // Grams per serving
sodium?: number; // Milligrams per serving
}
配置
环境变量
COOKWITH_API_URL- API 端点(默认:https://cookwith.co)
自定义 API 端点
用于开发或自托管实例:
export COOKWITH_API_URL=http://localhost:3000
npx @cookwith/recipe-mcp
示例
基本食谱生成
// Request
{
"prompt": "Quick and easy chicken stir-fry"
}
// Response
{
"title": "Quick Chicken Stir-Fry",
"description": "A delicious and speedy chicken stir-fry...",
"ingredients": [
"2 chicken breasts, sliced",
"2 cups mixed vegetables",
"3 tbsp soy sauce",
// ...
],
"instructions": [
"Heat oil in a large wok or skillet",
"Add chicken and cook until golden",
// ...
],
"servings": 4,
"prepTime": 10,
"cookTime": 15,
"calories": 320,
"protein": 28
}
食谱转换
// Request
{
"recipe": {
"title": "Classic Beef Lasagna",
"ingredients": ["1 lb ground beef", "ricotta cheese", ...],
// ... full recipe
},
"instructions": "Make this vegetarian and lower in calories"
}
// Response
{
"title": "Vegetarian Light Lasagna",
"description": "A healthier vegetarian version...",
"ingredients": [
"2 cups chopped mushrooms",
"1 cup low-fat ricotta",
// ... transformed ingredients
],
// ... rest of transformed recipe
}
故障排除
速率限制错误
如果收到 429 错误,说明已超出速率限制。请等待 retryAfter 字段指定的时间后再发送请求。
连接问题
请确保网络连接稳定,并且可以访问 API 端点。
参数无效
请检查参数是否符合预期格式和限制(例如,份数介于 1-20 之间)。
贡献
欢迎贡献!详情请参阅贡献指南。
许可证
MIT 许可证 - 详情请参阅 LICENSE 文件。
支持
- 🐛 报告问题
- 💬 讨论
- 📧 电子邮件:[email protected]
技术支持
- Cookwith - AI 驱动的烹饪平台
- OpenAI GPT-4 - 食谱生成
- Model Context Protocol - 工具集成
评论
支持 Markdown
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。