Mealie MCP Server
A security-conscious MCP server for self-hosted Mealie that enables recipe management, meal planning, and shopping list operations with robust security defaults.
README
Mealie MCP Server
A security-conscious Model Context Protocol server for self-hosted Mealie instances.
It exposes recipe search and import, shopping lists, meal plans, organizers, ingredient parsing, OCR helpers, recipe images/assets, Chefkoch lookup, and a guarded bridge to non-sensitive Mealie OpenAPI operations.
Community project. Not affiliated with or endorsed by Mealie.
Security defaults
- Read-only by default: mutations require
MEALIE_MCP_ALLOW_MUTATIONS=true. - Fail-closed scopes: no write is allowed unless its path matches an explicit scope.
- Explicit confirmation: every helper that persists data and every generic write requires
confirmed_by_user=true. - Sensitive API denylist: admin, authentication, user, group, invitation, webhook, and household self-service endpoints remain blocked even when mutations are enabled.
- Outbound fetches off by default: URL imports and remote file sources require separate opt-in flags in addition to mutation scopes.
- SSRF protection: enabled remote sources must resolve to public HTTP(S) addresses; loopback, private, link-local, and other non-public destinations are rejected.
- Local-file confinement: multipart uploads may only read from the MCP data directory or explicitly configured local roots.
- Credential redaction: configured tokens and passwords are removed from reported errors.
- Bounded work: JSON/OpenAPI responses, local/remote sources, downloads, image pixels, pagination, and OCR runtime have limits.
- Transport safety: remote Mealie origins require HTTPS, and authenticated Mealie requests reject redirects.
Review SECURITY.md before enabling writes.
Requirements
- Python 3.11+
- uv
- A reachable Mealie instance (tested against Mealie OpenAPI v3.21.0)
- A Mealie long-lived API token, recommended
- Optional: Tesseract for OCR (
tesseract-ocrplus the desired language packs)
Quick start
git clone https://github.com/bitmonster/mealie-mcp-server.git
cd mealie-mcp-server
uv sync --frozen
chmod +x run_mealie_mcp.sh
Create a long-lived token in Mealie under Profile → API tokens. Pass it through your MCP client environment; do not put it in source control.
Hermes Agent
mcp_servers:
mealie:
command: /absolute/path/to/mealie-mcp-server/run_mealie_mcp.sh
env:
MEALIE_BASE_URL: http://localhost:9000
MEALIE_PUBLIC_URL: https://mealie.example.com
MEALIE_API_TOKEN: "[REDACTED]"
MEALIE_MCP_ALLOW_MUTATIONS: "false"
MEALIE_MCP_MUTATION_SCOPE: none
MEALIE_MCP_ALLOW_URL_IMPORTS: "false"
MEALIE_MCP_ALLOW_REMOTE_SOURCES: "false"
Restart Hermes after changing MCP configuration, then run:
hermes mcp test mealie
Generic stdio MCP client
Configure the command as:
/absolute/path/to/mealie-mcp-server/run_mealie_mcp.sh
Set the environment variables shown in .env.example. The server reserves stdout for MCP JSON-RPC and writes startup errors to stderr.
Authentication
Preferred:
MEALIE_API_TOKEN=[REDACTED]
Optional fallback for local testing:
MEALIE_USERNAME=[REDACTED]
MEALIE_PASSWORD=[REDACTED]
The fallback performs a normal /api/auth/token login and caches the short-lived token in memory. Do not embed credentials in the repository or starter script.
Mutation scopes
Mutations require both:
MEALIE_MCP_ALLOW_MUTATIONS=true
MEALIE_MCP_MUTATION_SCOPE=<comma-separated scopes>
| Scope | Allowed write areas |
|---|---|
recipe_import |
Recipe creation/PATCH, images, assets, duplicate, last-made, ZIP/image/URL imports |
shopping |
Shopping lists, items, bulk operations, recipe ingredients added to lists |
mealplan |
Meal-plan entries, random suggestions, and meal-plan rules |
parser |
Generic parser API mutations; the dedicated non-persisting ingredient parser does not require mutation mode |
organizers |
Categories, tags, foods, and units |
cookbooks |
Household cookbooks |
comments |
Recipe comments |
timeline |
Recipe timeline events and images |
recipe_actions |
Household recipe actions |
all |
Every non-sensitive mutation; use only for tightly trusted clients |
Example for recipe imports and organizer cleanup:
MEALIE_MCP_ALLOW_MUTATIONS=true
MEALIE_MCP_MUTATION_SCOPE=recipe_import,organizers
Scopes do not override the sensitive-endpoint denylist or confirmation requirements.
URL imports additionally require MEALIE_MCP_ALLOW_URL_IMPORTS=true. Remote image or asset sources additionally require MEALIE_MCP_ALLOW_REMOTE_SOURCES=true.
Main capabilities
The server currently registers 38 MCP tools, including:
- recipe search, lookup, suggestions, URL/text imports, duplication, last-made updates;
- image replacement, source asset upload, cover cropping, and cookbook-image OCR;
- shopping-list and meal-plan CRUD helpers using Mealie v3 full-model updates;
- organizer listing and ingredient parsing;
- Chefkoch search and recipe extraction;
- live OpenAPI catalog search;
- generic JSON/multipart requests and controlled binary downloads for non-sensitive operations.
Use mealie_api_operations before a generic OpenAPI call. It validates operation IDs, path/query parameters, required body fields, content type, sensitivity, confirmation, and mutation scope.
File and download configuration
| Variable | Default | Purpose |
|---|---|---|
MEALIE_MCP_DATA_DIR |
~/.cache/mealie-mcp |
Runtime data root |
MEALIE_MCP_DOWNLOAD_DIR |
$DATA_DIR/downloads |
Controlled download directory |
MEALIE_MCP_ALLOWED_LOCAL_ROOTS |
empty | Additional local upload roots, separated by the OS path separator |
MEALIE_MCP_MAX_DOWNLOAD_BYTES |
100 MiB | Maximum binary download size |
MEALIE_MCP_MAX_JSON_BYTES |
10 MiB | Maximum JSON response size |
MEALIE_MCP_MAX_OPENAPI_BYTES |
20 MiB | Maximum OpenAPI response size |
MEALIE_MCP_MAX_IMAGE_PIXELS |
40,000,000 | Maximum decoded image pixels |
MEALIE_MCP_OCR_TIMEOUT |
60 seconds | Tesseract timeout per OCR call |
MEALIE_MCP_TIMEOUT |
30 seconds | HTTP timeout |
MEALIE_MCP_ALLOW_URL_IMPORTS |
false |
Allow Mealie to fetch validated public recipe URLs |
MEALIE_MCP_ALLOW_REMOTE_SOURCES |
false |
Allow this MCP process to fetch validated public file URLs |
Default local upload roots are $DATA_DIR/imports and the download directory. Add the narrowest possible absolute path when another client-managed media cache is needed.
Development
uv sync --frozen --all-groups
uv run python -m compileall -q mealie_server.py tests
uv run ruff check mealie_server.py tests
uv run python -m unittest discover -s tests -p 'test_*.py' -v
uv run pip-audit --skip-editable
The regression suite mocks network and filesystem boundaries. It covers mutation gating, confirmation, sensitive-path blocking, OpenAPI validation, SSRF/local-file confinement, multipart limits, Mealie v3 request shapes, ingredient preservation, and credential-safe status output.
Known boundaries
- This is a stdio MCP server, not a remotely exposed HTTP service.
- Mealie streaming/SSE import operations are intentionally unsupported.
- Generic operations follow the live Mealie OpenAPI, but dedicated helper tools may need adaptation after breaking Mealie API changes.
- Raw API paths are fail-closed unless they match a live OpenAPI operation; sensitive path prefixes and OpenAPI tags remain denied.
- Public-address validation reduces SSRF risk but cannot enforce the network behavior of Mealie itself. When enabling URL imports or remote sources, also restrict container/host egress and DNS at the deployment layer.
- Chefkoch integration is optional functionality supplied through the
get-chefkochdependency. - OCR quality depends on the local Tesseract installation and source image quality.
License
MIT — see LICENSE.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。