FOX NF-e: Brazil's First MCP-Enabled Fiscal API — 24 Tools, 5,571 Municipalities

posted 3 min read

Introduction

Brazil has 5,571 municipalities — and until recently, no single API covered all of them for tax invoice emission. Every city, every state, a different system, a different schema, a different authority. Fiscal automation was either limited or wildly expensive.

We built FOX NF-e to fix that. It is the only Brazilian fiscal API with native MCP Server support, enabling AI agents to emit real, authorized tax invoices programmatically — across every document type, every municipality, in a single unified API.


The Problem

The Brazilian tax system is genuinely complex. There are three main invoice types: NF-e (model 55, goods), NFC-e (model 65, consumer retail), and NFSe (services) — each governed by different authorities. NF-e and NFC-e go through SEFAZ (state tax authorities). NFSe is managed by each of the 5,571 municipalities individually, with dozens of different software providers and schemas.

Existing solutions in the market are fragmented. Most charge per invoice emission, which kills margins at scale. None offer AI-native integration. Municipality coverage is incomplete. And compliance with LGPD (Brazil's data privacy law) is treated as an afterthought. We built FOX NF-e to be the unified, AI-ready, unlimited-emission alternative.


The Stack

  • PHP 8.3 + Laravel 11 — modular architecture, clean domain separation
  • PostgreSQL 17 with Row-Level Security (multi-tenant data isolation)
  • Redis 7.4 for caching, queues, and rate limiting
  • MCP Server — Streamable HTTP transport, JSON-RPC 2.0 protocol
  • 464 automated tests, 1,109 assertions
  • Quality score: 93.4/100 — audited by 10 specialized AI agents (FOXVERIFY)

MCP Server — The Game Changer

MCP (Model Context Protocol) is an open standard that lets AI agents interact with external tools in a structured, programmatic way. Instead of building custom integrations for every AI assistant, you expose your capabilities as MCP tools — and any MCP-compatible client can use them.

Our MCP Server implements 24 tools covering the full fiscal lifecycle: emission, cancellation, correction letters (CC-e), inutilization, tax simulation, risk scoring, LGPD compliance endpoints, and more. The server uses Streamable HTTP transport with JSON-RPC 2.0, compatible with any MCP-capable AI agent.

Here's what a real NF-e emission looks like from any MCP-compatible client:

{
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "name": "nfe_emit",
    "arguments": {
      "destinatario_cnpj": "12345678000100",
      "valor_total": 1500.00,
      "ncm": "84713012"
    }
  }
}

The response returns a fully authorized NF-e: access key, DANFE PDF link, signed XML — all in one API call. Your favorite AI assistant can now emit real Brazilian tax invoices autonomously.


5,571 Municipalities

The hardest part of NFSe is the fragmentation. We mapped every municipality in Brazil to its NFSe provider:

  • GINFES: 1,723 municipalities
  • WebISS: 1,621 municipalities
  • Betha: 786 municipalities
  • Sigiss: 556 municipalities
  • IPM: 485 municipalities
  • SimplISS: 391 municipalities
  • Others distributed across remaining systems

We implemented a dual-system approach: the legacy ABRASF 2.04 connector for existing municipal systems, plus the new National NFSe gov.br REST/JSON standard that becomes mandatory in September 2026. When the national standard goes live, we flip a flag — zero migration effort for clients.


Quality & Security

  • 93.4/100 quality score (FOXVERIFY — 10 specialized AI audit agents)
  • Infection PHP mutation testing: MSI 80%
  • LGPD Art. 18 endpoints: data export, erasure requests, automated decision transparency
  • Webhook replay attack protection (timestamp + signature validation)
  • Prometheus metrics endpoint for observability
  • Automatic contingency: EPEC + SVC-AN + SVC-RS + FS-DA (SEFAZ fallback chain)

Pricing

All plans include unlimited invoice emission — no per-invoice fees.

Plan Price
Free (30 days) R$ 0
Starter R$ 49.90/mo
Growth R$ 99.90/mo
Pro R$ 199.90/mo
Enterprise R$ 399/mo

What's Next

  • Dashboard (React 18) — full fiscal management UI
  • E-commerce integrations: Nuvemshop, Mercado Livre, Shopify, Shopee
  • CT-e, MDF-e, DC-e — transport and freight documents
  • WhatsApp emission via AI — emit invoices via chat

Author

Paulo Fox — CEO at Fox Digital. Former contractor for SpaceX (2014–2017) and Google (2019–2022). MIT AI Strategy & GenAI. Building AI-powered fiscal infrastructure for Brazil.

2 Comments

0 votes
1

More Posts

Local-First: The Browser as the Vault

Pocket Portfolioverified - Apr 20

Architecting a Local-First Hybrid RAG for Finance

Pocket Portfolioverified - Feb 25

Merancang Backend Bisnis ISP: API Pelanggan, Paket Internet, Invoice, dan Tiket Support

Masbadar - Mar 13

Tuesday Coding Tip 02 - Template with type-specific API

Jakub Neruda - Mar 10

I Replaced a Returns Portal with Five MCP Tools. Here's What Actually Happened.

Zologic - May 18
chevron_left

Related Jobs

View all jobs →

Commenters (This Week)

4 comments
3 comments
3 comments

Contribute meaningful comments to climb the leaderboard and earn badges!