Skip to main content
Glama
mealie-mcp

mealie-mcp

by ni-c

mealie-mcp

CI npm downloads container node license docs

一个面向Mealie(自托管食谱管理器与膳食规划器)的模型上下文协议服务器。

它为模型提供经过筛选的 Mealie 实例视图:搜索和读取食谱及其配料与步骤,从网站导入新食谱,整理标签和分类,规划膳食,根据规划生成购物清单,以及记录实际烹饪内容。

📖 完整文档请访问 mealie-mcp.ni-c.de

演示

Mealie 的 REST API 在 175 个路径上共有 259 个操作。此服务器暴露了 52 个工具,选择方式使得常见任务只需一次调用,而危险区域完全不可达。已验证兼容 Mealie v3.22.0;每个请求形态的最终依据是运行中实例的 GET /openapi.json,而非已发布的文档,后者在多个地方已过时。

要求

  • Node.js 22 或更高版本

  • 一个 Mealie 实例以及从 设置 → API 令牌 获取的 API 令牌

Related MCP server: Blender Open MCP

配置

变量

必需

描述

MEALIE_URL

是

基础 URL,例如 https://mealie.example.com

MEALIE_API_TOKEN

是

从设置 → API 令牌获取的令牌。它代表创建该令牌的用户。

MEALIE_READ_ONLY

否

恰好为 true 时仅注册 17 个只读工具

MEALIE_ACCEPT_LANGUAGE

否

例如 de-DE;本地化单位和标签名称

MEALIE_INSECURE_TLS

否

恰好为 true 时接受自签名证书,作用域仅限于此连接

两个布尔值均与字面字符串 true 进行比较,因此拼写错误会使它们保持 关闭 状态——请检查 stderr 上的启动行,其中会报告生效的模式。

一旦读取令牌,它将从进程环境中移除,因此子进程无法从 /proc/<pid>/environ 中获取它。

安装

Claude Desktop,或任何接受 JSON 配置的 MCP 客户端:

{
  "mcpServers": {
    "mealie": {
      "command": "npx",
      "args": ["-y", "@ni-c/mealie-mcp"],
      "env": {
        "MEALIE_URL": "https://mealie.example.com",
        "MEALIE_API_TOKEN": "…"
      }
    }
  }
}
claude mcp add mealie \
  -e MEALIE_URL=https://mealie.example.com \
  -e MEALIE_API_TOKEN=… \
  -- npx -y @ni-c/mealie-mcp

Codex(~/.codex/config.toml):

[mcp_servers.mealie]
command = "npx"
args = ["-y", "@ni-c/mealie-mcp"]

[mcp_servers.mealie.env]
MEALIE_URL = "https://mealie.example.com"
MEALIE_API_TOKEN = "…"

或作为容器:

docker run --rm -i \
  -e MEALIE_URL=https://mealie.example.com \
  -e MEALIE_API_TOKEN=… \
  ghcr.io/ni-c/mealie-mcp

要交互式地试用工具:

npx @modelcontextprotocol/inspector npx -y @ni-c/mealie-mcp

工具

食谱 — search_recipes、get_recipe、suggest_recipes、create_recipe、update_recipe、duplicate_recipe、set_recipe_last_made、delete_recipe 🔒

导入 — preview_recipe_url(试运行,不保存任何内容)、import_recipe_from_url、import_recipe_from_html_or_json、import_recipe_from_image

整理 — list_organizers、create_organizer、update_organizer、delete_organizer 🔒 — 每个均接受 kind: tag | category | tool

配料 — list_foods、create_food、merge_foods 🔒、list_units、create_unit、merge_units 🔒、parse_ingredients

膳食计划 — list_mealplans、get_todays_meals、create_mealplan_entry、create_random_meal、update_mealplan_entry、delete_mealplan_entry 🔒

购物 — list_shopping_lists、get_shopping_list、create_shopping_list、delete_shopping_list 🔒、add_shopping_list_items、update_shopping_list_items、delete_shopping_list_items 🔒、add_recipe_to_shopping_list、remove_recipe_from_shopping_list

食谱集 — list_cookbooks、get_cookbook、create_cookbook、delete_cookbook 🔒

