@lionchat/mcp-server 0.4.3 → 0.4.4
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.3 — 2026-05-20
|
|
4
|
+
|
|
5
|
+
### Corrigido
|
|
6
|
+
|
|
7
|
+
- **Doc do wrapper de body** (`api-conventions.md`, `troubleshooting.md`, `instructions.md`): auditoria empirica derrubou o claim falso de "HTTP 500 silencioso sem wrapper". O Rails do projeto roda com `wrap_parameters: [:json]` global, entao body raiz e auto-wrappado na maioria dos endpoints. Doc reescrita com base em testes curl reais contra os controllers (`kanban_config`, `funnels`, `labels`, `custom_attribute_definitions`, `kanban_items` aceitam ambos os formatos).
|
|
8
|
+
- **Pegadinha do `/contacts`**: documentada nova armadilha real — `POST /contacts` com wrapper `{"contact": {...}}` retorna 200 mas cria contato com campos vazios. Causa: `ContactsController` usa `params.permit(:name, ...)` direto, sem `require(:contact)`. **Sempre enviar body raiz pro `/contacts`**.
|
|
9
|
+
- **`findDocsPath` em `src/resources.ts`**: agora cobre 3 layouts (`dist/docs/resources/` publicado, monorepo legado, `src/docs/` dev) pra evitar `null` quando rodado via `npx`.
|
|
10
|
+
|
|
11
|
+
### Mudado
|
|
12
|
+
|
|
13
|
+
- `scripts/extract-endpoints.ts` migrado de `require()` pra `import` (ESM). Adicionadas sub-categorias `Validacao WhatsApp` e `Chat Interno` no mapeamento de slugs.
|
|
14
|
+
|
|
15
|
+
## 0.4.0 / 0.4.1 / 0.4.2 — 2026-05-19
|
|
16
|
+
|
|
17
|
+
### Adicionado
|
|
18
|
+
|
|
19
|
+
- **Completion API** — sugestoes de auto-complete pros parametros das tools (ex: lista `account_id`/`inbox_id` disponiveis). Reduz erro de id inexistente.
|
|
20
|
+
- **Progress notifications** — operacoes longas reportam progresso em tempo real (import de contatos, exports, etc), em vez de ficar em silencio ate terminar.
|
|
21
|
+
- **User-Agent customizado** — requests do MCP agora marcam origem MCP no `audit_log` do LionChat, separando do trafego normal.
|
|
22
|
+
|
|
23
|
+
## 0.3.2 — 2026-05-19
|
|
24
|
+
|
|
25
|
+
### Adicionado
|
|
26
|
+
|
|
27
|
+
- **FlowBuilder enrichment** — Resource `flowbuilder-design-guide` com schema completo de nodes, handles por tipo, layout/positioning e erros comuns + `flowbuilder-patterns` com 10 templates prontos (saudacao, captura, qualificacao, CSAT, IA, etc) + Prompt `create_flow_brainstorm` pra estruturar fluxos antes de criar. LLMs agora tem material concreto pra montar `flow_data` sem chutar.
|
|
28
|
+
|
|
29
|
+
## 0.3.1 — 2026-05-18
|
|
30
|
+
|
|
31
|
+
### Adicionado
|
|
32
|
+
|
|
33
|
+
- **Sprint 3 do MCP Knowledge Enrichment** — +4 Resources (`conversation-flows`, `kanban-deep-dive`, `best-practices`, `troubleshooting`) e +4 Prompts (`inactive_contacts`, `team_load_balance`, `quality_audit`, `whatsapp_template_usage`). Total: 10 Resources + 9 Prompts no servidor.
|
|
34
|
+
|
|
35
|
+
## 0.3.0 — 2026-05-18
|
|
36
|
+
|
|
37
|
+
### Adicionado
|
|
38
|
+
|
|
39
|
+
- **MCP Instructions** carregadas no boot do servidor (~3K tokens) explicando data model, status codes, convenções de API e workflows tipicos pra qualquer LLM que conectar entender o contexto antes de chamar tools.
|
|
40
|
+
- **4 Resources iniciais**: `glossary`, `data-model`, `reports-guide`, `api-conventions`.
|
|
41
|
+
- **4 Prompts iniciais**: `productivity_report`, `stuck_leads`, `weekly_recap`, `customer_health`.
|
|
42
|
+
- **Enriquecimento de 547 descriptions** das tools (48 → 183 chars em media), com `returns`, `common_use_cases` e `related_tools` em cada uma.
|
|
43
|
+
|
|
3
44
|
## 0.2.1 — 2026-05-13
|
|
4
45
|
|
|
5
46
|
### Adicionado
|
|
@@ -95,6 +95,28 @@ Se receber `429 Too Many Requests`:
|
|
|
95
95
|
|
|
96
96
|
IA é boa pra: triagem, classificação, resumo, sugestão de resposta, análise.
|
|
97
97
|
|
|
98
|
+
## Botão de pânico: pausar/retomar AI Agente (2026-05-22)
|
|
99
|
+
|
|
100
|
+
Pra parar IMEDIATAMENTE um AI Agente (todas as conversas dele) sem perder configuração:
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
lionchat_captain_assistants_update id=<id> paused=true
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
O campo `paused` é **top-level** (não vai em `config`). Quando `true`:
|
|
107
|
+
- Jobs de resposta automática são curto-circuitados (não chamam o LLM)
|
|
108
|
+
- Follow-ups agendados não disparam
|
|
109
|
+
- Callbacks agendados são limpos
|
|
110
|
+
|
|
111
|
+
Pra reativar: `paused=false`. Toggle é auditado (`audited only: [:paused]`).
|
|
112
|
+
|
|
113
|
+
**Janela de inconsistência:** ~5-8s. Jobs que já estão dentro do LLM no momento da pausa enviam a resposta mesmo. Use o botão pra parar **novas** respostas, não pra cancelar uma que já saiu.
|
|
114
|
+
|
|
115
|
+
## Limite do prompt e cache OpenAI (2026-05-22)
|
|
116
|
+
|
|
117
|
+
- `config.instructions` (system prompt do agente) aceita até **20.000 caracteres** (antes 10k). Acima de 15k, o frontend mostra aviso "lost in the middle" — prefira colocar instruções críticas no início ou final.
|
|
118
|
+
- **Cache automático** ativo em todos os 15 modelos suportados (GPT-4.1 Nano até GPT-5.2 Pro, o1, o3, o4-mini). Desconto 50-75% no input cachado, sem configuração. Reuso do prompt do agente em múltiplas conversas maximiza a economia.
|
|
119
|
+
|
|
98
120
|
## Variáveis de conta (account_variables)
|
|
99
121
|
|
|
100
122
|
Pra dados que se repetem (slogans, endereços, horários):
|
|
@@ -203,6 +203,36 @@ Conversation
|
|
|
203
203
|
| `conversation_opened` | Status volta pra open (reabertura) |
|
|
204
204
|
| `conversation_resolved` | Agente resolve |
|
|
205
205
|
| `conversation_pending` | Status muda pra pending |
|
|
206
|
-
| `conversation_updated` |
|
|
206
|
+
| `conversation_updated` | Acao na conversa — filtrada por `action_types` (UI: "Acao na conversa") |
|
|
207
207
|
| `message_created` | Nova mensagem (incoming ou outgoing) |
|
|
208
208
|
| `first_reply_created` | Primeira resposta humana |
|
|
209
|
+
|
|
210
|
+
### Subtipos de `conversation_updated` (campo `action_types`)
|
|
211
|
+
|
|
212
|
+
Ao criar/atualizar uma `automation_rule` com `event_name: 'conversation_updated'`, envie tambem
|
|
213
|
+
o campo `action_types` (array de strings) pra filtrar quais mudancas disparam a regra. Vazio/nulo
|
|
214
|
+
mantem comportamento legado (qualquer mudanca dispara — retrocompat com regras antigas).
|
|
215
|
+
|
|
216
|
+
| Subtipo | Detectado quando muda |
|
|
217
|
+
|---|---|
|
|
218
|
+
| `label_added` | `label_list` (apos - antes nao vazio) |
|
|
219
|
+
| `label_removed` | `label_list` (antes - apos nao vazio) |
|
|
220
|
+
| `status_changed` | `status` |
|
|
221
|
+
| `priority_changed` | `priority` |
|
|
222
|
+
| `agent_assigned` | `assignee_id` |
|
|
223
|
+
| `team_assigned` | `team_id` |
|
|
224
|
+
| `custom_attribute_changed` | `custom_attributes` |
|
|
225
|
+
| `language_changed` | `additional_attributes.conversation_language` |
|
|
226
|
+
| `ai_agent_assigned` | `captain_assistant_id` |
|
|
227
|
+
|
|
228
|
+
Exemplo de criacao via API:
|
|
229
|
+
```json
|
|
230
|
+
POST /api/v1/accounts/{account_id}/automation_rules
|
|
231
|
+
{
|
|
232
|
+
"name": "Notificar quando etiqueta VIP entra",
|
|
233
|
+
"event_name": "conversation_updated",
|
|
234
|
+
"action_types": ["label_added"],
|
|
235
|
+
"conditions": [{"attribute_key": "labels", "filter_operator": "contains", "values": ["vip"]}],
|
|
236
|
+
"actions": [{"action_name": "send_email_to_team", "action_params": {"team_ids": [1], "message": "VIP!"}}]
|
|
237
|
+
}
|
|
238
|
+
```
|
|
@@ -216,6 +216,7 @@ Captain::Assistant
|
|
|
216
216
|
├── account_id (FK)
|
|
217
217
|
├── name
|
|
218
218
|
├── description
|
|
219
|
+
├── paused (boolean, default false) — botao de panico (2026-05-22). true = pausa respostas, follow-up e callbacks. Auditado. Top-level, NAO mora em config.
|
|
219
220
|
├── config (jsonb: model, temperature, instructions, feature_memory, feature_faq, ...)
|
|
220
221
|
├── guardrails (string[])
|
|
221
222
|
├── response_guidelines (string[])
|
|
@@ -248,8 +249,13 @@ AutomationRule
|
|
|
248
249
|
├── account_id (FK)
|
|
249
250
|
├── name
|
|
250
251
|
├── event_name (conversation_created, conversation_resolved, message_created, conversation_opened, conversation_updated)
|
|
252
|
+
├── action_types (jsonb array) — subtipos de conversation_updated:
|
|
253
|
+
│ label_added, label_removed, status_changed, priority_changed,
|
|
254
|
+
│ agent_assigned, team_assigned, custom_attribute_changed,
|
|
255
|
+
│ language_changed, ai_agent_assigned. Vazio/nulo = retrocompat (dispara em qualquer)
|
|
251
256
|
├── conditions (jsonb array)
|
|
252
257
|
├── actions (jsonb array)
|
|
258
|
+
├── inbox_id (FK, opcional — usado em event_name=webhook)
|
|
253
259
|
└── active (bool)
|
|
254
260
|
|
|
255
261
|
Macro
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lionchat/mcp-server",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "MCP server for LionChat API — 547 tools + 10 resources + 9 prompts. Audit-log aware, completion API, progress notifications.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|