DEV Community

cendyandreoli
cendyandreoli

Posted on AI-assisted

Issue Brazilian invoices from Claude with an MCP server (and a human approval step)

Brazilian service invoices (NFS-e) are issued per city or through a national system, and every field is checked by tax authorities. SendNF exposes this as an API and as an MCP server, so an AI agent can look up a company by CNPJ, preview an invoice and issue it.

What you need

  • An API key. Keys that start with nt_test_ are sandbox keys (no tax value). nt_live_ keys issue real invoices.
  • An MCP client such as Claude or Cursor.

Configure

{
  "mcpServers": {
    "sendnf": {
      "type": "http",
      "url": "https://api.sendnf.com/mcp",
      "headers": { "Authorization": "Bearer nt_test_YOUR_KEY" }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

The server uses Streamable HTTP, with no session. Without a key it answers 401.

What the agent can do (44 tools)

  • Read: lookup_cnpj (public data from the tax authority, and which city system applies), search_service_codes (national service list, LC 116, with NBS), check_readiness (what is still missing for a company), validate_dps (checks a DPS XML against the official layout; it does not guarantee acceptance by the city).
  • Preview without sending: preview_nfse, preview_nfce, preview_nfe.
  • Issue: issue_nfse, issue_nfce, issue_nfe, and cancel_document.

The human approval step
By default, any key used through MCP requires approval. create_note_draft builds the invoice, validates it and leaves it as pending_approval with a PDF preview. Nothing goes to the tax authority until a person approves in the dashboard or through the approver link. Approval expires in 7 days, and the audit log records who approved, when and from which IP.

Limits
The repository https://github.com/sendnf/sendnf-mcp has the manifest, examples and tool list; the product code is private. SendNF issues NFS-e, NFC-e and NF-e (model 55) for MEI and Simples Nacional; it does not issue CT-e or MDF-e. Docs: https://sendnf.com/mcp/ . Plans and prices: https://sendnf.com/precos/ .

Top comments (1)

Collapse
 
freedailypro profile image
FreeDailyPro •

I like separating preview from the final issue step. I would bind approval to a hash of the normalized invoice payload, including recipient, totals and tax fields, so any edit after review requires new approval. An idempotency key on issue would also make a timeout retry safer from duplicate invoices.