笔记与分享 — set_recipe_rating、add_recipe_comment、delete_recipe_comment 🔒、list_recipe_comments、list_recipe_timeline、create_timeline_event、list_share_tokens、create_share_token 🔒、delete_share_token

实例 — get_about

🔒 需要确认令牌:先调用一次以获取令牌,然后再次调用时带上令牌。

食谱可以在任何地方通过 slug 或 UUID 引用——Mealie 的标识符空间分为这两种,工具会解析它们接收到的任意一种。

故意未暴露的内容

/api/admin 下的所有内容(备份、恢复、维护、用户、组和家庭管理、电子邮件、AI 提供商设置)、/api/users/api-tokens(生成 API 凭据的工具属于权限提升面)、认证路由、用户 CRUD 和密码、Webhook、事件通知和食谱操作(三者都会触发从实例发出的 HTTP 请求)、膳食计划规则、迁移、种子数据、邀请、批量导出和 ZIP 下载,以及资产和图片上传。

PUT /api/recipes/{slug} 也未暴露:它会替换整个包含 33 个字段的食谱对象,因此通过它进行部分更新会静默丢弃配料、步骤和标签。update_recipe 使用 PATCH。

安全性

  • 实例内容是不可信的输入。 食谱通常从任意网站抓取,评论来自其他用户,因此每个可能包含实例内容的工具结果都会以显式标记开头,告知模型将其视为数据。这在导入后也同样重要:文本保留在数据库中,并通过 get_recipe 返回。

  • 导入工具让 Mealie 执行抓取,而非此服务器。 URL 仅限于公共 http/https 地址;回环地址、私有范围地址、链路本地地址以及 .lan/.internal/.local 主机均被拒绝。

  • 确认提示不会引用上游文本——仅包含 ID、计数和标志。

  • 响应有边界限制:过大的结果会丢弃整个条目,而不是在 JSON 字符串中间截断,并且响应体永远不会读取超过 8 MB。

  • 拒绝重定向,以防令牌被重新发送到其他主机。

有关信任模型以及如何报告漏洞,请参见 SECURITY.md。

开发

npm install && npm test && npm run build

scripts/verify-live.mjs 会针对一个 可丢弃的 Mealie 实例执行所有 52 个工具;设置实例的说明在 CONTRIBUTING.md 中。

架构图和社交卡片由 npm run assets 从 docs/assets/architecture.source.svg 和 docs/assets/og.json 生成;如果渲染后的副本被手动编辑,CI 会失败。

发布

一切由标签驱动;无需手动发布步骤。

  1. 将 CHANGELOG.md 中的 [Unreleased] 部分移至新版本并注明日期。发布工作流会使用 awk 提取该部分,因此 ## [x.y.z] 标题格式很重要。

  2. 更新 package.json 中的 version。

  3. 执行 npm run lint && npm run build && npm run test:coverage。

  4. 提交,然后创建一个 签名并注释的 标签:

    git tag -s v0.1.1 -m "v0.1.1"
    git push origin main v0.1.1

随后 release.yml 会验证标签是否与 package.json 匹配,通过 受信任发布(OIDC——不存在可泄露的 npm 令牌)并附带来源证明地将包发布到 npm,将版本同步到 server.json 的两个包条目中,发布到 MCP 注册表,并根据 changelog 部分创建 GitHub 发布。ci.yml 会并行地将多架构容器镜像推送到 GHCR。

许可证

MIT

Available Tools

54 tools
add_recipe_commentComment on a recipeA

Adds a comment to a recipe. Comments are visible to everyone in the group and are attributed to the user the API token belongs to.

Inputs: text (required), recipe (required). Returns: source, truncated, untrusted

add_recipe_to_shopping_listAdd a recipe to a shopping listA

Adds a recipe's ingredients to a shopping list, merging them with what is already there. Mealie remembers the recipe on the list, so remove_recipe_from_shopping_list can take exactly these ingredients back off again.

Inputs: recipe (required), list_id (required), servings_multiplier. Returns: source, truncated, untrusted

add_shopping_list_itemsAdd items to a shopping listA

