使用说明
Mealie MCP服务器
A. 模型上下文协议(MCP) 将您的AI助手连接到您的 米莉 自托管配方管理器。
连接后,您可以问Claude以下问题:
- “我有什么意大利面食谱?”
- “给我看看我所有的鸡肉食谱”
- “从URL导入此配方:…”
- “什么食谱用奶油奶酪?”
先决条件
- Node.js 18岁或以后
- 跑步 米莉 实例(建议使用v1.0+)
- A. Mealie API密钥 (见下文)
获取Mealie API密钥
- 在浏览器中打开您的Mealie实例
- 单击您的个人资料图标→ 个人资料
- 滚动到 API令牌 部分
- 点击 创建API令牌,给它起个名字(例如。
claude),然后单击 生成 - 立即复制令牌 --它不会再显示
安装
无需安装--直接使用运行 npx:
npx @schaferandrew/mealie-mcp-server
如果您愿意,也可以全局安装:
npm install -g @schaferandrew/mealie-mcp-server
Claude桌面设置
将服务器添加到Claude Desktop配置文件中:
雨衣: ~/Library/Application Support/Claude/claude_desktop_config.json
窗户: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"mealie": {
"command": "npx",
"args": ["-y", "@schaferandrew/mealie-mcp-server"],
"env": {
"MEALIE_URL": "http://your-mealie-instance:9000",
"MEALIE_API_KEY": "your-api-key-here"
}
}
}
}
重新启动Claude Desktop——您应该看到Claude中提供的Mealie工具。
Claude代码设置
claude mcp add mealie -- npx -y @schaferandrew/mealie-mcp-server \
-e MEALIE_URL=http://your-mealie-instance:9000 \
-e MEALIE_API_KEY=your-api-key-here
添加 --scope global 使其在所有项目中都可用。
可用工具
| 工具 | 说明 |
|---|---|
search_recipes |
按名称或关键字搜索食谱。 例子: search_recipes pasta |
get_recipe |
获取完整的食谱细节,包括配料和说明。 例子: get_recipe "Spaghetti Carbonara" |
list_recipes |
列出所有食谱,可选择按标签或类别过滤。 例子: list_recipes tag=vegetarian |
add_recipe_from_url |
通过抓取URL导入食谱。 例子: add_recipe_from_url https://example.com/recipe |
search_by_ingredient |
找到含有特定成分的食谱。 例子: search_by_ingredient chicken |
配置
| 环境变量 | 必填 | 说明 |
|---|---|---|
MEALIE_URL |
是 | 您的Mealie实例的基本URL(例如。 http://localhost:9000) |
MEALIE_API_KEY |
是 | 在Mealie配置文件中生成API令牌 |
安全说明
- API密钥从不记录-所有错误消息中的凭据都经过编辑
- 永远不要硬编码凭据;使用环境变量
.env被忽视了--.env.example可以安全地提交
发展
克隆仓库并安装依赖项:
git clone https://github.com/schaferandrew/mealie-mcp-server.git
cd mealie-mcp-server
npm install
npm run build
测试您的Mealie连接:
MEALIE_URL=http://your-instance MEALIE_API_KEY=your-key npm run test-connection
发布新版本
当GitHub Release发布时,Release会自动发布到npm。
第一步——升级版本并打开PR:
# Pick one based on the nature of your changes:
npm version patch --no-git-tag-version # 0.1.0 → 0.1.1 (bug fixes)
npm version minor --no-git-tag-version # 0.1.0 → 0.2.0 (new features)
npm version major --no-git-tag-version # 0.1.0 → 1.0.0 (breaking changes)
VERSION=$(node -p "require('./package.json').version")
git checkout -b release/v$VERSION
git add package.json package-lock.json
git commit -m "chore: bump version to $VERSION"
git push -u origin release/v$VERSION
gh pr create --title "chore: release v$VERSION" --body "Version bump to v$VERSION." --base main
步骤2——合并PR后,创建GitHub Release:
# Make sure you're on main with the latest changes
git checkout main && git pull origin main
VERSION=$(node -p "require('./package.json').version")
gh release create "v$VERSION" \
--title "v$VERSION" \
--generate-notes
GitHub Actions将自动发布到npm。
注:
NPM_TOKEN必须在您的仓库中设置 设置→ 秘密与变量→ 行动。需要 GitHub命令行界面 (gh).
许可证
麻省理工学院