@lionchat/mcp-server 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs/instructions.md +24 -0
- package/dist/docs/prompts/create_flow_brainstorm.json +9 -0
- package/dist/docs/prompts/inactive_contacts.json +23 -0
- package/dist/docs/prompts/quality_audit.json +28 -0
- package/dist/docs/prompts/team_load_balance.json +18 -0
- package/dist/docs/prompts/whatsapp_template_usage.json +18 -0
- package/dist/docs/resources/best-practices.md +166 -0
- package/dist/docs/resources/conversation-flows.md +208 -0
- package/dist/docs/resources/flowbuilder-design-guide.md +427 -0
- package/dist/docs/resources/flowbuilder-patterns.md +362 -0
- package/dist/docs/resources/kanban-deep-dive.md +295 -0
- package/dist/docs/resources/troubleshooting.md +248 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/resources.js +36 -0
- package/dist/resources.js.map +1 -1
- package/endpoints.json +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
# Kanban — Guia Profundo
|
|
2
|
+
|
|
3
|
+
Tudo sobre o módulo Kanban/CRM do LionChat: funis, etapas, cards, valor, automações, integrações com conversação.
|
|
4
|
+
|
|
5
|
+
## Estrutura
|
|
6
|
+
|
|
7
|
+
### Funnel (Funil)
|
|
8
|
+
Container de etapas. Conta pode ter vários funis (ex: "Vendas", "Pós-venda", "Renovação").
|
|
9
|
+
|
|
10
|
+
| Campo | Descrição |
|
|
11
|
+
|---|---|
|
|
12
|
+
| `id` | Identificador |
|
|
13
|
+
| `name` | Nome do funil (ex: "Vendas B2B") |
|
|
14
|
+
| `description` | Descrição livre |
|
|
15
|
+
| `stages` | jsonb com etapas (ver abaixo) |
|
|
16
|
+
| `archived` | Boolean — funis arquivados não aparecem na UI ativa |
|
|
17
|
+
| `active` | Boolean — controla se aceita movimentação |
|
|
18
|
+
| `settings` | jsonb — config customizada (ex: cores, automações) |
|
|
19
|
+
|
|
20
|
+
### Stages (Etapas) — dentro de `funnel.stages`
|
|
21
|
+
|
|
22
|
+
Stages NÃO são tabela separada. São armazenadas como jsonb dentro do Funnel:
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"novo_lead": {
|
|
27
|
+
"name": "Novo Lead",
|
|
28
|
+
"color": "#3B82F6",
|
|
29
|
+
"position": 1,
|
|
30
|
+
"description": "Lead ainda não qualificado"
|
|
31
|
+
},
|
|
32
|
+
"qualificado": {
|
|
33
|
+
"name": "Qualificado",
|
|
34
|
+
"color": "#10B981",
|
|
35
|
+
"position": 2,
|
|
36
|
+
"description": "Lead com interesse confirmado"
|
|
37
|
+
},
|
|
38
|
+
"ganho": {
|
|
39
|
+
"name": "Ganho",
|
|
40
|
+
"color": "#22C55E",
|
|
41
|
+
"position": 99
|
|
42
|
+
},
|
|
43
|
+
"perdido": {
|
|
44
|
+
"name": "Perdido",
|
|
45
|
+
"color": "#EF4444",
|
|
46
|
+
"position": 100
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### KanbanItem (Card)
|
|
52
|
+
Um card individual dentro de uma etapa.
|
|
53
|
+
|
|
54
|
+
| Campo | Descrição |
|
|
55
|
+
|---|---|
|
|
56
|
+
| `id` | Identificador |
|
|
57
|
+
| `funnel_id` | Funil ao qual pertence |
|
|
58
|
+
| `funnel_stage` | Chave da etapa (ex: `"novo_lead"`) |
|
|
59
|
+
| `position` | Ordem dentro da etapa |
|
|
60
|
+
| `stage_entered_at` | Quando entrou na etapa atual (pra métrica de tempo) |
|
|
61
|
+
| `conversation_display_id` | Conversa principal vinculada |
|
|
62
|
+
| `linked_conversations` | jsonb array `[{display_id: 123}, {display_id: 456}]` — múltiplas conversas |
|
|
63
|
+
| `item_details` | jsonb (ver abaixo) |
|
|
64
|
+
| `custom_attributes` | jsonb — campos custom (igual contatos) |
|
|
65
|
+
| `assigned_agents` | jsonb array de agentes responsáveis |
|
|
66
|
+
| `activities` | jsonb array — log de atividades |
|
|
67
|
+
| `checklist` | jsonb array de tarefas dentro do card |
|
|
68
|
+
| `timer_started_at`, `timer_duration` | Timer interno do card |
|
|
69
|
+
|
|
70
|
+
### item_details (detalhes do card)
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"title": "Cliente XYZ - Plano Pro",
|
|
75
|
+
"value": 5000.0,
|
|
76
|
+
"priority": "high",
|
|
77
|
+
"description": "Cliente interessado em upgrade",
|
|
78
|
+
"notes": [
|
|
79
|
+
{"text": "Ligou pedindo proposta", "created_at": "2026-05-15T10:00:00Z"}
|
|
80
|
+
],
|
|
81
|
+
"offers": [
|
|
82
|
+
{"id": 12, "title": "Pro 12 meses", "value": 4800}
|
|
83
|
+
],
|
|
84
|
+
"custom_attributes": {
|
|
85
|
+
"origem_lead": "Facebook Ads"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**`value`** é onde fica o valor monetário do negócio (usado em pipelines).
|
|
91
|
+
|
|
92
|
+
### assigned_agents
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
[
|
|
96
|
+
{
|
|
97
|
+
"id": 5,
|
|
98
|
+
"name": "Maria Souza",
|
|
99
|
+
"email": "maria@empresa.com",
|
|
100
|
+
"avatar_url": "https://...",
|
|
101
|
+
"assigned_at": "2026-05-14T09:00:00Z",
|
|
102
|
+
"assigned_by": 1,
|
|
103
|
+
"source": "manual"
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Múltiplos agentes podem ter o mesmo card. `source` pode ser `manual`, `automation`, `inherited_from_conversation`.
|
|
109
|
+
|
|
110
|
+
### linked_conversations — IMPORTANTE
|
|
111
|
+
|
|
112
|
+
```json
|
|
113
|
+
[{"display_id": 123}, {"display_id": 456}]
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**NUNCA gravar inteiros direto** — sempre objetos com `{display_id: ...}`. Inteiros diretos causam TypeError no `as_json`.
|
|
117
|
+
|
|
118
|
+
## Posição (ordering)
|
|
119
|
+
|
|
120
|
+
Cada KanbanItem tem `position` (integer). Cards ordenados ASC dentro da etapa.
|
|
121
|
+
|
|
122
|
+
Reordenação:
|
|
123
|
+
- API endpoint: `POST /api/v2/kanban/items/reorder`
|
|
124
|
+
- Recebe array com nova ordem `[{id: 5, position: 1}, {id: 8, position: 2}]`
|
|
125
|
+
- Recalcula `position` em todas as etapas afetadas
|
|
126
|
+
|
|
127
|
+
Mover entre etapas:
|
|
128
|
+
- API endpoint: `POST /api/v2/kanban/items/{id}/move`
|
|
129
|
+
- Body: `{funnel_stage: "qualificado", position: 1}`
|
|
130
|
+
- Atualiza `funnel_stage`, `stage_entered_at`, e `position`
|
|
131
|
+
|
|
132
|
+
## Atividades (activities)
|
|
133
|
+
|
|
134
|
+
Log automático de eventos do card:
|
|
135
|
+
|
|
136
|
+
```json
|
|
137
|
+
[
|
|
138
|
+
{
|
|
139
|
+
"type": "stage_changed",
|
|
140
|
+
"from": "novo_lead",
|
|
141
|
+
"to": "qualificado",
|
|
142
|
+
"by_user_id": 1,
|
|
143
|
+
"at": "2026-05-15T10:00:00Z"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"type": "agent_assigned",
|
|
147
|
+
"agent_id": 5,
|
|
148
|
+
"by_user_id": 1,
|
|
149
|
+
"at": "2026-05-15T10:01:00Z"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"type": "note_added",
|
|
153
|
+
"note_id": 42,
|
|
154
|
+
"by_user_id": 5,
|
|
155
|
+
"at": "2026-05-15T10:05:00Z"
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Tipos comuns: `created`, `stage_changed`, `agent_assigned`, `agent_removed`, `note_added`, `value_changed`, `priority_changed`, `archived`.
|
|
161
|
+
|
|
162
|
+
## Checklist (tarefas dentro do card)
|
|
163
|
+
|
|
164
|
+
```json
|
|
165
|
+
[
|
|
166
|
+
{
|
|
167
|
+
"id": "abc-123",
|
|
168
|
+
"title": "Enviar proposta por email",
|
|
169
|
+
"checked": true,
|
|
170
|
+
"completed_at": "2026-05-15T10:00:00Z",
|
|
171
|
+
"completed_by": 5
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"id": "abc-124",
|
|
175
|
+
"title": "Agendar follow-up",
|
|
176
|
+
"checked": false
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Útil pra workflows internos. Não confundir com `tasks` (que é módulo separado de tarefas globais).
|
|
182
|
+
|
|
183
|
+
## Pipeline (visão por valor)
|
|
184
|
+
|
|
185
|
+
Pipeline = soma de `item_details.value` agrupado por etapa.
|
|
186
|
+
|
|
187
|
+
Exemplo:
|
|
188
|
+
```
|
|
189
|
+
Funil "Vendas"
|
|
190
|
+
├── Novo Lead: 12 cards | R$ 47.000
|
|
191
|
+
├── Qualificado: 8 cards | R$ 38.000
|
|
192
|
+
├── Negociação: 3 cards | R$ 22.000
|
|
193
|
+
├── Ganho: 5 cards | R$ 28.000 (fechados no mês)
|
|
194
|
+
└── Perdido: 2 cards | R$ 4.000
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Endpoint: `GET /api/v2/kanban/items/counts` retorna contagem + soma por etapa.
|
|
198
|
+
|
|
199
|
+
## Funil arquivado vs ativo
|
|
200
|
+
|
|
201
|
+
- `archived = true`: funil escondido da UI principal. Cards ainda existem mas não aparecem nas listas
|
|
202
|
+
- `active = false`: bloqueia movimentação (modo "somente leitura")
|
|
203
|
+
|
|
204
|
+
Use cases:
|
|
205
|
+
- Arquivar funis antigos no fim do ano
|
|
206
|
+
- Pausar funil em manutenção sem deletar cards
|
|
207
|
+
|
|
208
|
+
## Integração com Conversation
|
|
209
|
+
|
|
210
|
+
### Quando uma conversa vincula a um card
|
|
211
|
+
- Manual via UI ("vincular ao Kanban")
|
|
212
|
+
- Automação via `automation_rule.actions` com action `add_to_kanban`
|
|
213
|
+
- API call em `POST /api/v2/kanban/items` com `conversation_display_id`
|
|
214
|
+
|
|
215
|
+
### Como o card "sabe" sobre o cliente
|
|
216
|
+
|
|
217
|
+
```
|
|
218
|
+
KanbanItem
|
|
219
|
+
└─ conversation_display_id → Conversation
|
|
220
|
+
└─ contact → Contact (nome, telefone, email)
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
NÃO existe `contact_id` direto no KanbanItem. Sempre via conversation_display_id.
|
|
224
|
+
|
|
225
|
+
### Múltiplas conversas no mesmo card
|
|
226
|
+
|
|
227
|
+
`linked_conversations` permite agrupar várias conversas (ex: cliente que falou em WhatsApp e Email):
|
|
228
|
+
|
|
229
|
+
```json
|
|
230
|
+
[
|
|
231
|
+
{"display_id": 100},
|
|
232
|
+
{"display_id": 101},
|
|
233
|
+
{"display_id": 105}
|
|
234
|
+
]
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
A `conversation_display_id` (singular) ainda é a "principal" — mas todas as `linked_conversations` aparecem na sidebar do card.
|
|
238
|
+
|
|
239
|
+
## Automações relacionadas a Kanban
|
|
240
|
+
|
|
241
|
+
AutomationRule com evento `kanban_item_created`, `kanban_item_moved`, `kanban_item_stage_changed`:
|
|
242
|
+
|
|
243
|
+
```json
|
|
244
|
+
{
|
|
245
|
+
"event_name": "kanban_item_moved",
|
|
246
|
+
"conditions": [
|
|
247
|
+
{"attribute_key": "funnel_stage", "operator": "equal_to", "value": "ganho"}
|
|
248
|
+
],
|
|
249
|
+
"actions": [
|
|
250
|
+
{"action_name": "send_message", "params": ["Parabéns pelo fechamento!"]},
|
|
251
|
+
{"action_name": "add_label", "params": ["cliente-pagante"]}
|
|
252
|
+
]
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## Bulk operations
|
|
257
|
+
|
|
258
|
+
- `POST /api/v2/kanban/items/bulk_actions` — operações em massa (mover, atribuir, arquivar)
|
|
259
|
+
- `POST /api/v2/kanban/items/import` — importar CSV de cards
|
|
260
|
+
- `GET /api/v2/kanban/items/export` — exportar funil completo
|
|
261
|
+
|
|
262
|
+
## Custom attributes em cards
|
|
263
|
+
|
|
264
|
+
Igual contatos, cards têm `custom_attributes` (jsonb):
|
|
265
|
+
|
|
266
|
+
```json
|
|
267
|
+
{
|
|
268
|
+
"origem_lead": "Google Ads",
|
|
269
|
+
"campanha": "Black Friday 2026",
|
|
270
|
+
"score": 85,
|
|
271
|
+
"produto_interesse": "Plano Pro"
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
Configurar atributos no Super Admin ou via API `/api/v1/custom_attribute_definitions`.
|
|
276
|
+
|
|
277
|
+
## Métricas úteis (via GET /api/v2/kanban/items)
|
|
278
|
+
|
|
279
|
+
- Tempo médio em cada etapa: `stage_entered_at` vs agora
|
|
280
|
+
- Taxa de conversão: cards em "ganho" vs total criado no período
|
|
281
|
+
- Pipeline ativo: soma de `value` em etapas != ganho/perdido
|
|
282
|
+
- Velocity: cards movidos pra "ganho" por mês
|
|
283
|
+
|
|
284
|
+
## Diagnóstico: "Card sumiu do funil"
|
|
285
|
+
|
|
286
|
+
1. Está arquivado? `archived = true` em algum nível?
|
|
287
|
+
2. Etapa atual existe ainda? (etapa removida do funil deixa card "órfão")
|
|
288
|
+
3. `position` está faltando? (cards sem position vão pro fim)
|
|
289
|
+
4. Está em outro funil? (mover entre funis muda `funnel_id`)
|
|
290
|
+
|
|
291
|
+
## Diagnóstico: "Valor do pipeline errado"
|
|
292
|
+
|
|
293
|
+
1. Algum card sem `item_details.value`?
|
|
294
|
+
2. Cards arquivados estão sendo contados?
|
|
295
|
+
3. Etapas "ganho"/"perdido" estão incluídas no cálculo?
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
# Troubleshooting — Códigos de Erro Comuns
|
|
2
|
+
|
|
3
|
+
Como interpretar e responder a erros do MCP do LionChat.
|
|
4
|
+
|
|
5
|
+
## HTTP Status Codes
|
|
6
|
+
|
|
7
|
+
### 200 OK / 201 Created
|
|
8
|
+
Tudo certo. Use o body.
|
|
9
|
+
|
|
10
|
+
### 204 No Content
|
|
11
|
+
Sucesso, mas sem corpo. Comum em DELETE e algumas updates. NÃO espere JSON de volta.
|
|
12
|
+
|
|
13
|
+
### 400 Bad Request
|
|
14
|
+
Input malformado. Causas comuns:
|
|
15
|
+
- JSON inválido
|
|
16
|
+
- Campo obrigatório faltando
|
|
17
|
+
- Tipo errado (passou string onde esperava number)
|
|
18
|
+
|
|
19
|
+
**Ação:** Releia a mensagem de erro. Corrija o payload. NÃO retry sem mudar nada.
|
|
20
|
+
|
|
21
|
+
### 401 Unauthorized
|
|
22
|
+
Token de API inválido ou expirado.
|
|
23
|
+
|
|
24
|
+
**Ação:** Parar. Reportar pro usuário que precisa renovar credenciais. NÃO retry — vai falhar igual.
|
|
25
|
+
|
|
26
|
+
### 403 Forbidden
|
|
27
|
+
Token válido, mas SEM permissão pra essa ação.
|
|
28
|
+
|
|
29
|
+
Causas:
|
|
30
|
+
- Agente tentando ação de admin
|
|
31
|
+
- Conta diferente do escopo do token
|
|
32
|
+
- Feature flag desativada na conta
|
|
33
|
+
- Recurso pertence a outra conta (multi-tenant)
|
|
34
|
+
|
|
35
|
+
**Ação:** NÃO bypass. Informar limitação ao usuário.
|
|
36
|
+
|
|
37
|
+
### 404 Not Found
|
|
38
|
+
Recurso não existe.
|
|
39
|
+
|
|
40
|
+
Causas comuns:
|
|
41
|
+
- ID errado
|
|
42
|
+
- Recurso foi deletado
|
|
43
|
+
- Está em outra conta
|
|
44
|
+
- Endpoint URL errado
|
|
45
|
+
|
|
46
|
+
**Ação:** Verificar se ID está correto. Se foi deletado, informar.
|
|
47
|
+
|
|
48
|
+
### 422 Unprocessable Entity
|
|
49
|
+
Dados passaram na sintaxe mas falharam validação.
|
|
50
|
+
|
|
51
|
+
Exemplo de response:
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"errors": {
|
|
55
|
+
"email": ["já está em uso"],
|
|
56
|
+
"phone_number": ["formato inválido"]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Ação:** Ler `errors`, ajustar dados, reenviar.
|
|
62
|
+
|
|
63
|
+
### 429 Too Many Requests
|
|
64
|
+
Rate limit estourado.
|
|
65
|
+
|
|
66
|
+
Response inclui header `Retry-After: 60` (segundos).
|
|
67
|
+
|
|
68
|
+
**Ação:**
|
|
69
|
+
- Esperar o tempo indicado
|
|
70
|
+
- Reduzir concorrência
|
|
71
|
+
- Avaliar se está fazendo loop ineficiente
|
|
72
|
+
|
|
73
|
+
NÃO retry imediato — só piora.
|
|
74
|
+
|
|
75
|
+
### 500 Internal Server Error
|
|
76
|
+
Erro do servidor LionChat.
|
|
77
|
+
|
|
78
|
+
**Ação:**
|
|
79
|
+
- Retry 1x após 2-5 segundos
|
|
80
|
+
- Se persiste, reportar pro usuário com timestamp/request ID
|
|
81
|
+
|
|
82
|
+
### 502 Bad Gateway / 503 Service Unavailable
|
|
83
|
+
Indisponibilidade temporária (deploy, manutenção, sobrecarga).
|
|
84
|
+
|
|
85
|
+
**Ação:** Retry com backoff exponencial (2s, 4s, 8s). Máx 3 tentativas.
|
|
86
|
+
|
|
87
|
+
### 504 Gateway Timeout
|
|
88
|
+
Operação demorou demais.
|
|
89
|
+
|
|
90
|
+
Causas:
|
|
91
|
+
- Query muito pesada (sem filtro)
|
|
92
|
+
- Export grande (use exports assíncronos)
|
|
93
|
+
|
|
94
|
+
**Ação:** Reformular a chamada com filtros mais agressivos.
|
|
95
|
+
|
|
96
|
+
## Erros específicos do MCP
|
|
97
|
+
|
|
98
|
+
### "mcp_not_enabled"
|
|
99
|
+
Status: 403
|
|
100
|
+
|
|
101
|
+
A conta não tem a feature MCP habilitada.
|
|
102
|
+
|
|
103
|
+
**Ação:** Pedir admin pra ativar no plano ou via Super Admin.
|
|
104
|
+
|
|
105
|
+
### "admin_required"
|
|
106
|
+
Status: 403
|
|
107
|
+
|
|
108
|
+
Só administradores podem usar essa funcionalidade.
|
|
109
|
+
|
|
110
|
+
**Ação:** Usuário com role `agent` precisa pedir pro admin.
|
|
111
|
+
|
|
112
|
+
### "invalid_account"
|
|
113
|
+
Status: 400 ou 404
|
|
114
|
+
|
|
115
|
+
`account_id` não pertence ao usuário autenticado.
|
|
116
|
+
|
|
117
|
+
**Ação:** Listar contas do user (`list_my_accounts`) e usar uma válida.
|
|
118
|
+
|
|
119
|
+
### "feature_disabled"
|
|
120
|
+
Status: 403
|
|
121
|
+
|
|
122
|
+
Feature flag específica (ex: `feature_kanban`, `feature_captain`) está OFF.
|
|
123
|
+
|
|
124
|
+
**Ação:** Reportar qual feature precisa ser ativada.
|
|
125
|
+
|
|
126
|
+
## Erros de validação comuns
|
|
127
|
+
|
|
128
|
+
### Conversation
|
|
129
|
+
- `"contact must exist"` — passou `contact_id` inválido
|
|
130
|
+
- `"inbox must exist"` — `inbox_id` errado
|
|
131
|
+
- `"status invalid"` — use 0, 1, 2 ou 3 (open/resolved/pending/snoozed)
|
|
132
|
+
|
|
133
|
+
### Contact
|
|
134
|
+
- `"email has already been taken"` — duplicado na conta
|
|
135
|
+
- `"phone_number has already been taken"` — mesmo problema
|
|
136
|
+
- `"phone_number must be a valid number with country code"` — formato E.164: `+5511999999999`
|
|
137
|
+
|
|
138
|
+
### Message
|
|
139
|
+
- `"content can't be blank"` — mensagem vazia (use template se for attachment-only)
|
|
140
|
+
- `"private must be boolean"` — true/false, não string
|
|
141
|
+
|
|
142
|
+
### KanbanItem
|
|
143
|
+
- `"funnel_stage does not exist in funnel"` — etapa inválida pro funil
|
|
144
|
+
- `"conversation_display_id must exist"` — conversa não existe ou foi deletada
|
|
145
|
+
- `"position must be a positive integer"` — não pode ser negativo
|
|
146
|
+
|
|
147
|
+
## Cenários problemáticos
|
|
148
|
+
|
|
149
|
+
### "Estou recebendo 401 mesmo com token correto"
|
|
150
|
+
Possíveis causas:
|
|
151
|
+
- Token foi revogado
|
|
152
|
+
- Conta foi suspensa (`feature_account_suspended`)
|
|
153
|
+
- Token de outra conta
|
|
154
|
+
|
|
155
|
+
Verificar: `GET /api/v1/profile` (se 401 aqui, token tá inválido)
|
|
156
|
+
|
|
157
|
+
### "GET retorna 200 mas POST/PATCH retorna 403"
|
|
158
|
+
Token tem `scope: read` apenas. Precisa de token com scope completo pra escritas.
|
|
159
|
+
|
|
160
|
+
### "Operação foi pelo MCP mas não aparece na UI"
|
|
161
|
+
- Frontend pode estar com cache (refresh)
|
|
162
|
+
- WebSocket pode estar caído
|
|
163
|
+
- Pode ter sido criado em outra conta (verificar `account_id`)
|
|
164
|
+
|
|
165
|
+
### "Timer/job rodou mas dados estão errados"
|
|
166
|
+
Sidekiq pode estar retry-ando. Verificar:
|
|
167
|
+
- Job tem `discard_on` apropriado?
|
|
168
|
+
- Status final no banco vs UI
|
|
169
|
+
|
|
170
|
+
### "Tool não está disponível"
|
|
171
|
+
Possíveis razões:
|
|
172
|
+
- MCP server não foi atualizado (`npm install -g @lionchat/mcp-server@latest`)
|
|
173
|
+
- Feature flag bloqueando endpoint
|
|
174
|
+
- Plano do cliente não inclui a feature
|
|
175
|
+
|
|
176
|
+
### "Rate limit constante"
|
|
177
|
+
Padrões que causam:
|
|
178
|
+
- Polling agressivo (use webhooks)
|
|
179
|
+
- Listar tudo sem paginar
|
|
180
|
+
- Não cache de dados estáticos
|
|
181
|
+
- Loop sem `break` apropriado
|
|
182
|
+
|
|
183
|
+
## Webhooks como alternativa a polling
|
|
184
|
+
|
|
185
|
+
Se você precisa monitorar mudanças em conversas/mensagens, NÃO faça polling:
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
Polling errado:
|
|
189
|
+
while True: GET /conversations every 5s → MUITO ruim
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Use webhooks (config na conta):
|
|
193
|
+
- `conversation_created`
|
|
194
|
+
- `message_created`
|
|
195
|
+
- `conversation_resolved`
|
|
196
|
+
- Etc
|
|
197
|
+
|
|
198
|
+
LionChat envia POST pro seu endpoint quando o evento dispara.
|
|
199
|
+
|
|
200
|
+
## OAuth (apenas MCP Remote)
|
|
201
|
+
|
|
202
|
+
### "invalid_client_metadata"
|
|
203
|
+
Cliente OAuth registrado errado. Verifique:
|
|
204
|
+
- `token_endpoint_auth_method` = `none` (pra Claude/ChatGPT)
|
|
205
|
+
- `redirect_uris` exato (https, sem trailing slash extra)
|
|
206
|
+
|
|
207
|
+
### "invalid_grant"
|
|
208
|
+
Auth code expirou (vida curta — segundos). Refazer login.
|
|
209
|
+
|
|
210
|
+
### "Conector desconectou sozinho"
|
|
211
|
+
Geralmente: refresh_token expirou (TTL passou).
|
|
212
|
+
|
|
213
|
+
Hoje no LionChat: TTL é ~100 anos. Se desconectar, provavelmente:
|
|
214
|
+
- Token revogado manualmente
|
|
215
|
+
- Conta suspensa
|
|
216
|
+
- Restart do serviço MCP Remote
|
|
217
|
+
|
|
218
|
+
### "Consent loop infinito"
|
|
219
|
+
Bug conhecido: `Grant` não criado explicitamente. Atualizar MCP Remote pra versão >= 0.3.0.
|
|
220
|
+
|
|
221
|
+
## Logs e debugging
|
|
222
|
+
|
|
223
|
+
### Como pegar request ID
|
|
224
|
+
Toda resposta da API tem header `X-Request-ID`. Inclua no relatório se algo falhar.
|
|
225
|
+
|
|
226
|
+
### Como ver logs do MCP Server local
|
|
227
|
+
```bash
|
|
228
|
+
# Stdio MCP imprime em stderr — capture no Claude Desktop logs:
|
|
229
|
+
~/Library/Logs/Claude/mcp*.log
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Como ver logs do MCP Remote (servidor produção)
|
|
233
|
+
- Painel Portainer → serviço `mcp_remote` → logs
|
|
234
|
+
- Cloudflare Worker logs (se proxy)
|
|
235
|
+
- Sentry pra exceptions
|
|
236
|
+
|
|
237
|
+
## Quando reportar pro suporte
|
|
238
|
+
|
|
239
|
+
Reporte se:
|
|
240
|
+
- 500/502/503 persistente após 3 retries
|
|
241
|
+
- 401 com token recém-gerado
|
|
242
|
+
- Dados sumindo sem ação clara
|
|
243
|
+
- Comportamento inconsistente entre contas
|
|
244
|
+
|
|
245
|
+
NÃO precisa reportar:
|
|
246
|
+
- 4xx (você fez algo errado)
|
|
247
|
+
- Rate limit (esperado)
|
|
248
|
+
- 404 de recurso deletado
|
package/dist/index.js
CHANGED
|
@@ -49,8 +49,8 @@ async function main() {
|
|
|
49
49
|
console.error(`Base URL: ${config.baseUrl}`);
|
|
50
50
|
console.error(`Account: ${config.accountId}`);
|
|
51
51
|
console.error(`Tools registered: ${toolCount}`);
|
|
52
|
-
console.error(`Resources registered:
|
|
53
|
-
console.error(`Prompts registered:
|
|
52
|
+
console.error(`Resources registered: 10 (glossary, data-model, reports-guide, api-conventions, conversation-flows, kanban-deep-dive, best-practices, troubleshooting, flowbuilder-design-guide, flowbuilder-patterns)`);
|
|
53
|
+
console.error(`Prompts registered: 9 (productivity_report, stuck_leads, weekly_recap, customer_health, inactive_contacts, team_load_balance, quality_audit, whatsapp_template_usage, create_flow_brainstorm)`);
|
|
54
54
|
if (config.categories) {
|
|
55
55
|
console.error(`Categories filter: ${config.categories.join(', ')}`);
|
|
56
56
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OA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Ae,CAAC,MAAM,CAAC,CAAC;QAExB,iFAAiF;QACjF,OAAO,CAAC,KAAK,CAAC,wBAAwB,OAAO,EAAE,CAAC,CAAC;QACjD,OAAO,CAAC,KAAK,CAAC,aAAa,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;QAC7C,OAAO,CAAC,KAAK,CAAC,YAAY,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;QAC9C,OAAO,CAAC,KAAK,CAAC,qBAAqB,SAAS,EAAE,CAAC,CAAC;QAChD,OAAO,CAAC,KAAK,CAAC,wMAAwM,CAAC,CAAC;QACxN,OAAO,CAAC,KAAK,CAAC,+LAA+L,CAAC,CAAC;QAC/M,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YACtB,OAAO,CAAC,KAAK,CAAC,sBAAsB,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACtE,CAAC;QAED,kEAAkE;QAClE,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;QAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC"}
|
package/dist/resources.js
CHANGED
|
@@ -29,6 +29,42 @@ export const RESOURCES = [
|
|
|
29
29
|
description: 'Auth, paginacao, filtros, datas, codigos HTTP, rate limits. Use quando tiver duvida sobre como chamar endpoint.',
|
|
30
30
|
filename: 'api-conventions.md',
|
|
31
31
|
},
|
|
32
|
+
{
|
|
33
|
+
name: 'Fluxos de Conversacao',
|
|
34
|
+
uri: 'lionchat://docs/conversation-flows',
|
|
35
|
+
description: 'Ciclo de vida de uma conversa: criacao, greeting, auto-assignment, Captain IA, resolucao, snooze. Use pra diagnosticar comportamento de conversas.',
|
|
36
|
+
filename: 'conversation-flows.md',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'Kanban Detalhado',
|
|
40
|
+
uri: 'lionchat://docs/kanban-deep-dive',
|
|
41
|
+
description: 'Estrutura completa do Kanban: Funnel, stages, KanbanItem, item_details, pipeline, activities. Use ao trabalhar com cards ou funis.',
|
|
42
|
+
filename: 'kanban-deep-dive.md',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'Boas Praticas',
|
|
46
|
+
uri: 'lionchat://docs/best-practices',
|
|
47
|
+
description: 'Como economizar tokens, evitar rate limits, usar filtros, paginar. Consulte antes de workflows pesados ou loops em massa.',
|
|
48
|
+
filename: 'best-practices.md',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'Troubleshooting',
|
|
52
|
+
uri: 'lionchat://docs/troubleshooting',
|
|
53
|
+
description: 'Codigos HTTP, erros comuns (401/403/422/429), erros MCP, debugging, quando reportar suporte. Use pra interpretar erros.',
|
|
54
|
+
filename: 'troubleshooting.md',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'FlowBuilder Design Guide',
|
|
58
|
+
uri: 'lionchat://docs/flowbuilder-design-guide',
|
|
59
|
+
description: 'OBRIGATORIO antes de criar/editar fluxo. Arvore de decisao por necessidade, schema por tipo de node (com handles expostos), regras de layout/positioning, erros comuns, checklist pre-submit.',
|
|
60
|
+
filename: 'flowbuilder-design-guide.md',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'FlowBuilder Patterns',
|
|
64
|
+
uri: 'lionchat://docs/flowbuilder-patterns',
|
|
65
|
+
description: '10 templates de fluxos prontos pra adaptar: saudacao, captura, qualificacao BANT, CSAT, horario comercial, IA intent, re-engajamento, escalation, agendamento, webhook. Cada um com layout valido e handles certos.',
|
|
66
|
+
filename: 'flowbuilder-patterns.md',
|
|
67
|
+
},
|
|
32
68
|
];
|
|
33
69
|
function findDocsPath(filename) {
|
|
34
70
|
const candidates = [
|
package/dist/resources.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../src/resources.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,iEAAiE;AAEjE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAS1D,MAAM,CAAC,MAAM,SAAS,GAAkB;IACtC;QACE,IAAI,EAAE,oBAAoB;QAC1B,GAAG,EAAE,0BAA0B;QAC/B,WAAW,EACT,mIAAmI;QACrI,QAAQ,EAAE,aAAa;KACxB;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,GAAG,EAAE,4BAA4B;QACjC,WAAW,EACT,sGAAsG;QACxG,QAAQ,EAAE,eAAe;KAC1B;IACD;QACE,IAAI,EAAE,oBAAoB;QAC1B,GAAG,EAAE,+BAA+B;QACpC,WAAW,EACT,4GAA4G;QAC9G,QAAQ,EAAE,kBAAkB;KAC7B;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,GAAG,EAAE,iCAAiC;QACtC,WAAW,EACT,iHAAiH;QACnH,QAAQ,EAAE,oBAAoB;KAC/B;CACF,CAAC;AAEF,SAAS,YAAY,CAAC,QAAgB;IACpC,MAAM,UAAU,GAAG;QACjB,IAAI,CAAC,SAAS,EAAE,mBAAmB,EAAE,QAAQ,CAAC;QAC9C,IAAI,CAAC,SAAS,EAAE,0BAA0B,EAAE,QAAQ,CAAC;KACtD,CAAC;IACF,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C,MAAM,UAAU,GAAG;QACjB,IAAI,CAAC,SAAS,EAAE,mBAAmB,EAAE,QAAQ,CAAC;QAC9C,IAAI,CAAC,SAAS,EAAE,0BAA0B,EAAE,QAAQ,CAAC;KACtD,CAAC;IACF,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;QAC3B,IAAI,UAAU,CAAC,CAAC,CAAC;YAAE,OAAO,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,MAAiB;IACjD,KAAK,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;QAC5B,MAAM,CAAC,gBAAgB,CACrB,GAAG,CAAC,IAAI,EACR,GAAG,CAAC,GAAG,EACP;YACE,WAAW,EAAE,GAAG,CAAC,WAAW;YAC5B,QAAQ,EAAE,eAAe;SAC1B,EACD,KAAK,EAAE,GAAG,EAAE,EAAE;YACZ,MAAM,QAAQ,GAAG,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAC5C,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,MAAM,IAAI,KAAK,CAAC,0BAA0B,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC5D,CAAC;YACD,OAAO;gBACL,QAAQ,EAAE;oBACR;wBACE,GAAG,EAAE,GAAG,CAAC,IAAI;wBACb,QAAQ,EAAE,eAAe;wBACzB,IAAI,EAAE,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC;qBACtC;iBACF;aACF,CAAC;QACJ,CAAC,CACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/endpoints.json
CHANGED
|
@@ -8817,7 +8817,7 @@
|
|
|
8817
8817
|
"method": "POST",
|
|
8818
8818
|
"path": "/api/v1/accounts/{account_id}/flows",
|
|
8819
8819
|
"title": "Criar Flow",
|
|
8820
|
-
"description": "Cria um flow (FlowBuilder) na conta. Requer Admin. flow_data segue formato Vue Flow {nodes:[], edges:[]}. NODE SCHEMA — start: {label}. send_message: {label, messageItems:[{id, type:'text', content}]} handles: success/no_response/error. wait_response: {label, waitTime, waitUnit:'minutes'|'seconds', validation:'any'|'options'|'regex', acceptedOptions:['1','2'] (se options), regexPattern (se regex), invalidMessage, maxRetries:3, saveTo:'variable'|'attribute'|'', saveVariable, saveAttrKey} — quando validation='options' os handles ficam 'option_{val}' + 'timeout'; senão 'success' + 'timeout' — NUNCA precisa de condition node depois. condition: {label, conditions:[{id, label, field, operator, value}]} handles = id de cada condicao + 'default'. action: {label, items:[{key, config:{...}}]} keys comuns assign_team({team_id}), assign_agent({agent_id}), add_label({labels:['slug',...]}), remove_label({labels}), change_status({status}), change_priority({priority}), mute_conversation({}), add_private_note({content}), create_kanban_item({funnel_id, funnel_stage,...}), move_kanban_stage({funnel_id, funnel_stage}), deactivate_flow({}), assign_captain({assistant_id}). api: {label, method, url, headers:[{key,value}], body, apiResponseVar}. set_variable: {label, variables:[{name, value}]}. wait: {label, waitTime, waitUnit}. EDGE SCHEMA: {id, source, target, sourceHandle (opcional, OBRIGATORIO casar com handle exposto pelo node source), type:'deletable', animated:true}. ERROS COMUNS QUE DEVEM SER EVITADOS: (1) action usa items[].config NAO items[].params; (2) send_message usa messageItems NAO items; (3) wait_response com validation='options' NAO precisa de condition node — use sourceHandle='option_X' diretamente; (4) sourceHandle inventado tipo 'c1','c2' nao funciona — sempre usar o handle real; (5) inbox_ids precisa vir aninhado em {flow:{inbox_ids:[]}} no PUT bruto, mas no MCP basta inbox_ids no nivel raiz. Cria novo flow. Obrigatórios: name, channel_type. Valida unicidade quando aplicável. Retorna o flow criado com ID atribuído.",
|
|
8820
|
+
"description": "Cria um flow (FlowBuilder) na conta. Requer Admin. flow_data segue formato Vue Flow {nodes:[], edges:[]}. NODE SCHEMA — start: {label}. send_message: {label, messageItems:[{id, type:'text', content}]} handles: success/no_response/error. wait_response: {label, waitTime, waitUnit:'minutes'|'seconds', validation:'any'|'options'|'regex', acceptedOptions:['1','2'] (se options), regexPattern (se regex), invalidMessage, maxRetries:3, saveTo:'variable'|'attribute'|'', saveVariable, saveAttrKey} — quando validation='options' os handles ficam 'option_{val}' + 'timeout'; senão 'success' + 'timeout' — NUNCA precisa de condition node depois. condition: {label, conditions:[{id, label, field, operator, value}]} handles = id de cada condicao + 'default'. action: {label, items:[{key, config:{...}}]} keys comuns assign_team({team_id}), assign_agent({agent_id}), add_label({labels:['slug',...]}), remove_label({labels}), change_status({status}), change_priority({priority}), mute_conversation({}), add_private_note({content}), create_kanban_item({funnel_id, funnel_stage,...}), move_kanban_stage({funnel_id, funnel_stage}), deactivate_flow({}), assign_captain({assistant_id}). api: {label, method, url, headers:[{key,value}], body, apiResponseVar}. set_variable: {label, variables:[{name, value}]}. wait: {label, waitTime, waitUnit}. EDGE SCHEMA: {id, source, target, sourceHandle (opcional, OBRIGATORIO casar com handle exposto pelo node source), type:'deletable', animated:true}. ERROS COMUNS QUE DEVEM SER EVITADOS: (1) action usa items[].config NAO items[].params; (2) send_message usa messageItems NAO items; (3) wait_response com validation='options' NAO precisa de condition node — use sourceHandle='option_X' diretamente; (4) sourceHandle inventado tipo 'c1','c2' nao funciona — sempre usar o handle real; (5) inbox_ids precisa vir aninhado em {flow:{inbox_ids:[]}} no PUT bruto, mas no MCP basta inbox_ids no nivel raiz. Cria novo flow. Obrigatórios: name, channel_type. Valida unicidade quando aplicável. Retorna o flow criado com ID atribuído. POSITIONING (CRITICO): cada node DEVE ter position:{x,y}. Sem isso, todos empilham no canvas no (0,0). Regra basica de layout: start em {x:50,y:300}, espaco horizontal +320 entre nodes sequenciais, ramificacoes em +/-150 vertical. ANTES DE GERAR JSON consulte o resource lionchat://docs/flowbuilder-design-guide (schema completo de cada tipo de node, handles expostos, erros comuns, checklist) e lionchat://docs/flowbuilder-patterns (10 templates prontos pra adaptar). BRAINSTORMING: se faltou info critica (canal, gatilho, conteudo), use o prompt create_flow_brainstorm como banco de perguntas sugeridas — pergunte SO o que falta, sem checklist forcado. APOS GERAR: rode o checklist da secao 6 do design guide antes de submeter (1 node start, todo node com id unico + position + data, todo edge com sourceHandle valido). NUNCA invente sourceHandle (no condition use cond_0/cond_1/default, no wait_response options use option_X, no AI intent use intent_<opcao>).",
|
|
8821
8821
|
"category": "Flows",
|
|
8822
8822
|
"params": [
|
|
8823
8823
|
{
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lionchat/mcp-server",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "MCP server for LionChat API — 547 tools +
|
|
3
|
+
"version": "0.3.2",
|
|
4
|
+
"description": "MCP server for LionChat API — 547 tools + 10 resources + 9 prompts for AI agents (FlowBuilder enriched)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"bin": {
|