Mealie MCP Server

Mealie MCP Server

Connects MCP clients like Claude to your Mealie recipe manager, enabling natural language search, creation, import, and updates of recipes.

Category
访问服务器

README

Mealie MCP Server

License: MIT Node.js 20+

An MCP (Model Context Protocol) server that connects Claude and other MCP clients to your Mealie recipe manager instance. Search, create, import, and update recipes through natural language.

Features

  • Get Recipe — Retrieve full recipe details by slug or ID
  • Search Recipes — Free-text search with filtering by category, tag, food, and tool
  • Create Recipe — Create recipes from structured data (name, ingredients, instructions, etc.)
  • Import Recipe — Import recipes by URL (Mealie scrapes the page automatically)
  • Update Recipe — Modify any field on an existing recipe

Prerequisites

  • Mealie v1+ instance running and accessible
  • A Mealie API token (generate at <your-mealie-url>/user/profile/api-tokens)
  • Node.js 20+ (for local usage) or Docker

Transports

The server supports two transports:

Transport Use case Entry point
stdio (default) Claude Desktop, Claude Code, local MCP clients build/index.js
Streamable HTTP Claude.ai web/mobile, remote access, multi-user build/http.js

Authentication

There are two separate auth layers — one for the server to talk to Mealie, and one for clients to talk to the server:

Claude.ai ──OAuth 2.0──▶ MCP Server ──API Token──▶ Mealie
  1. Mealie API Token (MEALIE_API_TOKEN) — The server's backend credential for accessing Mealie's REST API. Required for both transports. Generate one at <your-mealie-url>/user/profile/api-tokens.

  2. OAuth 2.0 + PKCE (HTTP transport only) — How remote clients like Claude.ai authenticate to the MCP server. Users log in with their Mealie username and password via a browser-based flow. The server validates credentials against Mealie and issues OAuth tokens. Not used with stdio transport.

In short: the API token lets the server access recipes, and OAuth lets users prove who they are.

Configuration

Copy .env.example to .env and fill in your values:

cp .env.example .env

Environment variables

Variable Required Description
MEALIE_URL Yes Base URL of your Mealie instance (e.g. http://localhost:9925)
MEALIE_API_TOKEN Yes Your Mealie API token
MCP_SERVER_URL HTTP mode only Public URL of this server (e.g. https://mcp.your-domain.com) — used as the OAuth issuer URL
PORT No HTTP server port (default: 3000, HTTP mode only)
TRANSPORT No Set to http for HTTP mode in Docker (default: stdio)

Usage

With Claude Desktop (stdio)

Add to your claude_desktop_config.json:

Using Docker:

{
  "mcpServers": {
    "mealie": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "-e", "MEALIE_URL",
        "-e", "MEALIE_API_TOKEN",
        "mealie-mcp-server"
      ],
      "env": {
        "MEALIE_URL": "http://your-mealie-instance:9925",
        "MEALIE_API_TOKEN": "your-api-token"
      }
    }
  }
}

Using Node.js directly:

{
  "mcpServers": {
    "mealie": {
      "command": "node",
      "args": ["/path/to/mealie-mcp-server/build/index.js"],
      "env": {
        "MEALIE_URL": "http://your-mealie-instance:9925",
        "MEALIE_API_TOKEN": "your-api-token"
      }
    }
  }
}

With Claude Code (stdio)

claude mcp add mealie -- node /path/to/mealie-mcp-server/build/index.js \
  -e MEALIE_URL=http://your-mealie-instance:9925 \
  -e MEALIE_API_TOKEN=your-api-token

HTTP Transport (Claude.ai web / remote access)

The HTTP transport uses OAuth 2.0 with PKCE, with Mealie credentials as the identity provider. Users authenticate via a login page using their Mealie username and password. This makes it compatible with Claude.ai (web and mobile), which requires OAuth-capable MCP servers.

Requirements: The server must be reachable at a public HTTPS URL (MCP_SERVER_URL).

Using Node.js:

MEALIE_URL=http://your-mealie:9925 \
MEALIE_API_TOKEN=your-api-token \
MCP_SERVER_URL=https://mcp.your-domain.com \
node build/http.js

Using Docker:

docker run --rm \
  -p 3000:3000 \
  -e TRANSPORT=http \
  -e MEALIE_URL=http://your-mealie:9925 \
  -e MEALIE_API_TOKEN=your-api-token \
  -e MCP_SERVER_URL=https://mcp.your-domain.com \
  mealie-mcp-server

Using Docker Compose:

# Set env vars in .env file, then:
docker compose up mealie-mcp-server-http

Connecting Claude.ai to the HTTP endpoint:

In Claude.ai settings, add a new MCP server pointing at https://mcp.your-domain.com/mcp. Claude.ai will discover the OAuth metadata automatically and prompt you to log in with your Mealie credentials.