Adds items to a shopping list as free text ("2 tbsp olive oil"). Mealie does not split these into food and unit automatically — run parse_ingredients first if that matters.

Inputs: items (required), list_id (required). Returns: source, truncated, untrusted

create_cookbookCreate cookbookA

Creates a cookbook — a named, saved view of the recipe collection. Without a filter it matches every recipe; the filter itself is written in Mealie's own query language and is easiest to build in the web UI. A private cookbook is created straight away; is_public requires confirmation, because it is a publishing step.

Inputs: name (required), is_public, description, query_filter, +1 more. Returns: source, truncated, untrusted

create_foodCreate foodB

Adds a food to the group vocabulary so ingredient lines can be matched against it.

Inputs: name (required), label_id, description, plural_name. Returns: source, truncated, untrusted

create_mealplan_entryAdd to the meal planA

Puts a recipe or a free-text note on the meal plan for one day. Give either a recipe or a title, not both — Mealie stores a plan entry as one or the other.

Inputs: date (required), entry_type (required), text, title, +1 more. Returns: source, truncated, untrusted

create_organizerCreate a tag, category or toolA

Creates a tag, category or recipe tool. Assigning one to a recipe with update_recipe already creates it on the fly — this tool is for defining one up front.

Inputs: kind (required), name (required). Returns: source, truncated, untrusted

create_random_mealAdd a random mealA

Lets Mealie pick a recipe for a day and slot, honouring the meal plan rules configured in the household.

Inputs: date (required), entry_type (required). Returns: source, truncated, untrusted

create_recipeCreate recipeB

Creates a recipe from the given fields. To add one from a website use import_recipe_from_url instead — it fills in far more.

Inputs: name (required), tags, notes, servings, +9 more. Returns: source, truncated, untrusted

create_share_tokenCreate a public share linkA

Creates a link that lets anyone read one recipe without logging in. Requires confirmation: call once to receive a token, then again with that token.

Inputs: recipe (required), expires_at, confirm_token. Returns: source, truncated, untrusted

create_shopping_listCreate shopping listA

Creates an empty shopping list in the household.

Inputs: name (required). Returns: source, truncated, untrusted

create_timeline_eventAdd a timeline entryA

Adds an entry to a recipe's timeline — typically a note about having cooked it and how it turned out. Pair it with set_recipe_last_made, which is what the recipe view sorts on.

Inputs: recipe (required), subject (required), message, timestamp. Returns: source, truncated, untrusted

create_unitCreate unitB

Adds a measurement unit to the group vocabulary.

Inputs: name (required), fraction, description, plural_name, +2 more. Returns: source, truncated, untrusted

delete_cookbookDelete cookbookA
DestructiveIdempotent

Deletes a cookbook. The recipes it matched are not touched — a cookbook is only a saved filter. Requires confirmation: call once to receive a token, then again with that token.

Inputs: cookbook_id (required), confirm_token. Returns: truncated, deleted_cookbook_id

delete_mealplan_entryRemove a meal plan entryA
DestructiveIdempotent

Removes one entry from the meal plan. The recipe itself is not touched. Requires confirmation: call once to receive a token, then again with that token.

Inputs: entry_id (required), confirm_token. Returns: truncated, removed_entry_id

delete_organizerDelete a tag, category or toolA
DestructiveIdempotent

Deletes a tag, category or tool. The recipes themselves are kept, but they lose the assignment. Requires confirmation: call once to receive a token, then again with that token.

Inputs: id (required), kind (required), confirm_token. Returns: deleted, truncated, deleted_id

delete_recipeDelete recipeA
DestructiveIdempotent

Deletes a recipe permanently, together with its comments, timeline and images. Requires confirmation: call once to receive a token, then again with that token.

Inputs: recipe (required), confirm_token. Returns: truncated, deleted_recipe_id

delete_recipe_commentDelete a recipe commentA
DestructiveIdempotent

Deletes a comment. Requires confirmation: call once to receive a token, then again with that token.

Inputs: comment_id (required), confirm_token. Returns: truncated, deleted_comment_id

delete_share_tokenRevoke a public share linkA
DestructiveIdempotent

