Keep/MCP-LIGHTWEIGHT-TEST.md
sepehr f0b41572bc feat: Memento avec dates, Markdown, reminders et auth
Tests Playwright validés :
- Création de notes: OK
- Modification titre: OK
- Modification contenu: OK
- Markdown éditable avec preview: OK

Fonctionnalités:
- date-fns: dates relatives sur cards
- react-markdown + remark-gfm
- Markdown avec toggle edit/preview
- Recherche améliorée (titre/contenu/labels/checkItems)
- Reminder recurrence/location (schema)
- NextAuth.js + User/Account/Session
- userId dans Note (optionnel)
- 4 migrations créées

Ready for production + auth integration
2026-01-04 16:04:24 +01:00

4.2 KiB

Test MCP Server - Lightweight Mode

Test 1: Get Notes (Lightweight - Default)

$body = @{
    jsonrpc = "2.0"
    id = 1
    method = "tools/call"
    params = @{
        name = "get_notes"
        arguments = @{
            fullDetails = $false
        }
    }
} | ConvertTo-Json -Depth 10

$response = Invoke-RestMethod -Uri "http://localhost:3001/sse" -Method POST -Body $body -ContentType "application/json"
$response.result.content[0].text | ConvertFrom-Json | ConvertTo-Json -Depth 10

Résultat attendu :

  • Titres des notes
  • Contenu tronqué (200 caractères max)
  • Métadonnées (hasImages, imageCount, etc.)
  • PAS d'images base64 (économie de payload)

Test 2: Get Notes (Full Details)

$body = @{
    jsonrpc = "2.0"
    id = 2
    method = "tools/call"
    params = @{
        name = "get_notes"
        arguments = @{
            fullDetails = $true
        }
    }
} | ConvertTo-Json -Depth 10

$response = Invoke-RestMethod -Uri "http://localhost:3001/sse" -Method POST -Body $body -ContentType "application/json"
$response.result.content[0].text | ConvertFrom-Json | Select-Object -First 1 | ConvertTo-Json -Depth 10

Résultat attendu :

  • Toutes les données complètes
  • Images base64 incluses
  • ⚠️ Payload très lourd

Test 3: Create Note

$body = @{
    jsonrpc = "2.0"
    id = 3
    method = "tools/call"
    params = @{
        name = "create_note"
        arguments = @{
            title = "Test MCP Lightweight"
            content = "Cette note teste le mode lightweight du serveur MCP"
            color = "green"
            labels = @("Test", "MCP")
        }
    }
} | ConvertTo-Json -Depth 10

$response = Invoke-RestMethod -Uri "http://localhost:3001/sse" -Method POST -Body $body -ContentType "application/json"
$response.result.content[0].text | ConvertFrom-Json | ConvertTo-Json

Test 4: Search Notes (Lightweight)

$body = @{
    jsonrpc = "2.0"
    id = 4
    method = "tools/call"
    params = @{
        name = "get_notes"
        arguments = @{
            search = "test"
            fullDetails = $false
        }
    }
} | ConvertTo-Json -Depth 10

$response = Invoke-RestMethod -Uri "http://localhost:3001/sse" -Method POST -Body $body -ContentType "application/json"
$response.result.content[0].text | ConvertFrom-Json | ConvertTo-Json -Depth 10

Comparaison de Taille de Payload

Mode Lightweight

{
  "id": "abc123",
  "title": "Note avec images",
  "content": "Début du contenu qui est automatiquement tronqué à 200 caractères pour réduire...",
  "hasImages": true,
  "imageCount": 3,
  "color": "blue",
  "type": "text",
  "isPinned": false,
  "isArchived": false
}

Taille : ~300 bytes par note

Mode Full Details

{
  "id": "abc123",
  "title": "Note avec images",
  "content": "Contenu complet de la note qui peut être très long...",
  "images": [
    "data:image/png;base64,iVBORw0KGgoAAAANSUhEUg... (100KB+)",
    "data:image/jpg;base64,/9j/4AAQSkZJRgABAQAAAQA... (200KB+)",
    "data:image/png;base64,iVBORw0KGgoAAAANSUhEUg... (150KB+)"
  ],
  "checkItems": [...],
  "labels": [...],
  ...
}

Taille : 450KB+ par note avec 3 images

Économie

Pour 10 notes avec images :

  • Lightweight : ~3 KB
  • Full Details : ~4.5 MB
  • Économie : 99.93% 🎉

Utilisation dans N8N

Workflow Tech News

Le workflow utilise automatiquement le mode lightweight car :

  1. On ne fait que lire les titres des notes existantes
  2. On créé des notes texte sans images
  3. Pas besoin des détails complets

Configuration N8N

{
  "method": "POST",
  "url": "http://localhost:3001/sse",
  "body": {
    "jsonrpc": "2.0",
    "id": "{{ $now.toUnixInteger() }}",
    "method": "tools/call",
    "params": {
      "name": "get_notes",
      "arguments": {
        "fullDetails": false  // ← Mode lightweight par défaut
      }
    }
  }
}

Notes

  • Par défaut, get_notes retourne des données lightweight
  • Pour obtenir les images, spécifier fullDetails: true
  • Le contenu est tronqué à 200 caractères max
  • Utile pour :
    • Lister les notes
    • Rechercher par titre
    • Vérifier l'existence d'une note
    • Workflows N8N optimisés