@comando.one/mcp-server 0.3.1 → 0.4.0

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/README.md CHANGED
@@ -51,7 +51,7 @@ Ambos expõem o **mesmo conjunto de ferramentas** (50 curadas + `lookups` + `com
51
51
 
52
52
  ## Como funciona
53
53
 
54
- - **126 tools curadas** (gerados a partir do OpenAPI canônico, zero drift) cobrindo as operações de maior valor — `customers_list`, `invoices_create`/`invoices_delete`, `charges_create`, `nfse_emit`, `payouts_create`, `contracts_pause`/`contracts_resume`, `service_categories_create`, `reports_aging_actions`/`reports_cashflow_forecast`, `audit_timeline`, `cost_centers_create`, etc.
54
+ - **127 tools curadas** (gerados a partir do OpenAPI canônico, zero drift) cobrindo as operações de maior valor — `customers_list`, `invoices_create`/`invoices_delete`, `charges_create`, `nfse_emit`, `payouts_create`, `contracts_pause`/`contracts_resume`, `service_categories_create`, `reports_aging_actions`/`reports_cashflow_forecast`, `audit_timeline`, `documents_analyze` (lê boleto/guia/NF anexada e extrai valor, vencimento e emitente), `cost_centers_create`, etc.
55
55
  - **`comando_request`** — escape hatch genérico (`method`, `path`, `query`, `body`) que cobre 100% dos endpoints restantes.
56
56
  - **`lookups`** — catálogos read-only (centros de custo, condições/métodos de pagamento, naturezas, contas bancárias).
57
57
  - **`whoami`** — identidade, empresas acessíveis e scopes da chave.
package/dist/index.js CHANGED
@@ -172,6 +172,7 @@ var MANIFEST = [
172
172
  { operationId: "getPurchaseInvoice", tool: "purchase_invoices_get" },
173
173
  { operationId: "createPurchaseInvoice", tool: "purchase_invoices_create", write: true },
174
174
  { operationId: "cancelPurchaseInvoice", tool: "purchase_invoices_cancel", write: true, destructive: true },
175
+ { operationId: "deletePurchaseInvoice", tool: "purchase_invoices_delete", write: true, destructive: true },
175
176
  // ----- Despesas & Serviços -----
176
177
  { operationId: "listExpenses", tool: "expenses_list" },
177
178
  { operationId: "createExpense", tool: "expenses_create", write: true },
@@ -192,6 +193,7 @@ var MANIFEST = [
192
193
  { operationId: "reverseSplitExecution", tool: "split_reverse", write: true, destructive: true },
193
194
  { operationId: "releaseSplitItem", tool: "split_release_item", write: true },
194
195
  // Auditoria
196
+ { operationId: "analyzeDocument", tool: "documents_analyze", write: true },
195
197
  { operationId: "getAuditTimeline", tool: "audit_timeline" },
196
198
  // Categorias de serviço
197
199
  { operationId: "listServiceCategories", tool: "service_categories_list" },
@@ -833,10 +835,32 @@ var SCHEMAS = {
833
835
  description: { type: "string" },
834
836
  amount: { type: "number" },
835
837
  due_date: { type: "string", format: "date" },
836
- payment_status: { type: "string", enum: ["pendente", "parcial", "pago", "vencido"], default: "pendente" }
838
+ payment_status: { type: "string", enum: ["pendente", "parcial", "pago", "vencido"], default: "pendente" },
839
+ boleto_barcode: { type: "string", description: "Linha digit\xE1vel / c\xF3digo de barras do boleto (s\xF3 d\xEDgitos)." },
840
+ pix_key: { type: "string" },
841
+ pix_copia_e_cola: { type: "string" }
837
842
  }
838
843
  }
839
844
  },
845
+ items: {
846
+ type: "array",
847
+ description: "Itens da fatura. Se omitido, o valor de 'amount' vira um item \xFAnico \u2014 a fatura n\xE3o pode ficar sem item (o formul\xE1rio do app n\xE3o salva assim).",
848
+ items: {
849
+ type: "object",
850
+ required: ["name"],
851
+ properties: {
852
+ name: { type: "string" },
853
+ description: { type: "string" },
854
+ unit: { type: "string", default: "un" },
855
+ quantity: { type: "number", default: 1 },
856
+ unit_price: { type: "number" },
857
+ subtotal: { type: "number", description: "Calculado de quantity \xD7 unit_price quando omitido." }
858
+ }
859
+ }
860
+ },
861
+ title: { type: "string", description: "Descri\xE7\xE3o da fatura; vira o nome do item quando 'items' n\xE3o \xE9 informado." },
862
+ digitable_line: { type: "string", description: "Atalho: grava o boleto na parcela \xFAnica criada por 'due_date'." },
863
+ pix_key: { type: "string", description: "Atalho: grava a chave Pix na parcela \xFAnica." },
840
864
  notes: { type: "string" }
841
865
  }
842
866
  },
@@ -2217,6 +2241,51 @@ var OPENAPI_SPEC = {
2217
2241
  responses: { "200": paginatedResponse("#/components/schemas/ServiceUnit"), ...COMMON_ERRORS }
2218
2242
  }
2219
2243
  },
2244
+ "/documents/analyze": {
2245
+ post: {
2246
+ tags: ["Documentos"],
2247
+ summary: "Analisar documento anexado",
2248
+ operationId: "analyzeDocument",
2249
+ description: "L\xEA um anexo da empresa (PDF, imagem ou texto) e extrai os campos financeiros: tipo do documento, valor, vencimento, n\xFAmero, emitente, linha digit\xE1vel do boleto e chave Pix. Usa o texto do arquivo e, quando ele n\xE3o basta (PDF escaneado), a leitura visual do modelo.",
2250
+ security: [{ ApiKeyAuth: ["documents:read"] }],
2251
+ requestBody: {
2252
+ required: true,
2253
+ content: { "application/json": { schema: {
2254
+ type: "object",
2255
+ properties: {
2256
+ attachment_id: { type: "string", format: "uuid", description: "UUID do anexo em entity_attachments." },
2257
+ file_name: { type: "string", description: "Alternativa ao id: parte do nome do arquivo." }
2258
+ }
2259
+ } } }
2260
+ },
2261
+ responses: {
2262
+ "200": {
2263
+ description: "Campos extra\xEDdos do documento",
2264
+ content: { "application/json": { schema: {
2265
+ type: "object",
2266
+ properties: {
2267
+ attachment_id: { type: "string", format: "uuid" },
2268
+ file_name: { type: "string" },
2269
+ kind: { type: "string", description: "boleto | arrecadacao | nfe | nfse | fatura | recibo | desconhecido" },
2270
+ direction: { type: "string", description: "pagar | receber | indefinido" },
2271
+ amount: { type: "number", nullable: true },
2272
+ due_date: { type: "string", format: "date", nullable: true },
2273
+ document_number: { type: "string", nullable: true },
2274
+ barcode: { type: "string", nullable: true },
2275
+ digitable_line: { type: "string", nullable: true },
2276
+ pix_key: { type: "string", nullable: true },
2277
+ counterparty_name: { type: "string", nullable: true },
2278
+ counterparty_document: { type: "string", nullable: true },
2279
+ is_own_company_document: { type: "boolean", description: "O documento encontrado \xE9 o da pr\xF3pria empresa (contribuinte/pagador)." },
2280
+ missing: { type: "array", items: { type: "string" }, description: "Campos essenciais que n\xE3o foi poss\xEDvel extrair." },
2281
+ extracted: { type: "boolean" }
2282
+ }
2283
+ } } }
2284
+ },
2285
+ "404": { description: "Documento n\xE3o encontrado" }
2286
+ }
2287
+ }
2288
+ },
2220
2289
  "/audit/timeline": {
2221
2290
  get: {
2222
2291
  tags: ["Auditoria"],
@@ -2597,6 +2666,14 @@ var OPENAPI_SPEC = {
2597
2666
  operationId: "getPurchaseInvoice",
2598
2667
  security: [{ ApiKeyAuth: ["purchase_invoices:read"] }],
2599
2668
  responses: { "200": { description: "Conta a pagar", content: { "application/json": { schema: { $ref: "#/components/schemas/PurchaseInvoice" } } } }, "404": errorResponse("Conta a pagar n\xE3o encontrada"), ...COMMON_ERRORS }
2669
+ },
2670
+ delete: {
2671
+ tags: ["Contas a Pagar"],
2672
+ summary: "Excluir conta a pagar",
2673
+ operationId: "deletePurchaseInvoice",
2674
+ description: "Exclus\xE3o definitiva. Recusa (409) contas com pagamento registrado ou parcela paga \u2014 nesses casos use o cancelamento, que preserva o hist\xF3rico.",
2675
+ security: [{ ApiKeyAuth: ["purchase_invoices:delete"] }],
2676
+ responses: { "204": { description: "Exclu\xEDda" }, "404": errorResponse("Conta a pagar n\xE3o encontrada"), "409": errorResponse("H\xE1 pagamento registrado ou registros vinculados que impedem a exclus\xE3o"), ...COMMON_ERRORS }
2600
2677
  }
2601
2678
  },
2602
2679
  "/purchase-invoices/{id}/cancel": {
@@ -3091,6 +3168,13 @@ var OPENAPI_SPEC = {
3091
3168
 
3092
3169
  // ../../src/lib/apiScopes.ts
3093
3170
  var API_MODULES = [
3171
+ {
3172
+ key: "documents",
3173
+ label: "Documentos",
3174
+ permissions: [
3175
+ { key: "read", label: "Analisar documentos", description: "Ler anexos (boleto, guia, NF) e extrair valor, vencimento e emitente" }
3176
+ ]
3177
+ },
3094
3178
  {
3095
3179
  key: "customers",
3096
3180
  label: "Clientes",
@@ -3180,7 +3264,8 @@ var API_MODULES = [
3180
3264
  permissions: [
3181
3265
  { key: "read", label: "Listar e visualizar", description: "Consultar contas a pagar" },
3182
3266
  { key: "create", label: "Criar", description: "Lan\xE7ar contas a pagar" },
3183
- { key: "cancel", label: "Cancelar", description: "Cancelar contas a pagar" }
3267
+ { key: "cancel", label: "Cancelar", description: "Cancelar contas a pagar" },
3268
+ { key: "delete", label: "Excluir", description: "Excluir contas a pagar definitivamente" }
3184
3269
  ]
3185
3270
  },
3186
3271
  {
@@ -3305,7 +3390,9 @@ function describeOperation(operationId) {
3305
3390
  const d = declaredByName.get(name);
3306
3391
  properties[name] = {
3307
3392
  ...d?.schema ?? { type: "string" },
3308
- description: d?.description ?? `Identificador (${name}).`
3393
+ description: d?.description ?? // Sem dizer que é UUID, o planner manda o identificador humano que tem em mãos
3394
+ // (o número da nota) e a chamada morre. Observado em 2026-08-24.
3395
+ `UUID do registro (${name}). Obtenha em uma listagem ou consulta \u2014 N\xC3O \xE9 n\xFAmero, c\xF3digo ou nome.`
3309
3396
  };
3310
3397
  required.push(name);
3311
3398
  }
@@ -3346,6 +3433,7 @@ function describeOperation(operationId) {
3346
3433
  scopes: extractScopes(operation),
3347
3434
  inputSchema,
3348
3435
  summary: operation.summary,
3436
+ description: operation.description,
3349
3437
  description: operation.description
3350
3438
  };
3351
3439
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comando.one/mcp-server",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "Servidor MCP (Model Context Protocol) para a API pública do Comando.One — opere seu ERP por linguagem natural.",
5
5
  "type": "module",
6
6
  "license": "MIT",