Revokes a share link, so the recipe is no longer readable through it. Asks a person first; where the client cannot show a dialog, call once to receive a token and again with it.

Inputs: token_id (required), confirm_token. Returns: truncated, revoked_token_id

delete_shopping_listDelete shopping listA
DestructiveIdempotent

Deletes a shopping list and everything on it. Requires confirmation: call once to receive a token, then again with that token.

Inputs: list_id (required), confirm_token. Returns: truncated, deleted_list_id

delete_shopping_list_itemsRemove shopping list itemsA
DestructiveIdempotent

Removes items from a shopping list for good. To merely tick something off, use update_shopping_list_items with checked=true. Requires confirmation: call once to receive a token, then again with that token.

Inputs: item_ids (required), confirm_token. Returns: truncated, removed_count, removed_item_ids

duplicate_recipeDuplicate recipeA

Creates a copy of a recipe under a new name, leaving the original untouched. Useful as a starting point for a variation.

Inputs: recipe (required), name. Returns: source, truncated, untrusted

get_aboutAbout this Mealie instanceA
Read-onlyIdempotent

Reports the Mealie version and the identity the API token acts as: user, group, household and the permission flags that decide which write tools will actually succeed. Start here when a call fails with a 403.

Inputs: no named parameters. Returns: truncated

get_cookbookGet cookbookA
Read-onlyIdempotent

Fetches a cookbook and the recipes it currently matches. Accepts the slug or the UUID.

Inputs: cookbook (required), per_page. Returns: source, truncated, untrusted

get_recipeGet recipeA
Read-onlyIdempotent

Fetches one recipe with everything needed to cook it: ingredients, steps, times, yield, notes and nutrition. Accepts the slug or the UUID.

Inputs: recipe (required), detail. Returns: source, truncated, untrusted

get_shopping_listGet shopping listA
Read-onlyIdempotent

Fetches one shopping list with all of its items, checked and unchecked.

Inputs: list_id (required), include_checked. Returns: source, truncated, untrusted

get_todays_mealsGet today's mealsA
Read-onlyIdempotent

Returns the recipes planned for today, as Mealie computes "today" for the household. Answers with a bare list, not a paginated envelope.

Inputs: no named parameters. Returns: source, truncated, untrusted

import_recipe_from_html_or_jsonImport recipe from HTML or JSONA

Creates a recipe from HTML or schema.org recipe JSON supplied directly, so Mealie does not fetch the page. Useful for a page that needs a login, or one that import_recipe_from_url could not parse.

It does not fetch the page, but it is not fetch-free: Mealie reads the image address out of the document and retrieves that. Every such address this server can find is checked before the document is handed over, and an internal one is refused — but a document can hide an address in ways a scan does not see, so do not paste one from a source you would not let Mealie make a request for.

Inputs: data (required). Returns: source, truncated, untrusted

import_recipe_from_imageImport recipe from imageA

Creates a recipe from a photo of one — a cookbook page, a handwritten card — by having Mealie run it through its configured AI provider. Requires an AI provider set up in Mealie; without one the call fails, and the setting itself is only visible to a group manager or admin.

Inputs: format (required), image_base64 (required), translate_language. Returns: source, truncated, untrusted

import_recipe_from_urlImport recipe from URLA

Has Mealie fetch a recipe page and save it as a new recipe. The fetch happens on the Mealie server, not here. Everything the page contains — name, description, ingredients, steps — ends up in the collection as written by whoever controls that site.

Inputs: url (required), include_tags, include_categories. Returns: source, truncated, untrusted

list_cookbooksList cookbooksA
Read-onlyIdempotent

Lists the cookbooks of the household. A cookbook is a saved filter over the recipe collection, not a fixed set of recipes.

Inputs: page, per_page. Returns: source, truncated, untrusted

list_foodsList foodsA
Read-onlyIdempotent

Lists the structured foods of the group — the ingredient vocabulary Mealie matches ingredient lines against. Many instances leave this empty and keep ingredients as plain text; an empty result means exactly that, not a failure.

Inputs: page, search, per_page, order_direction. Returns: source, truncated, untrusted

list_mealplansList meal plan entriesA
Read-onlyIdempotent

