# Food MCP Server - Project Overview (HTTP Transport)
## π Project Structure
```
food_mcp/
βββ π server.py # Main HTTP MCP server implementation
βββ π run_server.py # Entry point for running the HTTP server
βββ π§ͺ test_server.py # Test suite for schemas and functionality
βββ π test_http_server.py # HTTP server configuration test
βββ π requirements.txt # Python dependencies
βββ π³ Dockerfile # Container build configuration
βββ π³ docker-compose.yml # HTTP deployment configuration
βββ π README.md # Comprehensive documentation
βββ οΏ½ docs/ # Documentation files
βββ π schemas/ # Pydantic response models
β βββ food_hierarchy.py # Food hierarchy tool schemas
β βββ food_item.py # Nutrition tool schemas
βββ π services/ # Business logic layer
β βββ hierarchy_queries.py # Food hierarchy operations
β βββ item_service.py # Food nutrition operations
βββ π utils/ # Utilities and database
β βββ db.py # MongoDB client
βββ π logs/ # Application logs (created at runtime)
```
## π§ Core Components
### Server Implementation
- **`server.py`** - Main MCP server using the Python SDK
- **`run_server.py`** - Entry point with proper error handling
- **`test_server.py`** - Comprehensive test suite
### Data Models
- **`schemas/food_hierarchy.py`** - 8 Pydantic models for hierarchy tools
- **`schemas/food_item.py`** - 3 Pydantic models for nutrition tools
### Business Logic
- **`services/hierarchy_queries.py`** - Food categorization and search
- **`services/item_service.py`** - Nutrition data operations
- **`utils/db.py`** - MongoDB Atlas connection management
### Deployment
- **`Dockerfile`** - Multi-stage build for production
- **`docker-compose.yml`** - Simple container orchestration
- **`requirements.txt`** - All necessary Python packages
## π― Clean Architecture Benefits
1. **Clear Separation**: Business logic separated from server implementation
2. **Type Safety**: Pydantic schemas ensure data validation
3. **Easy Testing**: Isolated components for unit testing
4. **Production Ready**: Docker support with proper error handling
5. **MCP Compliant**: Full adherence to protocol specification
## π Quick Commands
```bash
# Run tests
python3 test_server.py
# Test HTTP configuration
python3 test_http_server.py
# Start HTTP server
python3 run_server.py
# Test with MCP Inspector
npx @modelcontextprotocol/inspector http://localhost:8000/sse
# Docker deployment
docker-compose up --build
```
## π Tools Available
- **8 Food Hierarchy Tools** - Categories, search, stats
- **3 Food Nutrition Tools** - Nutrition data and search
- **Structured Output** - All responses use Pydantic validation
- **Error Handling** - Comprehensive error responses
The project is now clean, well-organized, and production-ready! π