Skip to main content
Glama

Food MCP Server

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! ๐ŸŽ‰

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/MacroSense-AI/dietician-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server