@useinvio/nfse-sdk 3.1.0 → 3.2.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.
Files changed (95) hide show
  1. package/CHANGELOG.md +176 -0
  2. package/README.en.md +146 -0
  3. package/README.md +76 -576
  4. package/dist/agent.d.ts +46 -1
  5. package/dist/agent.js +320 -4
  6. package/dist/agent.js.map +1 -1
  7. package/dist/cli.d.ts +2 -0
  8. package/dist/cli.js +520 -0
  9. package/dist/cli.js.map +1 -0
  10. package/dist/cliBin.d.ts +2 -0
  11. package/dist/cliBin.js +6 -0
  12. package/dist/cliBin.js.map +1 -0
  13. package/dist/cliExample.d.ts +6 -0
  14. package/dist/cliExample.js +29 -0
  15. package/dist/cliExample.js.map +1 -0
  16. package/dist/client.d.ts +47 -2
  17. package/dist/client.js +36 -6
  18. package/dist/client.js.map +1 -1
  19. package/dist/config.d.ts +3 -0
  20. package/dist/config.js +8 -0
  21. package/dist/config.js.map +1 -1
  22. package/dist/consultas.d.ts +34 -0
  23. package/dist/consultas.js +61 -0
  24. package/dist/consultas.js.map +1 -0
  25. package/dist/dpsJson.js +1 -41
  26. package/dist/dpsJson.js.map +1 -1
  27. package/dist/emissaoNota.d.ts +8 -3
  28. package/dist/emissaoNota.js +6 -3
  29. package/dist/emissaoNota.js.map +1 -1
  30. package/dist/eventoJson.d.ts +76 -0
  31. package/dist/eventoJson.js +128 -0
  32. package/dist/eventoJson.js.map +1 -0
  33. package/dist/eventosNfse.d.ts +38 -0
  34. package/dist/eventosNfse.js +73 -0
  35. package/dist/eventosNfse.js.map +1 -0
  36. package/dist/gzipB64.d.ts +5 -0
  37. package/dist/gzipB64.js +12 -0
  38. package/dist/gzipB64.js.map +1 -1
  39. package/dist/index.d.ts +17 -7
  40. package/dist/index.js +9 -4
  41. package/dist/index.js.map +1 -1
  42. package/dist/mcpCli.d.ts +2 -0
  43. package/dist/mcpCli.js +7 -0
  44. package/dist/mcpCli.js.map +1 -0
  45. package/dist/mcpServer.d.ts +49 -0
  46. package/dist/mcpServer.js +159 -0
  47. package/dist/mcpServer.js.map +1 -0
  48. package/dist/nfseXml.d.ts +48 -0
  49. package/dist/nfseXml.js +86 -0
  50. package/dist/nfseXml.js.map +1 -0
  51. package/dist/rejeicoes.d.ts +50 -0
  52. package/dist/rejeicoes.js +62 -0
  53. package/dist/rejeicoes.js.map +1 -0
  54. package/dist/rejeicoesCatalog.d.ts +10 -0
  55. package/dist/rejeicoesCatalog.js +4449 -0
  56. package/dist/rejeicoesCatalog.js.map +1 -0
  57. package/dist/sefinClient.d.ts +100 -6
  58. package/dist/sefinClient.js +211 -19
  59. package/dist/sefinClient.js.map +1 -1
  60. package/dist/signXml.js +9 -1
  61. package/dist/signXml.js.map +1 -1
  62. package/dist/testing.d.ts +80 -0
  63. package/dist/testing.js +285 -0
  64. package/dist/testing.js.map +1 -0
  65. package/dist/xmlBuild.d.ts +11 -0
  66. package/dist/xmlBuild.js +44 -0
  67. package/dist/xmlBuild.js.map +1 -0
  68. package/dist/xmlInspection.d.ts +1 -1
  69. package/dist/xmlInspection.js.map +1 -1
  70. package/dist/xsdValidation.d.ts +7 -0
  71. package/dist/xsdValidation.js +37 -15
  72. package/dist/xsdValidation.js.map +1 -1
  73. package/docs/README.md +47 -0
  74. package/docs/REGRAS_NEGOCIO_EMISSAO.md +8 -8
  75. package/docs/conceitos/como-funciona.md +87 -0
  76. package/docs/guias/adn.md +51 -0
  77. package/docs/guias/agentes-ia.md +111 -0
  78. package/docs/guias/cancelar.md +70 -0
  79. package/docs/guias/certificado.md +88 -0
  80. package/docs/guias/cli.md +68 -0
  81. package/docs/guias/consultar.md +54 -0
  82. package/docs/guias/emitir.md +172 -0
  83. package/docs/guias/recuperar-emissao.md +33 -0
  84. package/docs/guias/rejeicoes.md +70 -0
  85. package/docs/guias/testes.md +79 -0
  86. package/docs/guias/timeouts.md +33 -0
  87. package/docs/referencia/ambientes.md +35 -0
  88. package/docs/referencia/api.md +137 -0
  89. package/docs/referencia/erros.md +55 -0
  90. package/docs/tutoriais/primeira-nfse.md +130 -0
  91. package/examples/README.md +2 -0
  92. package/examples/cancel-nfse.ts +29 -0
  93. package/examples/recover-emission.ts +29 -0
  94. package/llms.txt +97 -92
  95. package/package.json +23 -3
