PROJECT_OVERVIEW.mdโข3.15 kB
# 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! ๐