Spaces:
Running
Running
File size: 8,674 Bytes
3652139 bf5a73f 27f5f73 bf5a73f 27f5f73 038867c 27f5f73 3fba179 27f5f73 0bbb7da 27f5f73 9846b7e f9affed 9846b7e 27f5f73 9846b7e 27f5f73 038867c 27f5f73 0bbb7da ee65abb 0bbb7da ee65abb 0bbb7da ee65abb 0bbb7da 9a3e0d2 b1f502e 9a3e0d2 0bbb7da ee65abb 0bbb7da 27f5f73 9a3e0d2 27f5f73 f9affed 27f5f73 9a3e0d2 f9affed 27f5f73 0bbb7da 9a3e0d2 ee65abb 0bbb7da f9affed 0bbb7da 9a3e0d2 f9affed 9a3e0d2 0bbb7da f9affed 9a3e0d2 0bbb7da 27f5f73 0bbb7da 2f0d4f5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
---
title: FoodWise Remote MCP
emoji: π₯
colorFrom: green
colorTo: blue
sdk: docker
app_port: 7860
hf_oauth: false
---
# FoodWise
A smart food management system with recipe organization and meal planning, designed for detailed inventory tracking.
## Core Concepts
FoodWise is built around a detailed data model to track food items across different storage areas: the pantry, refrigerator, and freezer. The goal is to provide a clear, organized overview of your food inventory to reduce waste and improve meal planning.
### Key Features
- **Pantry Tracking**: Keep a detailed inventory of your pantry items, including purchase and best-by dates, location, and whether a package has been opened.
- **Refrigerator Tracking**: Manage refrigerated items with attention to food safety, including temperature zones and sensitivity flags.
- **Freezer Tracking**: A detailed system for your multi-drawer freezer, tracking freeze dates, cooked/raw status, and preparation notes.
- **Notion Integration**: Seamlessly sync your food inventory with a Notion database for ultimate organization.
- **LangGraph Agent**: Conversational AI agent for natural language inventory management using LangGraph's React agent framework.
- **Discord Bot Ready**: Architecture designed for Discord integration (future implementation).
## Development Setup
This project uses `uv` for fast and efficient package and virtual environment management.
### Prerequisites
- Python 3.12+
- `uv` package manager
### Installation
1. **Clone the repository:**
```bash
git clone https://github.com/your-username/FoodWise.git
cd FoodWise
```
2. **Create and activate the virtual environment:**
```bash
uv venv
source .venv/bin/activate
```
3. **Install dependencies:**
```bash
uv pip install -e ".[dev]"
```
This command installs the project in editable mode (`-e`) along with all main and development dependencies.
### Notion Integration Setup
4. **Create a Notion integration:**
- Visit [Notion Integrations](https://www.notion.so/my-integrations)
- Create a new integration and copy the "Internal Integration Token"
- Share your food inventory database with the integration
5. **Configure environment variables:**
```bash
cp env.example .env # or create .env file
```
Add your credentials to `.env`:
```
NOTION_SECRET=your_notion_integration_token
NOTION_INVENTORY_DB_ID=your_inventory_database_id
NOTION_SHOPPING_DB_ID=your_shopping_database_id # NEW! For shopping lists
OPENAI_API_KEY=your_openai_key # for LangGraph agent
# MCP Server Configuration (for FastMCP implementation)
MCP_TRANSPORT=stdio
MCP_SERVER_NAME=FoodWise
```
6. **Verify setup:**
```bash
# Discover your Notion databases
python scripts/list_databases.py
# Verify schema compatibility
python scripts/verify_schema.py
# Inventory demo (uses TEST DB if provided, auto-cleanup)
python scripts/inventory_demo.py
# Shopping list demo (uses TEST DB if provided)
python scripts/shopping_list_demo.py
```
## Quick Start
### Test the Notion Integration
```bash
# Activate virtual environment
source .venv/bin/activate
# Run database verification
python scripts/verify_schema.py
# Test inventory CRUD (Create, Read, Update, Delete)
python scripts/inventory_demo.py
# Run comprehensive unit tests
python -m pytest tests/ -v
```
### Use the LangGraph Agent
```python
from src.foodwise.agent.agent import run_agent_query
# Query your inventory
response = run_agent_query("What items are expiring soon?")
print(response)
# Add new items
response = run_agent_query("Add 2 lbs of ground beef to the refrigerator")
print(response)
# Update existing items
response = run_agent_query("Update the milk quantity to 1 gallon")
print(response)
# Search for specific items
response = run_agent_query("Search for apples in my inventory")
print(response)
```
### Test the Agent Locally
```bash
# Quick agent functionality test
python scripts/agent_smoke.py
```
### Use with Claude Desktop (MCP) β
WORKING
#### Local MCP Server
```bash
# The FastMCP server runs automatically via Claude Desktop configuration
# Just update ~/.config/claude/claude_desktop_config.json with:
{
"mcpServers": {
"foodwise": {
"command": "/path/to/FoodWise/.venv/bin/python",
"args": ["/path/to/FoodWise/mcp_server_entry.py"],
"cwd": "/path/to/FoodWise"
}
}
}
```
#### Remote MCP Server β
NEW!
```bash
# Access the remote FoodWise MCP server deployed on HuggingFace Spaces
# Add this to your ~/.config/claude/claude_desktop_config.json:
{
"mcpServers": {
"foodwise-remote": {
"command": "npx",
"args": ["supergateway", "--streamableHttp", "https://leowalker-foodwise-remote-mcp.hf.space/mcp/"]
}
}
}
```
**π Remote Access**: The FoodWise MCP server is now available as a cloud service! Use the remote server for:
- β
Access from multiple devices
- β
No local setup required
- β
Always up-to-date
- β
Shared inventory access (when using shared Notion databases)
**π‘ Tip**: You can have both `foodwise` (local) and `foodwise-remote` configured simultaneously for maximum flexibility!
```bash
# In Claude Desktop, you'll now have access to:
# π§ Tools: 12 total (5 inventory + 7 shopping management)
# π Resources: 4 focused (inventory items, expiring items, shopping list, by-store)
# π Prompts: 5 concise (add_item_helper, meal_planning_assistant, expiration_manager,
# shopping_list_optimizer, smart_shopping_assistant)
```
**β
Production Ready**: Complete MCP integration tested and working with Claude Desktop. Both local and remote servers automatically load environment configurations and provide full functionality.
## Development Status
**π― Current Status:** β
STREAMLINED! Clean, focused MCP server optimized for learning and production use!
**β
Completed Features:**
- Complete Notion integration with full CRUD (Create, Read, Update, Delete) for **inventory & shopping**
- LangGraph React agent with 5 inventory management tools
- **Streamlined shopping list management system** π OPTIMIZED!
- **Store-specific optimization** for Costco, Trader Joe's, Safeway, Whole Foods, Target
- Pydantic validation for data integrity and partial updates
- Comprehensive testing suite (manual + automated)
- Schema compatibility verification
- **FastMCP server with secure environment handling**
- **Claude Desktop integration tested and working**
- **Clean, focused MCP architecture (42% code reduction!)**
- **π Remote MCP Server deployed on HuggingFace Spaces** β
NEW!
- **Docker containerization with uv and Python 3.12**
**π§ Available Tools (Working in Claude Desktop):**
*Inventory Management:*
- `get_inventory` - Query inventory with filtering options β
Tested
- `add_inventory_item` - Add new food items with full field support
- `search_inventory_items` - Search for specific items by name/category
- `update_inventory_item` - Update existing items with validation β
Tested
- `remove_inventory_item` - Archive/remove items from inventory β
Tested
*Shopping List Management:* π **STREAMLINED!**
- `get_shopping_list` - Retrieve shopping items with store/priority filtering
- `add_shopping_item` - Add items with store preferences and pricing
- `update_shopping_item` - Modify items and track purchase status
- `remove_shopping_item` - Archive completed shopping items
- `create_shopping_from_recipe` - Generate shopping lists from recipes
- `optimize_shopping_by_store` - Organize by store for efficient shopping
- `move_purchased_to_inventory` - Auto-move purchased items to inventory
**π Streamlined MCP Architecture:**
- β
FastMCP server with **12 essential tools** (5 inventory + 7 shopping)
- β
**4 focused resources** for live data (2 inventory + 2 shopping)
- β
**5 concise prompts** for key workflows (mixed domains)
- β
**42% code reduction** while maintaining full functionality
- β
Claude Desktop integration working and tested
- β
Secure environment variable handling (no secrets in config files)
- β
Full inventory + shopping management through conversational AI
- β
**Store-specific optimization** (Costco, Trader Joe's, Safeway, Whole Foods, Target)
- β
**Clean, learning-focused design** - perfect for understanding MCP patterns
**π Ready for:**
- Enhanced documentation and deployment guides
- Additional MCP client integrations (OpenAI, LiteLLM, etc.)
- Discord bot implementation (architecture ready)
---
*Last updated: August 2025 - Remote MCP deployment optimized and simplified*
|