Nginx configuration:

See nginx-mcp.conf.example for the location blocks needed to proxy MCP and OAuth traffic when running behind nginx.

A health check endpoint is available at GET /health.

Note on auth state: The HTTP server stores OAuth tokens in memory. Restarting the server invalidates all existing sessions and requires clients to re-authenticate.

Tools

get_recipe

Get a recipe by its slug or ID.

Parameter Type Required Description
slug string Yes Recipe slug or UUID

search_recipes

Search and list recipes with optional filters.

Parameter Type Required Description
search string No Free-text search query
categories string[] No Filter by category slugs or IDs
tags string[] No Filter by tag slugs or IDs
foods string[] No Filter by food slugs or IDs
tools string[] No Filter by tool slugs or IDs
requireAllCategories boolean No Require all specified categories
requireAllTags boolean No Require all specified tags
page number No Page number (default: 1)
perPage number No Results per page (default: 50)
orderBy string No Sort field (e.g. createdAt, name)
orderDirection asc | desc No Sort direction

create_recipe

Create a recipe from structured data.

Parameter Type Required Description
name string Yes Recipe name
description string No Short description
recipeYield string No Yield (e.g. "4 servings")
prepTime string No Prep time
cookTime string No Cook time
totalTime string No Total time
recipeIngredient object[] No Ingredients list
recipeInstructions object[] No Instruction steps
nutrition object No Nutritional info
recipeCategory object[] No Categories
tags object[] No Tags
notes object[] No Recipe notes

import_recipe

Import a recipe by URL. Mealie scrapes the page and extracts recipe data.

Parameter Type Required Description
url string Yes URL of the recipe page
includeTags boolean No Extract tags from the page
includeCategories boolean No Extract categories from the page

update_recipe

Update fields on an existing recipe. Only provided fields are changed.

Parameter Type Required Description
slug string Yes Recipe slug or UUID to update
name string No New name
description string No New description
recipeYield string No New yield
prepTime string No New prep time
cookTime string No New cook time
recipeIngredient object[] No Replacement ingredients
recipeInstructions object[] No Replacement instructions
nutrition object No Nutritional info
recipeCategory object[] No Categories
tags object[] No Tags
notes object[] No Notes

Development

Setup

npm install

Build

npm run build

Run in development

# stdio transport
MEALIE_URL=http://localhost:9925 MEALIE_API_TOKEN=your-token npm run dev

# HTTP transport
MEALIE_URL=http://localhost:9925 MEALIE_API_TOKEN=your-token \
MCP_SERVER_URL=http://localhost:3000 npm run dev:http

Test

npm test

# With coverage
npm run test:coverage

# Watch mode
npm run test:watch

Docker

# Build the image
docker build -t mealie-mcp-server .

# Run (stdio)
docker run -i --rm \
  -e MEALIE_URL=http://your-mealie:9925 \
  -e MEALIE_API_TOKEN=your-token \
  mealie-mcp-server

# Run (HTTP with OAuth)
docker run --rm -p 3000:3000 \
  -e TRANSPORT=http \
  -e MEALIE_URL=http://your-mealie:9925 \
  -e MEALIE_API_TOKEN=your-token \
  -e MCP_SERVER_URL=https://mcp.your-domain.com \
  mealie-mcp-server

Architecture

src/
├── index.ts              # stdio entry point
├── http.ts               # HTTP entry point (Streamable HTTP transport + OAuth)
├── server.ts             # Creates MCP server and registers all tools (transport-agnostic)
├── mealie-client.ts      # HTTP client for the Mealie REST API
├── types.ts              # TypeScript type definitions for Mealie API shapes
├── auth/
│   ├── provider.ts       # OAuth 2.0 provider (validates Mealie credentials, issues tokens)
│   └── login-page.ts     # HTML login page rendered during OAuth authorization flow
└── tools/
    ├── get-recipe.ts     # get_recipe tool
    ├── search-recipes.ts # search_recipes tool
    ├── create-recipe.ts  # create_recipe tool
    ├── import-recipe.ts  # import_recipe tool
    └── update-recipe.ts  # update_recipe tool

The server core (server.ts) is transport-agnostic — it builds the MCP server and registers tools without knowing which transport will be used. The two entry points (index.ts for stdio, http.ts for HTTP) each wire in their respective transport.

  • stdio communicates via stdin/stdout using JSON-RPC 2.0. Standard for Claude Desktop and local MCP clients.
  • Streamable HTTP exposes a /mcp endpoint supporting POST (requests), GET (SSE stream), and DELETE (session termination). Uses stateful sessions with Mcp-Session-Id headers. Full OAuth 2.0 + PKCE authentication using Mealie credentials as the identity provider.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选