Skip to main content
Glama

mealie-mcp

一个 Model Context Protocol 服务器,它将 Mealie(一个自托管的食谱管理器)公开为一组 LLM 可调用的工具。它允许 Claude Desktop / Claude Code(或任何 MCP 客户端)在您自己的 Mealie 实例上搜索食谱、获取详细信息、管理膳食计划和编辑购物清单。

工具

工具

用途

search_recipes(query?, tags?, limit?)

搜索食谱;返回 slug、名称、描述、标签、类别

get_recipe(slug)

获取指定 slug 的完整食谱 JSON

list_meal_plan(start_date, end_date)

两个 ISO 日期之间的膳食计划条目

list_shopping_lists()

所有购物清单的 ID 和名称

add_shopping_list_items(list_id, items[])

向清单添加自由文本项目

create_recipe(name)

创建一个空白食谱;返回生成的 slug

create_meal_plan_entry(date, entry_type, recipe_slug?, title?)

添加膳食计划条目

Related MCP server: mealie-mcp

要求

  • Python 3.11+

  • 一个正在运行的 Mealie 实例(自托管;已针对 Mealie v2 进行测试)

  • 一个长期有效的 Mealie API 令牌(在 Mealie UI 中:用户个人资料 → API 令牌)

配置

将 .env.example 复制到 .env 并填入相应值:

cp .env.example .env

变量

必需

默认

描述

MEALIE_URL

是

—

Mealie 实例的基础 URL(例如 http://localhost:9011 或 http://mealie:9000)

MEALIE_API_TOKEN

是

—

来自 Mealie 的长期有效持有者令牌

MCP_TRANSPORT

否

sse

stdio 用于本地子进程,sse 用于 HTTP 流式传输

MCP_HOST

否

0.0.0.0

SSE 模式的绑定地址

MCP_PORT

否

8000

SSE 模式的绑定端口

本地安装与运行

pip install -e .
# stdio mode (for Claude Desktop):
MCP_TRANSPORT=stdio mealie-mcp
# sse/http mode (for docker-compose / remote clients):
MCP_TRANSPORT=sse MCP_PORT=8000 mealie-mcp

SSE 端点位于 http://<host>:<port>/sse。

Claude Desktop 配置

编辑 Claude Desktop 的配置文件(macOS: ~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "mealie": {
      "command": "mealie-mcp",
      "env": {
        "MEALIE_URL": "http://localhost:9011",
        "MEALIE_API_TOKEN": "paste-your-token-here",
        "MCP_TRANSPORT": "stdio"
      }
    }
  }
}

如果 mealie-mcp 不在您的 PATH 中,请将 command 指向完整的二进制文件路径(例如 /Users/you/.venvs/mealie-mcp/bin/mealie-mcp)或通过 Python 调用:

{
  "mcpServers": {
    "mealie": {
      "command": "python",
      "args": ["-m", "mealie_mcp"],
      "env": {
        "MEALIE_URL": "http://localhost:9011",
        "MEALIE_API_TOKEN": "paste-your-token-here",
        "MCP_TRANSPORT": "stdio"
      }
    }
  }
}

编辑配置后重启 Claude Desktop。

Docker / docker-compose

包含了一个 Dockerfile。要独立运行:

docker build -t mealie-mcp .
docker run --rm -p 8765:8000 \
  -e MEALIE_URL=http://host.docker.internal:9011 \
  -e MEALIE_API_TOKEN=your-token \
  mealie-mcp

要将服务器添加到现有的 Mealie 堆栈中,请参阅 docker-compose.snippet.yml:

services:
  mealie-mcp:
    build:
      context: ./mealie-mcp
    depends_on:
      - mealie
    environment:
      MEALIE_URL: "http://mealie:9000"
      MEALIE_API_TOKEN: "${MEALIE_API_TOKEN}"
      MCP_TRANSPORT: "sse"
      MCP_HOST: "0.0.0.0"
      MCP_PORT: "8000"
    ports:
      - "8765:8000"

将您的 MCP 客户端指向 http://<docker-host>:8765/sse。

手动测试服务器

在 SSE 模式下运行服务器时,确认其可访问:

curl -N http://localhost:8000/sse

您应该会看到一个 SSE 事件流已打开。对于 stdio 模式,Claude Desktop 会处理握手——没有 HTTP 端点。

项目布局

mealie-mcp/
├── pyproject.toml
├── Dockerfile
├── docker-compose.snippet.yml
├── .env.example
├── README.md
└── src/mealie_mcp/
    ├── __init__.py
    ├── __main__.py        # CLI entry point (loads .env, dispatches transport)
    ├── server.py          # FastMCP server + tool definitions
    └── client.py          # Async httpx wrapper for the Mealie REST API

许可证

MIT

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to interact with Mealie for recipe management, meal planning, and shopping list operations. Supports searching and managing recipes, creating meal plans, and generating shopping lists from recipes or meal plans.
      10
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables AI agents to manage recipes, meal plans, shopping lists, recipe imports, Bring! grocery sync, Mercadona price lookups, and optional nutrition using a self-hosted Mealie instance.
      24
      123 PyPI
      AGPL 3.0
    • A
      license
      A
      quality
      B
      maintenance
      Enables Claude to search, create, and update recipes and manage meal plans in a Mealie instance, including importing recipes from URLs.
      8
      MIT