Keep/mcp-server/N8N-CONFIG.md
sepehr 8d95f34fcc fix: Add debounced Undo/Redo system to avoid character-by-character history
- Add debounced state updates for title and content (500ms delay)
- Immediate UI updates with delayed history saving
- Prevent one-letter-per-undo issue
- Add cleanup for debounce timers on unmount
2026-01-04 14:28:11 +01:00

276 lines
5.0 KiB
Markdown

# Configuration N8N - Memento MCP SSE Server
## 🎯 Ton IP Actuelle
**IP Principale**: `172.26.64.1`
## 🔌 Configuration MCP Client dans N8N
### Option 1: Via Settings → MCP Access (Recommandé)
1. Ouvre N8N dans ton navigateur
2. Va dans **Settings** (⚙️)
3. Sélectionne **MCP Access**
4. Clique sur **Add Server** ou **+**
5. Entre cette configuration:
```json
{
"name": "memento",
"transport": "sse",
"url": "http://172.26.64.1:3001/sse",
"description": "Memento Note-taking App MCP Server"
}
```
6. Sauvegarde la configuration
7. Dans tes workflows, active **"Available in MCP"** (toggle)
8. Utilise le node **MCP Client** pour appeler les tools
### Option 2: Via Variables d'Environnement
Si tu as accès aux variables d'environnement de N8N:
```bash
export N8N_MCP_SERVERS='{
"memento": {
"transport": "sse",
"url": "http://172.26.64.1:3001/sse"
}
}'
```
Ou dans Docker:
```yaml
environment:
- N8N_MCP_SERVERS={"memento":{"transport":"sse","url":"http://172.26.64.1:3001/sse"}}
```
### Option 3: Via Fichier de Configuration
Si N8N utilise un fichier config:
```json
{
"mcpServers": {
"memento": {
"transport": "sse",
"url": "http://172.26.64.1:3001/sse"
}
}
}
```
## 🛠️ 9 Tools Disponibles
Une fois configuré, tu peux appeler ces tools depuis N8N:
### 1. create_note
```json
{
"tool": "create_note",
"arguments": {
"content": "Ma note de test",
"title": "Titre optionnel",
"color": "blue",
"type": "text",
"images": ["data:image/png;base64,..."]
}
}
```
### 2. get_notes
```json
{
"tool": "get_notes",
"arguments": {
"includeArchived": false,
"search": "optionnel"
}
}
```
### 3. get_note
```json
{
"tool": "get_note",
"arguments": {
"id": "note_id_ici"
}
}
```
### 4. update_note
```json
{
"tool": "update_note",
"arguments": {
"id": "note_id_ici",
"title": "Nouveau titre",
"isPinned": true
}
}
```
### 5. delete_note
```json
{
"tool": "delete_note",
"arguments": {
"id": "note_id_ici"
}
}
```
### 6. search_notes
```json
{
"tool": "search_notes",
"arguments": {
"query": "recherche"
}
}
```
### 7. get_labels
```json
{
"tool": "get_labels",
"arguments": {}
}
```
### 8. toggle_pin
```json
{
"tool": "toggle_pin",
"arguments": {
"id": "note_id_ici"
}
}
```
### 9. toggle_archive
```json
{
"tool": "toggle_archive",
"arguments": {
"id": "note_id_ici"
}
}
```
## 🚀 Démarrage du Serveur SSE
### Méthode 1: Script PowerShell (Simple)
```powershell
cd D:\dev_new_pc\Keep\mcp-server
.\start-sse.ps1
```
### Méthode 2: npm
```bash
cd D:\dev_new_pc\Keep\mcp-server
npm run start:sse
```
### Méthode 3: Node direct
```bash
cd D:\dev_new_pc\Keep\mcp-server
node index-sse.js
```
Le serveur démarrera sur:
- **Local**: http://localhost:3001
- **Réseau**: http://172.26.64.1:3001
- **SSE Endpoint**: http://172.26.64.1:3001/sse
## ✅ Vérification
### Test 1: Health Check (depuis ton PC)
```powershell
Invoke-RestMethod -Uri "http://localhost:3001/"
```
### Test 2: Health Check (depuis N8N)
```bash
curl http://172.26.64.1:3001/
```
### Test 3: Workflow N8N
Crée un workflow avec:
1. **Manual Trigger**
2. **MCP Client** node:
- Server: `memento`
- Tool: `get_notes`
- Arguments: `{}`
3. **Code** node pour voir le résultat
## 🔥 Troubleshooting
### Erreur: "Connection refused"
✅ Vérifie que le serveur SSE tourne:
```powershell
Get-Process | Where-Object { $_.ProcessName -eq "node" }
```
### Erreur: "Cannot reach server"
✅ Vérifie le firewall Windows:
```powershell
# Ajouter règle firewall pour port 3001
New-NetFirewallRule -DisplayName "Memento MCP SSE" -Direction Inbound -LocalPort 3001 -Protocol TCP -Action Allow
```
### Erreur: "SSE connection timeout"
✅ Vérifie que N8N peut atteindre ton PC:
```bash
# Depuis la machine N8N
ping 172.26.64.1
curl http://172.26.64.1:3001/
```
### N8N sur Docker?
Si N8N tourne dans Docker, utilise l'IP de l'hôte Docker, pas `172.26.64.1`.
Trouve l'IP du host:
```bash
docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' <container_id>
```
## 📊 Ports Utilisés
| Service | Port | URL |
|---------|------|-----|
| Next.js (Memento UI) | 3000 | http://localhost:3000 |
| MCP SSE Server | 3001 | http://172.26.64.1:3001/sse |
| REST API | 3000 | http://localhost:3000/api/notes |
## 🔐 Sécurité
⚠️ **ATTENTION**: Le serveur SSE n'a **PAS D'AUTHENTIFICATION** actuellement!
Pour production:
1. Ajoute une clé API
2. Utilise HTTPS avec certificat SSL
3. Restreins les CORS origins
4. Utilise un reverse proxy (nginx)
## 📚 Documentation Complète
- [MCP-SSE-ANALYSIS.md](../MCP-SSE-ANALYSIS.md) - Analyse détaillée SSE
- [README-SSE.md](README-SSE.md) - Documentation serveur SSE
- [README.md](../README.md) - Documentation projet
## 🎉 C'est Prêt!
Ton serveur MCP SSE est configuré et prêt pour N8N!
**Endpoint N8N**: `http://172.26.64.1:3001/sse`
---
**Dernière mise à jour**: 4 janvier 2026
**IP**: 172.26.64.1
**Port**: 3001
**Status**: ✅ Opérationnel