Background & Motivation
The goal is to build a Model Context Protocol (MCP) server for the Colruyt Xtra app. This will enable an AI assistant to fetch most bought items, search for products, and add items to their shopping list. A key feature is the ability to read recipes from local markdown files, parse ingredients, and add them to the list, resolving ambiguities by cross-referencing with the user's purchase history.
Scope & Impact
- Authentication: The MCP server will accept authentication arguments (e.g., username/password or tokens) upon startup/installation so that all subsequent tools can act on behalf of the user.
- Core MCP Tools:
get_most_bought_products: Fetch the user's most bought products.
search_products: Search the Colruyt catalog for products by name/keyword.
add_items_to_list: Add specified products to the user's Colruyt shopping list.
- AI Skills/Logic:
add_recipe_ingredients: Parse markdown files from recipes/, extract ingredients, and add them to the list. It will use a two-step matching process: searching the catalog first, and if the match isn't clear, cross-referencing with the user's most-bought list to resolve ambiguity.
Proposed Solution
- Authentication: Implement a login flow in Python that uses the provided startup arguments to authenticate with Colruyt and obtain the
x-cg-apikey and session cookies (clpbff_session). This ensures the AI can use the tools seamlessly. If necessary, we will discover the specific login API endpoints using network inspection during development.
- Server Framework: Initialize a Python-based MCP server using the mcp SDK, configured to accept the necessary arguments.
- API Client Integration: Implement HTTP clients (using
httpx) for the most-bought-products, search, and add-items-to-list endpoints.
- Recipe Processing & Search Resolution: Implement a markdown parser for
recipes/*.md. For each ingredient:
- Call the
search_products API.
- If there are multiple ambiguous results, call
get_most_bought_products and cross-reference to find a match.
- If it's still unclear, the tool will return the options so the AI assistant can ask the user for confirmation before calling
add_items_to_list.
Implementation Plan
Phase 1: Authentication & Startup
Phase 2: Core API Tools
Phase 3: Recipe Logic
Phase 4: Testing & Verification
Verification Criteria
Background & Motivation
The goal is to build a Model Context Protocol (MCP) server for the Colruyt Xtra app. This will enable an AI assistant to fetch most bought items, search for products, and add items to their shopping list. A key feature is the ability to read recipes from local markdown files, parse ingredients, and add them to the list, resolving ambiguities by cross-referencing with the user's purchase history.
Scope & Impact
get_most_bought_products: Fetch the user's most bought products.search_products: Search the Colruyt catalog for products by name/keyword.add_items_to_list: Add specified products to the user's Colruyt shopping list.add_recipe_ingredients: Parse markdown files fromrecipes/, extract ingredients, and add them to the list. It will use a two-step matching process: searching the catalog first, and if the match isn't clear, cross-referencing with the user's most-bought list to resolve ambiguity.Proposed Solution
x-cg-apikeyand session cookies (clpbff_session). This ensures the AI can use the tools seamlessly. If necessary, we will discover the specific login API endpoints using network inspection during development.httpx) for the most-bought-products, search, and add-items-to-list endpoints.recipes/*.md. For each ingredient:search_productsAPI.get_most_bought_productsand cross-reference to find a match.add_items_to_list.Implementation Plan
Phase 1: Authentication & Startup
server.py)Phase 2: Core API Tools
search_productstoolget_most_bought_productstooladd_items_to_listtoolPhase 3: Recipe Logic
recipes/directory with standard markdown structureadd_recipe_to_listtool with search + cross-reference logicPhase 4: Testing & Verification
Verification Criteria
search_productsreturns accurate results.get_most_bought_productsreturns the user's history.add_items_to_listsuccessfully updates the list on the actual Colruyt account.add_recipe_to_listlogic successfully resolves vague ingredients using the most-bought list.