package/CHANGELOG.md ADDED
@@ -0,0 +1,176 @@
1
+ # Changelog
2
+
3
+ Todas as mudancas relevantes deste pacote sao documentadas aqui. O formato segue
4
+ [Keep a Changelog](https://keepachangelog.com/pt-BR/1.1.0/) e o projeto usa
5
+ [Semantic Versioning](https://semver.org/lang/pt-BR/).
6
+
7
+ ## [3.2.0] - nao publicado
8
+
9
+ ### Added
10
+
11
+ - Cancelamento de NFS-e: `cancelarNfse` (e101101) e `cancelarNfsePorSubstituicao`
12
+ (e105102). O pedido e montado, validado contra o XSD oficial `pedRegEvento`,
13
+ assinado e enviado. `autor` usa o CNPJ/CPF do titular do certificado por
14
+ padrao. Builders: `buildCancelamentoFromJson`,
15
+ `buildCancelamentoPorSubstituicaoFromJson`, `buildPedRegEventoId`, mais as
16
+ tabelas `TP_EVENTO`, `MOTIVO_CANCELAMENTO`, `MOTIVO_SUBSTITUICAO` e os erros
17
+ `RegistrarEventoError` e `EventoInvalidoError`.
18
+ - Consulta tipada: `obterNfse` devolve o XML descompactado e um `resumo` tipado
19
+ (`NfseResumo`). `lerNfse(xml)` le um XML que voce ja tem. Falhas geram
20
+ `ConsultaNfseError`, com `notFound` para HTTP 404.
21
+ - Recuperacao de emissao: `recuperarNfsePorDps(dpsId)` usa `GET /dps/{id}` e
22
+ depois `GET /nfse/{chave}` para descobrir se uma DPS foi processada apos um
23
+ timeout, sem reenviar. A forma crua e `consultarDps`.
24
+ - `consultarEvento` (`GET /nfse/{chave}/eventos/{tpEvento}/{nSeqEvento}`).
25
+ - Ambiente de Dados Nacional (ADN): `baixarDanfse` (PDF do DANFSe),
26
+ `distribuirDfePorNsu`, `consultarEventosPorChaveAdn` e parametros municipais
27
+ (`consultarConvenio`, `consultarAliquota`, `consultarHistoricoAliquotas`,
28
+ `consultarRegimesEspeciais`, `consultarRetencoes`, `consultarBeneficio`).
29
+ Tambem `ADN_BASE_URL` e `resolveAdnBaseUrl`.
30
+ - `SefinRequestOptions` (`timeoutMs`, `retries`, `signal`) em todas as funcoes
31
+ de rede e em `NfseClient({ request })`. `retries` vale so para GETs (erro de
32
+ rede, HTTP 429/502/503/504), com backoff exponencial. Emissao e eventos nunca
33
+ sao repetidos.
34
+ - `NfseClient`: `invoices.retrieve`, `getByDpsId`, `recover`, `cancel`,
35
+ `cancelBySubstitution` e `danfse`, alem de `events`, `distribution` e
36
+ `municipalParameters`.
37
+ - `validatePedRegEventoXmlAgainstXsd` e `PedRegEventoXsdValidationError`.
38
+ - `SefinParametroInvalidoError`: Id da DPS, tipo de evento, NSU, codigo de
39
+ municipio e demais parametros de caminho sao validados antes da rede.
40
+ - `gunzipBase64Flexivel` para respostas em Base64 simples ou duplo.
41
+
42
+ - **Catalogo oficial de rejeicoes**: `explicarRejeicao`, `explicarErros`,
43
+ `buscarRejeicao` e `listarRejeicoes` trazem a mensagem, a regra, o campo e o
44
+ nivel de cada codigo, gerados dos anexos oficiais do gov.br (Anexo I v1.01 de
45
+ 09/02/2026 e Anexo II v1.01 de 22/01/2026). O catalogo pode ser regenerado com
46
+ `scripts/build-rejection-catalog.mjs`.
47
+ - **`@useinvio/nfse-sdk/testing`**: `createTestCertificate` (A1 autoassinado com
48
+ CNPJ/CPF nos campos ICP-Brasil) e `installMockSefin` (SEFIN e ADN simulados no
49
+ processo, que validam XSD e assinatura e permitem simular rejeicoes, falhas de
50
+ rede e respostas perdidas).
51
+ - **Servidor MCP** sem dependencias: `@useinvio/nfse-sdk/mcp`
52
+ (`createNfseMcpServer`, `runNfseMcpStdio`), o bin `nfse-mcp` e o pacote
53
+ `@useinvio/nfse-mcp` em `mcp/`, com `server.json` para o MCP Registry.
54
+ Configuracao por variaveis de ambiente; escrita desligada por padrao; modo de
55
+ teste com `NFSE_MCP_MOCK=1`.
56
+ - **Ferramentas de agente**: `explain_rejection`, `recover_nfse_by_dps` e
57
+ `createNfseAgentToolkit({ allowWrite })`, que adiciona emissao e cancelamento em
58
+ duas etapas (`prepare_*` e `confirm_*`, com ids de uso unico que expiram). Um
59
+ `confirm_nfse_emission` repetido apos falha de rede consulta a DPS antes de
60
+ reenviar. Issues da SEFIN agora trazem a regra oficial em `suggestion`.
61
+ - Plugin do Claude Code (`plugin/`, com a skill `nfse-nacional`) e marketplace em
62
+ `.claude-plugin/marketplace.json`.
63
+ - **Linha de comando `nfse`**: `init`, `doctor`, `cert`, `validate`, `xml`, `emit`,
64
+ `get`, `danfse`, `cancel`, `recover`, `explain` e `mcp`, com `--mock`,
65
+ `--producao`, `--json` e confirmacao antes de emitir ou cancelar.
66
+ - **Paginas de rejeicao**: `docs/rejeicoes/`, uma pagina por codigo oficial, geradas
67
+ do catalogo (`npm run build:rejection-pages`). Ficam fora do pacote npm.
68
+ - **Playground** em `playground/index.html`: JSON da DPS, validacao, XML e explicacao
69
+ de rejeicoes no navegador, sem enviar nada (`npm run build:playground`).
70
+ - `SECURITY.md`, formularios de issue e template de PR.
71
+ - `AGENTS.md` para agentes que alteram o repositorio. `llms.txt` passa a ser o
72
+ guia de uso da API para assistentes de codigo.
73
+
74
+ ### Fixed
75
+
76
+ - `verifyDps` retorna `false` para assinatura invalida ou XML adulterado, como
77
+ documentado. Com `xml-crypto` 6 a funcao lancava excecao.
78
+ - `enviarEvento` agora envia o campo oficial `pedidoRegistroEventoXmlGZipB64`.
79
+ Antes enviava `pedRegXmlGZipB64`, que a SEFIN nao reconhece.
80
+
81
+ ### Documentation
82
+
83
+ - README reduzido ao essencial (operacoes, instalacao, exemplo de 60 segundos).
84
+ A documentacao completa foi para `docs/`, dividida em tutorial, guias,
85
+ referencia e conceitos. `ENGLISH.md` virou `README.en.md`, um resumo em ingles.
86
+ - Testes verificam, em todo Markdown, os payloads de exemplo contra o XSD, os
87
+ nomes importados do pacote e os links relativos e ancoras. O CI tambem faz a
88
+ checagem de tipos dos exemplos (`npm run typecheck:examples`).
89
+ - Links absolutos de maquina local em `docs/REGRAS_NEGOCIO_EMISSAO.md` viraram
90
+ links relativos.
91
+
92
+ ## [3.1.0] - 2026-11-12
93
+
94
+ ### Added
95
+
96
+ - `NfseCertificate`: certificado A1 opaco para assinatura e mTLS. Carrega de
97
+ `.pfx` (`fromFile`, `fromPfx`, `fromBase64`), de PEM (`fromPem`) ou de
98
+ variaveis de ambiente (`fromEnv`: `NFSE_CERT_PATH` ou `NFSE_CERT_BASE64`,
99
+ com `NFSE_CERT_PASSWORD` ou `NFSE_CERT_PASSWORD_FILE`). Expoe apenas
100
+ metadados (CNPJ/CPF ICP-Brasil, validade, emissor, fingerprint SHA-256);
101
+ a chave privada fica em um `KeyObject` fora do objeto, e a senha e os bytes
102
+ do PFX nao sao retidos. `console.log` e `JSON.stringify` nunca mostram a chave.
103
+ - Agente mTLS dedicado por certificado: conexoes reaproveitadas nunca sao
104
+ compartilhadas entre certificados (multi-tenant).
105
+ - Novos codigos de `CertificateValidationError`: `CERTIFICATE_INVALID_PASSWORD`,
106
+ `CERTIFICATE_UNREADABLE`, `CERTIFICATE_MISSING`, `CERTIFICATE_PASSWORD_MISSING`.
107
+ - `ChaveAcessoInvalidaError`: `consultarNfse` e `enviarEvento` rejeitam chaves
108
+ que nao tenham 50 digitos antes de qualquer chamada de rede.
109
+ - `XsdEngineUnavailableError` para falhas de infraestrutura do motor XSD.
110
+ - Subpath `@useinvio/nfse-sdk/agent` com ferramentas neutras de framework
111
+ (`validate_dps`, `build_dps_xml`, `get_nfse`) e `toAgentIssues(error)`.
112
+ - `DPS_JSON_REQUEST_SCHEMA` (JSON Schema 2020-12 do `DpsJsonRequest`).
113
+
114
+ ### Changed
115
+
116
+ - A validacao XSD e a checagem de XML bem formado rodam no proprio processo
117
+ com libxml2 em WebAssembly (`libxml2-wasm`). O binario `xmllint` deixa de ser
118
+ necessario, e o schema oficial e compilado uma vez por processo.
119
+ - `assertCertificateForProvider` le o CNPJ/CPF dos campos ICP-Brasil
120
+ (otherName 2.16.76.1.3.3 / 2.16.76.1.3.1) ou do sufixo `NOME:DOCUMENTO` do
121
+ CN, em vez de procurar qualquer sequencia de 11/14 digitos no certificado.
122
+ - `NfseClient` passa a carregar o PFX informado em `certificate.content` como
123
+ `NfseCertificate`. Senha incorreta gera `CertificateValidationError` com
124
+ `CERTIFICATE_INVALID_PASSWORD`.
125
+ - Todas as funcoes que recebiam `PfxMaterial` agora aceitam
126
+ `NfseCertificate | PfxMaterial`.
127
+
128
+ ### Deprecated
129
+
130
+ - `XmllintUnavailableError`: alias de `XsdEngineUnavailableError`, mantido para
131
+ verificacoes `instanceof` existentes.
132
+ - `loadPfx` e `loadPfxFromBuffer` continuam funcionando, mas retornam a chave
133
+ privada em PEM dentro de um objeto comum. Prefira `NfseCertificate`.
134
+
135
+ ### Security
136
+
137
+ - `node-forge` atualizado para 1.4.3 e `@xmldom/xmldom` para 0.8.15, corrigindo
138
+ advisories de severidade alta (incluindo falsificacao de MAC em PKCS#12 e de
139
+ assinatura RSA PKCS#1 v1.5). `xml-crypto` atualizado para 6.4.0.
140
+ - O XML e lido sem rede, sem DTD externo e sem entidades externas.
141
+
142
+ ## [3.0.0] - 2026-10-06
143
+
144
+ Validacao de emissao endurecida, com breaking changes. Veja o guia de migracao
145
+ em [docs/CORRECOES_EMISSAO.md](docs/CORRECOES_EMISSAO.md).
146
+
147
+ ### Changed
148
+
149
+ - Campos opcionais vazios, `null` ou com tipo incorreto sao rejeitados.
150
+ - Valores de servico que arredondam para zero e valores fora dos limites do XSD
151
+ sao rejeitados antes de gerar XML.
152
+ - `tpAmb` do XML externo deve coincidir com o ambiente de transmissao.
153
+ - A vigencia do certificado e verificada antes de assinar e antes de enviar.
154
+ - HTTP 2xx sem XML autorizado e chave de 50 digitos gera `EmitirNotaError` com
155
+ `INVALID_AUTHORIZATION_RESPONSE`.
156
+
157
+ ### Added
158
+
159
+ - `assertCertificateValidity`, `GetInvoiceOptions` e
160
+ `client.invoices.get(chave, { ambiente })`.
161
+ - Avisos (`warnings`) para divergencias cambiais.
162
+
163
+ ## [2.2.0] - 2026-08-05
164
+
165
+ ## [2.1.0] - 2026-07-31
166
+
167
+ ## [2.0.0] - 2026-07-18
168
+
169
+ Versoes anteriores: veja as [releases no GitHub](https://github.com/useinvio/nfse-sdk/releases).
170
+
171
+ [3.2.0]: https://github.com/useinvio/nfse-sdk/compare/3.1.0...HEAD
172
+ [3.1.0]: https://github.com/useinvio/nfse-sdk/compare/3.0.0...3.1.0
173
+ [3.0.0]: https://github.com/useinvio/nfse-sdk/releases/tag/3.0.0
174
+ [2.2.0]: https://github.com/useinvio/nfse-sdk/releases/tag/2.2.0
175
+ [2.1.0]: https://github.com/useinvio/nfse-sdk/releases/tag/2.1.0
176
+ [2.0.0]: https://github.com/useinvio/nfse-sdk/releases/tag/2.0.0
package/README.en.md ADDED
@@ -0,0 +1,146 @@
1
+ # @useinvio/nfse-sdk
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@useinvio/nfse-sdk.svg)](https://www.npmjs.com/package/@useinvio/nfse-sdk)
4
+ [![CI](https://github.com/useinvio/nfse-sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/useinvio/nfse-sdk/actions/workflows/ci.yml)
5
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D20-339933.svg)](https://nodejs.org/)
6
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
7
+
8
+ [Website](https://sdk.useinvio.com/) · [Playground](https://useinvio.github.io/nfse-sdk/) · [Documentation (pt-BR)](./docs/README.md) · [Português](./README.md)
9
+
10
+ <img width="959" height="296" alt="NFS-e SDK" src="https://github.com/user-attachments/assets/d6c45737-e7ca-4ea7-a06f-d93b7c16e4f0" />
11
+
12
+ **Issue, query and cancel Brazil's national service invoices (NFS-e Nacional) from TypeScript, without hand-writing fiscal XML.**
13
+
14
+ You describe the invoice as JSON. The SDK builds the DPS, validates it against
15
+ the official XSD, signs it with your A1 certificate, compresses it, sends it to
16
+ SEFIN over mTLS and returns the official answer in a structured shape. No native
17
+ binaries and no `xmllint`.
18
+
19
+ ## What it does
20
+
21
+ | Operation | Function | On `NfseClient` |
22
+ |---|---|---|
23
+ | Issue from JSON or XML | `emitirNfse` | `invoices.create` |
24
+ | Validate without sending (JSON + XSD) | `validateDpsJsonRequest`, `buildDpsFromJson` | `invoices.buildDpsJson` |
25
+ | Query with a typed result | `obterNfse` | `invoices.retrieve` |
26
+ | Recover an emission after a timeout | `recuperarNfsePorDps` | `invoices.recover` |
27
+ | Cancel / cancel by substitution | `cancelarNfse`, `cancelarNfsePorSubstituicao` | `invoices.cancel`, `invoices.cancelBySubstitution` |
28
+ | Download the DANFSe PDF | `baixarDanfse` | `invoices.danfse` |
29
+ | NSU distribution and municipal parameters (ADN) | `distribuirDfePorNsu`, `consultarAliquota`… | `distribution`, `municipalParameters` |
30
+ | Explain rejections with the official text | `explicarRejeicao`, `explicarErros`, [one page per code](./docs/rejeicoes/README.md) | – |
31
+ | Command line | `npx nfse init`, `doctor`, `validate`, `emit`, `explain` | – |
32
+ | Test without a certificate or network | `@useinvio/nfse-sdk/testing` | – |
33
+ | MCP server and tools for AI agents | `npx -y @useinvio/nfse-mcp`, `@useinvio/nfse-sdk/agent` | – |
34
+
35
+ Function and field names follow the official Portuguese layout (`emitir` =
36
+ issue, `consultar` = query, `cancelar` = cancel, `chaveAcesso` = access key).
37
+
38
+ ## Install
39
+
40
+ ```bash
41
+ npm install @useinvio/nfse-sdk
42
+ ```
43
+
44
+ Node.js 20 or newer. Nothing to install on the system: XSD validation runs in WebAssembly.
45
+
46
+ ## In 60 seconds
47
+
48
+ ```bash
49
+ NFSE_CERT_PATH=./certificate.pfx
50
+ NFSE_CERT_PASSWORD=your-password
51
+ ```
52
+
53
+ ```ts
54
+ import { emitirNfse, EmitirNotaError, NfseCertificate } from '@useinvio/nfse-sdk';
55
+
56
+ const certificate = NfseCertificate.fromEnv(); // the private key never shows up in logs
57
+
58
+ const invoice = {
59
+ ambiente: 'restrita' as const, // "produção restrita": the official sandbox
60
+ prestador: {
61
+ cnpj: '12345678000195',
62
+ cLocEmi: '4106902',
63
+ serie: '1601',
64
+ opSimpNac: '1',
65
+ regEspTrib: '0',
66
+ },
67
+ servico: {
68
+ cTribNac: '010201',
69
+ xDescServ: 'Software development',
70
+ cLocPrestacao: '4106902',
71
+ cNBS: '115022000',
72
+ },
73
+ emissao: {
74
+ nDPS: '1',
75
+ dhEmi: '2026-06-15T10:30:00-03:00',
76
+ dCompet: '2026-06-01',
77
+ valores: { vServ: '1500.00' },
78
+ tributacaoMunicipal: { tribISSQN: '1', tpRetISSQN: '1' },
79
+ tributacaoFederal: { piscofins: { CST: '07' } },
80
+ totTrib: { pTotTribFed: '0.00', pTotTribEst: '0.00', pTotTribMun: '5.00' },
81
+ },
82
+ };
83
+
84
+ try {
85
+ const { chaveAcesso, nfseXml } = await emitirNfse(invoice, certificate);
86
+ console.log(chaveAcesso); // 50-digit access key
87
+ } catch (error) {
88
+ if (!(error instanceof EmitirNotaError)) throw error;
89
+ for (const rejection of error.erros) console.error(rejection.Codigo, rejection.Descricao);
90
+ }
91
+ ```
92
+
93
+ ## Key ideas
94
+
95
+ - **Certificate:** `NfseCertificate` keeps the private key out of the object,
96
+ drops the password and exposes only CNPJ/CPF, validity and fingerprint. Each
97
+ certificate gets its own mTLS agent, so tenants never share connections.
98
+ - **No blind retries:** issuing and events are POSTs and are never retried. After
99
+ a timeout, `recuperarNfsePorDps(dpsId)` asks SEFIN whether the DPS was
100
+ processed before you resend it. GETs accept `{ retries, timeoutMs, signal }`.
101
+ - **Typed errors:** `DpsFiscalValidationError` and `DpsXsdValidationError` before
102
+ sending, `EmitirNotaError` / `RegistrarEventoError` / `ConsultaNfseError` with
103
+ the official SEFIN codes after.
104
+ - **Not a tax engine:** service codes, CST, rates, withholdings and DPS numbering
105
+ stay with your application. The IBS/CBS group of the tax reform is not
106
+ supported yet.
107
+
108
+ ## Documentation
109
+
110
+ The full documentation is in Portuguese, since the official layout, field names
111
+ and rejection messages are too:
112
+
113
+ - [Tutorial: your first NFS-e](./docs/tutoriais/primeira-nfse.md)
114
+ - [Guides](./docs/README.md#guias): certificate, issuing, querying, recovery,
115
+ cancellation, errors, timeouts, ADN, AI agents
116
+ - [API reference](./docs/referencia/api.md) and [errors](./docs/referencia/erros.md)
117
+ - [JSON field mapping](./JSON_MAPPING.md)
118
+ - [`llms.txt`](./llms.txt): an English API guide for AI coding assistants
119
+ - Runnable [`examples/`](./examples)
120
+
121
+ ## With AI agents
122
+
123
+ Issue an NFS-e by talking to Claude. Test mode runs a mock SEFIN, so you can try
124
+ it without a certificate:
125
+
126
+ ```bash
127
+ claude mcp add nfse --env NFSE_MCP_MOCK=1 --env NFSE_MCP_ALLOW_WRITE=1 -- npx -y @useinvio/nfse-mcp
128
+ ```
129
+
130
+ Or install the Claude Code plugin (server plus a skill that teaches the workflow):
131
+
132
+ ```text
133
+ /plugin install nfse-nacional --marketplace useinvio/nfse-sdk
134
+ ```
135
+
136
+ Emission and cancellation always show a summary you approve before anything is
137
+ sent, and the certificate never reaches the model. See [`mcp/README.md`](./mcp/README.md).
138
+
139
+ ## Contributing
140
+
141
+ Issues and PRs are welcome. See [CONTRIBUTING.md](./CONTRIBUTING.md) and the
142
+ [CHANGELOG](./CHANGELOG.md).
143
+
144
+ ## License
145
+
146
+ [MIT](./LICENSE) © Invio