Lists the meal plan of the household in a date range. Each entry is either a recipe reference or a free-text note.

Inputs: page, end_date, per_page, start_date. Returns: source, truncated, untrusted

list_organizersList tags, categories or toolsA
Read-onlyIdempotent

Lists the tags, categories or tools defined in the group, with their ids and slugs. These are the values search_recipes filters on.

Inputs: kind (required), page, search, per_page, +1 more. Returns: source, truncated, untrusted

list_recipe_commentsList recipe commentsA
Read-onlyIdempotent

Lists the comments other users of the instance left on a recipe.

Inputs: recipe (required). Returns: source, truncated, untrusted

list_recipe_timelineList recipe timelineA
Read-onlyIdempotent

Lists the timeline of a recipe: when it was created, updated and each time it was cooked, with the notes attached to those events.

Inputs: recipe (required), page, per_page. Returns: source, truncated, untrusted

list_share_tokensList recipe share linksA
Read-onlyIdempotent

Lists the public share links that currently exist, with the recipe each one exposes and when it expires. Anyone holding such a link can read the recipe without an account.

Inputs: recipe. Returns: source, truncated, untrusted

list_shopping_listsList shopping listsA
Read-onlyIdempotent

Lists the shopping lists of the household, without their items.

Inputs: page, per_page. Returns: source, truncated, untrusted

list_unitsList unitsA
Read-onlyIdempotent

Lists the measurement units of the group, with their abbreviations. Like foods, this is empty on an instance that never seeded them.

Inputs: page, search, per_page, order_direction. Returns: source, truncated, untrusted

merge_foodsMerge foodsA
DestructiveIdempotent

Points every ingredient that uses one food at another one and deletes the source food. Requires confirmation: call once to receive a token, then again with that token.

Inputs: to_id (required), from_id (required), confirm_token. Returns: source, truncated, untrusted

merge_unitsMerge unitsA
DestructiveIdempotent

Points every ingredient that uses one unit at another one and deletes the source unit. Requires confirmation: call once to receive a token, then again with that token.

Inputs: to_id (required), from_id (required), confirm_token. Returns: source, truncated, untrusted

parse_ingredientsParse ingredient linesA
Read-onlyIdempotent

Splits free-text ingredient lines into quantity, unit, food and note, and reports how confident Mealie is about each part. Nothing is saved. Use it to check how a line will be understood before writing it to a recipe or a shopping list.

Inputs: ingredients (required), parser. Returns: source, truncated, untrusted

parse_recipe_ingredientsParse recipe ingredientsA
DestructiveIdempotent

Structures a recipe's unparsed ingredient lines in place: Mealie's parser splits each line into quantity, unit, food and note, and the lines whose food and unit exist in Mealie and whose confidence is high enough are written back. Lines that already have a food are left alone. Everything else comes back under needs_decision with the reason — ask the user there, then create the food with create_food and run this again, or pass the existing food they chose in overrides. Runs as a dry run unless dry_run is false; writing requires confirmation: call once to receive a token, then again with that token. Find recipes to work through with search_recipes unparsed_only.

Inputs: recipe (required), parser, dry_run, overrides, +2 more. Returns: source, truncated, untrusted

preview_recipe_urlPreview a recipe URLA
Read-onlyIdempotent

Fetches a URL and reports what Mealie would extract from it, WITHOUT saving anything. Use this to check a page before importing it, or to find out why an import came out empty.

Inputs: url (required). Returns: source, truncated, untrusted

remove_recipe_from_shopping_listRemove a recipe from a shopping listA

Takes a recipe's ingredients back off a shopping list. Items that were also needed by another recipe on the list stay, with their quantity reduced.

Inputs: recipe (required), list_id (required), servings_multiplier. Returns: source, truncated, untrusted

search_recipesSearch recipesA
Read-onlyIdempotent

Searches the recipe collection. Returns summaries — name, slug, id, times, rating, tags and categories — without ingredients or steps; use get_recipe for those. search, the organizer filters and the date range combine with AND; within one filter the entries are OR unless the matching require_all_* flag is set. cookbook is the exception: Mealie applies a cookbook instead of the tag, category, tool and food filters, so combining them is rejected here rather than silently ignored.

