mealplan-mcp

mealplan-mcp

MCP server for meal planning and grocery list generation, enabling recipe storage, meal plan creation, and automated grocery lists with ignored ingredients.

Category
访问服务器

README

Mealplan MCP

A Model Context Provider (MCP) server for meal planning and grocery list generation.

Coverage

Quick Start

# Clone the repository
git clone <repository-url>
cd mealplan-mcp

# Set up environment variable for meal plan storage
export MEALPLANPATH="/path/to/meal/plans"

# Install dependencies with uv
uv venv && source .venv/bin/activate
uv pip install -e .

# Run the server
python main.py

Features

  • Store and retrieve dish recipes with ingredients and instructions
  • Create detailed meal plans for specific dates and meal types
  • Manage ignored ingredients that should be excluded from grocery lists
  • Generate grocery lists for date ranges with automatic checkboxes
  • Full MCP (Model Context Provider) compatibility for AI-driven interfaces

Available Tools

Tool Description Example Input
create_mealplan Creates a meal plan {"meal_plan": {"date": "2023-05-01", "meal_type": "dinner", "title": "Italian Night", "cook": "Chef", "dishes": [...]}}
store_dish Stores a dish recipe {"dish_data": {"name": "Pasta", "ingredients": [...]}}
list_dishes Lists all stored dishes {}
list_mealplans_by_date_range Lists meal plans within a date range {"date_range": {"start": "2023-06-01", "end": "2023-06-07"}}
export_mealplans_to_pdf Exports meal plans to a PDF file {"date_range": {"start": "2023-06-01", "end": "2023-06-07"}}
add_ignored_ingredient Adds ingredient to ignore list {"ingredient": "salt"}
get_ignored_ingredients Gets all ignored ingredients {}
generate_grocery_list Creates a grocery list markdown {"date_range": {"start": "2023-06-01", "end": "2023-06-07"}}

Claude Desktop Setup

To use this MCP server with Claude Desktop, add the following configuration to your claude_desktop_config.json file:

macOS

# Edit the config file
open ~/Library/Application\ Support/Claude/claude_desktop_config.json

Windows

# Navigate to the config file location
%APPDATA%\Claude\claude_desktop_config.json

Configuration

Add this server configuration to your claude_desktop_config.json:

{
  "mcpServers": {
    "mealplan": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/your/mealplan-mcp",
        "run",
        "main.py"
      ],
      "env": {
        "MEALPLANPATH": "/path/to/your/meal/plans"
      }
    }
  }
}

Important:

  • Replace /path/to/your/mealplan-mcp/main.py with the actual path to your main.py file
  • Replace /path/to/your/meal/plans with your desired meal plan storage directory
  • Restart Claude Desktop after making changes

Development Setup

Prerequisites

  • Python 3.12 or higher
  • uv (recommended for dependency management)

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd mealplan-mcp
    
  2. Set up the environment variable for meal plan storage:

    # macOS/Linux
    export MEALPLANPATH="/path/to/meal/plans"
    
    # Windows Command Prompt
    set MEALPLANPATH=C:\path\to\meal\plans
    
    # Windows PowerShell
    $env:MEALPLANPATH = "C:\path\to\meal\plans"
    
  3. Set up the virtual environment:

    # Using uv (recommended)
    uv venv
    source .venv/bin/activate  # On macOS/Linux
    # .venv\Scripts\activate    # On Windows
    
    # Alternative: Using venv (built-in)
    python -m venv .venv
    source .venv/bin/activate  # On macOS/Linux
    # .venv\Scripts\activate    # On Windows
    
  4. Install dependencies:

    # For basic usage (recommended)
    uv pip install -e .
    
    # For development (includes testing tools)
    uv pip install -e ".[dev]"
    
    # Alternative: Using pip
    pip install -e .              # Basic usage
    pip install -e ".[dev]"       # Development
    

Running the Application

To start the MCP server:

python main.py

This starts the server using stdio transport, making it compatible with MCP client applications.

Testing

The project includes comprehensive testing with automatic test isolation:

# Run all tests
pytest

# Run with coverage
pytest --cov=mealplan_mcp

# Generate a coverage report
pytest --cov=mealplan_mcp --cov-report=html

# Run specific test categories
pytest tests/mealplan/          # Meal plan tests
pytest tests/dish/              # Dish service tests
pytest tests/renderers/         # Renderer tests

MCP Examples

Using the MCP CLI Tool

The MCP CLI tool allows you to interact with your server directly from the command line:

# In a separate terminal, run your server
python main.py

# In another terminal, start the MCP CLI
mcp dev main.py

Project Structure

mealplan-mcp/
├── main.py                  # Entry point and MCP server definition
├── mealplan_mcp/            # Main application package
│   ├── models/              # Pydantic data models
│   │   ├── dish.py          # Dish model with ingredients and instructions
│   │   ├── ingredient.py    # Ingredient model with validation
│   │   ├── ignored.py       # Ignored ingredients model
│   │   ├── meal_plan.py     # Meal plan model with date validation
│   │   ├── meal_type.py     # Meal type enumerations
│   │   └── nutrient.py      # Nutrient information model
│   ├── renderers/           # Markdown rendering modules
│   │   ├── grocery.py       # Grocery list markdown renderer
│   │   └── mealplan.py      # Meal plan markdown renderer
│   ├── services/            # Business logic services
│   │   ├── dish/            # Dish-related services (store, list)
│   │   ├── grocery/         # Grocery list generation services
│   │   ├── ignored/         # Ignored ingredients services
│   │   └── mealplan/        # Meal plan storage services
│   └── utils/               # Utility functions
│       ├── paths.py         # Path handling with test isolation
│       └── slugify.py       # String slugification utilities
├── tests/                   # Comprehensive test suite (113 tests)
└── docs/                    # Documentation

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin feature-name
  5. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

推荐服务器

Baidu Map

Baidu Map

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

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

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

官方
精选
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

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

官方
精选
本地
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

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

官方
精选
本地
TypeScript
VeyraX

VeyraX

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

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

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

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

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

官方
精选
TypeScript
Exa MCP Server

Exa MCP Server

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

官方
精选
mcp-server-qdrant

mcp-server-qdrant

这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。

官方
精选
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选