auchan-drive-mcp
# auchan-drive-mcp
Serveur [MCP](https://modelcontextprotocol.io) non officiel pour Auchan Drive : recherche produits, prix promo, cagnotte fidélité et gestion du panier depuis Claude Code, Claude Desktop ou tout client MCP.
Aucun paiement : créneau et paiement restent manuels sur auchan.fr.
> [!WARNING]
> Projet indépendant, sans lien avec Auchan. Repose sur l'API interne non documentée du site, susceptible de changer à tout moment. L'automatisation n'est probablement pas conforme aux CGU d'Auchan : usage personnel et à faible volume uniquement.
## Fonctionnement
- Chromium piloté par Playwright, avec un profil persistant (session et magasin Drive).
- Token et consentement récupérés sur les requêtes du site lui-même, aucun identifiant en dur.
- Panier via l'API du site, recherche via la page de résultats (avec pagination).
- Délai minimum entre deux requêtes (`AUCHAN_MIN_INTERVAL`).
## Installation
Python 3.11+.
```bash
git clone https://github.com/Spaghetih/auchan-drive-mcp.git
cd auchan-drive-mcp
python -m venv .venv
source .venv/bin/activate # Windows : .\.venv\Scripts\Activate.ps1
pip install -e .
playwright install chromium
```
## Connexion
```bash
auchan-mcp login
```
Dans la fenêtre ouverte : connexion par email et mot de passe (la connexion Google est refusée dans un navigateur automatisé), choix du magasin Drive, puis Entrée dans le terminal.
Le profil est stocké dans `~/.local/share/auchan-mcp/profile`. Il contient la session : à protéger, ne pas partager.
## Configuration du client MCP
Claude Code :
```bash
claude mcp add -s user auchan -- /chemin/vers/auchan-mcp/.venv/bin/auchan-mcp serve
```
Sous Windows : `.venv\Scripts\auchan-mcp.exe`.
Claude Desktop (`claude_desktop_config.json`) :
```json
{
"mcpServers": {
"auchan": {
"command": "/chemin/vers/auchan-mcp/.venv/bin/auchan-mcp",
"args": ["serve"]
}
}
}
```
## Tools
| Tool | Description |
|---|---|
| `status` | État de la session et des identifiants API |
| `search_products` | Recherche (jusqu'à 100 résultats) : prix, prix au kilo/litre, promo, `effective_unit_price_eur`, cagnotte, produits sponsorisés |
| `add_to_cart` / `add_many_to_cart` | Ajout au panier (quantité cumulée) |
| `view_cart` | Lignes, prix, disponibilité, total estimé, `cagnotte_total_eur` |
| `update_cart_line` / `remove_from_cart` | Modification de quantité / suppression |
| `checkout_link` | Lien du panier |
Promos reconnues : `N+M offert`, `N achetés = M payés`, `-X % sur le Nème`, `le Nème offert`, `N pour X €`, remise immédiate.
## Variables d'environnement
| Variable | Défaut | Description |
|---|---|---|
| `AUCHAN_HEADLESS` | `1` | `0` pour afficher le navigateur (debug, captcha) |
| `AUCHAN_MIN_INTERVAL` | `1.5` | Délai minimum entre requêtes (s) |
| `AUCHAN_MAX_QTY` | `12` | Quantité max par ligne |
| `AUCHAN_PROFILE_DIR` | `~/.local/share/auchan-mcp/profile` | Profil Chromium |
## Exemple de skill
[`examples/skills/panier-hebdo`](examples/skills/panier-hebdo/SKILL.md) : panier hebdomadaire selon un budget et des objectifs nutritionnels, avec validation avant ajout. À copier dans `~/.claude/skills/`.
## Limites
- Un seul process à la fois sur le profil Chromium.
- Recherche et noms du panier dépendants du HTML du site.
- Noms des lignes du panier associés par prix (absents de l'API) : erreur possible si deux lignes ont le même total.
- Session expirée (« Token API non intercepté ») : relancer `auchan-mcp login`.
- Captcha : relancer avec `AUCHAN_HEADLESS=0` et le résoudre dans la fenêtre.
## Debug
`auchan-mcp capture -o capture.jsonl` enregistre les appels réseau du site pendant la navigation. Secrets masqués, mais les réponses peuvent contenir des données de compte : ne pas publier ce fichier (exclu par `.gitignore`).
## Licence
MIT
TDQS
Scored across 8 tools
Most tools target distinct operations (search, view, add, bulk add, status, checkout link), but remove_from_cart is fully redundant with update_cart_line when quantity is set to 0, creating a blurred boundary for deletion. Descriptions do clarify the intent, which keeps the overlap from being harmful, but two paths to the same outcome remain.
Nearly all names follow a snake_case verb_noun or verb_object pattern (add_to_cart, add_many_to_cart, update_cart_line, remove_from_cart, view_cart, search_products), with checkout_link as a noun-ish compound and status as a bare noun outlier. The pattern is predictable and readable despite those two deviations.
Eight tools map cleanly onto the cart workflow: discover, inspect, mutate (single/bulk/update/remove), finalize, and check session state. Nothing feels bloated, and each tool except the redundant remove_from_cart earns its place.
The core lifecycle is covered end-to-end: search products, add single or many, view cart, adjust quantity, remove lines, and obtain a checkout link for manual payment. Minor gaps exist (no clear-cart operation, no product-detail endpoint beyond search, no order history), but agents can work around them by removing lines individually.