Inputs: page, tags, foods, tools, +11 more. Returns: source, truncated, untrusted

set_recipe_imageSet recipe imageA

Replaces a recipe's cover image.

Inputs: format (required), recipe (required), image_base64 (required). Returns: recipe, truncated, image_version

set_recipe_last_madeSet last madeA

Records when a recipe was last cooked. Mealie shows this on the recipe and sorts by it.

Inputs: recipe (required), timestamp (required). Returns: recipe, last_made, truncated

set_recipe_ratingRate a recipeA

Sets the personal rating of a recipe and/or marks it as a favourite. Ratings in Mealie are per user, not per recipe.

Inputs: recipe (required), rating, is_favorite. Returns: source, truncated, untrusted

suggest_recipesSuggest recipesA
Read-onlyIdempotent

Suggests recipes that can be cooked from the foods and tools marked as "on hand" in Mealie, ranked by how little is missing. This only produces anything on an instance that actually maintains structured foods, units and an on-hand pantry — on a collection of plain text ingredients it returns nothing. Use search_recipes there.

Inputs: foods, limit, tools, max_missing_foods, +1 more. Returns: source, truncated, untrusted

update_mealplan_entryChange a meal plan entryA
DestructiveIdempotent

Moves an entry to another day or slot, or replaces the recipe behind it. Replacing the written title or note of an entry requires confirmation: call once to receive a token, then again with that token. Moving the entry or swapping the recipe does not.

Inputs: entry_id (required), date, text, title, +3 more. Returns: source, truncated, untrusted

update_organizerRename a tag, category or toolA
DestructiveIdempotent

Renames a tag, category or tool. Mealie regenerates the slug from the new name, so anything referring to the old slug stops matching. Requires confirmation: call once to receive a token, then again with that token.

Inputs: id (required), kind (required), name (required), confirm_token. Returns: source, truncated, untrusted

update_recipeUpdate recipeA
DestructiveIdempotent

Changes individual fields of a recipe. Only the fields given are touched; everything else keeps its value. Passing an empty array for ingredients, instructions, tags or categories clears that list. Replacing written content — name, description, ingredients, instructions, tags, categories or notes — requires confirmation: call once to receive a token, then again with that token. Changing only times, servings, yield or the source link does not.

Inputs: recipe (required), name, tags, notes, +11 more. Returns: source, truncated, untrusted

update_shopping_list_itemsTick off or change shopping list itemsA
DestructiveIdempotent

Changes items on a shopping list — most often ticking them off. Only the given fields are changed; the rest of each item is preserved. Ticking off and changing quantities is immediate; replacing the text of the items with note requires confirmation, because that text is overwritten on every item named and Mealie keeps no copy.

Inputs: list_id (required), item_ids (required), note, checked, +2 more. Returns: source, truncated, untrusted

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 54 tools

    Disambiguation4/5

    Most tools target a distinct resource+action and the descriptions carefully delimit overlaps, e.g. search_recipes vs get_recipe, and the three import_recipe_from_* variants. The main ambiguity is parse_recipe_ingredients (writes back to a recipe) vs parse_ingredients (dry-run only), plus mild overlap between set_recipe_last_made and create_timeline_event, but the descriptions disambiguate these adequately.

    Naming Consistency5/5

    Nearly every tool follows a clean verb_noun snake_case pattern (get_recipe, create_mealplan_entry, delete_shopping_list_items, merge_foods). The few oddities like get_about or get_todays_meals still fit the same convention. No mixing of camelCase or vague verbs.

    Tool Count2/5

    54 tools is well above the 25+ threshold for 'too many'. While the domain (recipes, organizers, foods, units, meal plans, shopping lists, cookbooks, share tokens, comments, timeline, imports) is genuinely broad, the surface is heavy enough to strain selection and could be consolidated.

    Completeness4/5

    Coverage is strong: full lifecycle for recipes, meal plan entries, shopping lists, cookbooks, share tokens, comments and organizers, plus imports, images, ratings and parsing. Minor gaps exist around foods/units, which have create and merge but no update or delete, though merge largely covers consolidation.

    Maintenance

    ActivityActive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers