Server data from the Official MCP Registry
MCP server for Brazilian e-invoicing: NF-e and NFC-e (modelo 55/65), schema 4.00, SEFAZ.
MCP server for Brazilian e-invoicing: NF-e and NFC-e (modelo 55/65), schema 4.00, SEFAZ.
Valid MCP server (1 strong, 1 medium validity signals). 2 known CVEs in dependencies (0 critical, 1 high severity) Package registry verified. Imported from the Official MCP Registry.
4 files analyzed ยท 3 issues found
Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.
Set these up before or after installing:
Environment variable: BR_READ_ONLY
Environment variable: LOG_LEVEL
Add this to your MCP configuration file:
{
"mcpServers": {
"io-github-cmendezs-mcp-nfe-br": {
"env": {
"LOG_LEVEL": "your-log-level-here",
"BR_READ_ONLY": "your-br-read-only-here"
},
"args": [
"mcp-nfe-br"
],
"command": "uvx"
}
}
}From the project's GitHub README.
mcp-nfe-br is an MCP (Model Context Protocol) server providing tools for issuing and validating Brazilian electronic fiscal documents: NF-e (modelo 55) and NFC-e (modelo 65), per SEFAZ XML schema version 4.00. This server is part of the mcp-einvoicing-* / mcp-*-* family, built on mcp-einvoicing-core, which provides the base data model, HTTP/OAuth2 utilities, and shared MCP server infrastructure.
Current status (v0.2.0): Phase 1 of the roadmap, covering CPF/CNPJ tax-ID validation, unsigned NF-e/NFC-e XML generation, and XSD validation against the official PL_010d schema (unsigned variant). ICP-Brasil digital signing and SEFAZ webservice submission are planned for future releases. Generated documents are unsigned and are not transmitted to SEFAZ by this server. NFS-e (service invoices) and CT-e (transport documents) are later phases, out of scope for this version.
mcp-einvoicing-core (installed automatically as a dependency)uv (recommended)uv add mcp-nfe-br
pippip install mcp-nfe-br
git clone https://github.com/cmendezs/mcp-nfe-br.git
cd mcp-nfe-br
uv sync --all-extras
Add the server to your MCP client configuration. For Claude Desktop, edit claude_desktop_config.json:
{
"mcpServers": {
"nfe-br": {
"command": "uvx",
"args": ["mcp-nfe-br"]
}
}
}
For a local development installation:
{
"mcpServers": {
"nfe-br": {
"command": "uv",
"args": ["run", "mcp-nfe-br"],
"cwd": "/path/to/mcp-nfe-br"
}
}
}
| Variable | Description | Default |
|---|---|---|
BR_READ_ONLY | Set to 1 to disable SEFAZ write tools (br__submit_nfe, br__distribute_dfe). Safe mode for exploration. The SEFAZ environment (production/homologation) is selected per call via the tp_amb argument. | โ |
LOG_LEVEL | Log level: DEBUG, INFO, WARNING, ERROR | INFO |
br__validate_cpfValidates a CPF (Cadastro de Pessoas Fรญsicas), the individual taxpayer identification number, using the Receita Federal modulo 11 algorithm.
| Parameter | Type | Required | Description |
|---|---|---|---|
cpf | string | yes | CPF with or without ./- separators |
Returns a TaxIdValidationResult with valid=True and the cleaned value (11 digits) on success, or valid=False with an error message in Portuguese.
br__validate_cnpjValidates a CNPJ (Cadastro Nacional da Pessoa Jurรญdica), the business taxpayer identification number. Accepts both the traditional numeric format (14 digits) and the alphanumeric format introduced by NT 2026.004 (PL_010d), effective in homologation from 2026-06-01 and in production from 2026-07-01.
| Parameter | Type | Required | Description |
|---|---|---|---|
cnpj | string | yes | CNPJ with or without .///- separators |
Returns a TaxIdValidationResult with valid=True and the cleaned value (14 characters) on success, or valid=False with an error message in Portuguese.
โ ๏ธ [Unverified]: the check-digit algorithm for the alphanumeric CNPJ format was implemented based on secondary sources, as the primary source ("NT Conjunta DFe 2025.001") is not yet available locally. See
context-library/countries/br.mdfor details.
br__generate_nfeGenerates an unsigned NF-e/NFC-e 4.00 document (<NFe><infNFe>โฆ</infNFe></NFe>) from a BRInvoice object.
| Parameter | Type | Required | Description |
|---|---|---|---|
invoice | object | yes | BRInvoice document (modelo 55 or 65, groups ide/emit/dest/det/total/transp/pag) |
Returns {"xml": ..., "chave_acesso": ..., "warnings": [...]}. The warnings in Portuguese remind that the document is not signed (ICP-Brasil) and was not transmitted to SEFAZ. Both steps are the responsibility of a separate process.
Phase 1 coverage for per-item tax groups:
| Tax | Supported codes | Behavior |
|---|---|---|
| ICMS | CST 00 (normal regime) or CSOSN 102 (Simples Nacional) | other codes raise DocumentGenerationError |
| PIS/COFINS | CST 01/02 (rate-based) or 04-09 (non-taxed) | group omitted if pis_cst/cofins_cst are None |
| IPI | CST 00/49/50/99 (taxed) or other (non-taxed) | group omitted if ipi_cst is None |
[NEED: IBS/CBS/Imposto Seletivo โ Grupo UB/W03 (NT 2025.002-RTC) not yet modeled, see context-library/countries/br.md "Known gaps"].
br__validate_nfe_xmlValidates an NF-e/NFC-e 4.00 XML document against the official PL_010d XSD (local "unsigned" variant, see note below).
| Parameter | Type | Required | Description |
|---|---|---|---|
xml_content | string | no* | XML as a string |
xml_base64 | string | no* | Base64-encoded XML |
* Exactly one of xml_content/xml_base64 must be provided.
Returns {"valid": bool, "errors": [...], "metadata": {"schema_version": ...}}.
[Inference]: the official XSD (
nfe_v4.00.xsd/leiauteNFe_v4.00.xsd, PL_010d) requires<ds:Signature>as a mandatory child of<NFe>. Since Phase 1 generates unsigned documents, this tool validates against a local derived copy (nfe_v4.00_unsigned.xsd) where<ds:Signature>has been made optional (minOccurs="0"). Validation of signed documents (future phase) should use the official XSD without modifications.
br__build_access_keyBuilds an access key (chNFe, 44 characters) with a modulo 11 check digit, from the components cUF, dhEmi, issuer CNPJ, model, series, and document number.
| Parameter | Type | Required | Description |
|---|---|---|---|
c_uf | string | yes | IBGE state code (2 digits) |
dh_emi | string | yes | Issue date/time (ISO 8601) |
cnpj | string | yes | Issuer CNPJ (numeric or alphanumeric PL_010d) |
modelo | string | yes | 55 (NF-e) or 65 (NFC-e) |
serie | string | yes | Document series |
nnf | string | yes | Document number |
tp_emis | string | no | Issuance type (default "1") |
c_nf | string | no | Random numeric code (cNF, 8 digits); auto-generated if omitted |
Returns {"chave_acesso": ..., "cnf": ...}.
mcp-nfe-br/
โโโ src/
โ โโโ mcp_nfe_br/
โ โโโ __init__.py
โ โโโ server.py # MCP entry point and tool registration
โ โโโ models/
โ โ โโโ __init__.py
โ โ โโโ invoice.py # BRInvoice, BRInvoiceLine, NFeModelo, TipoOperacao
โ โโโ standards/
โ โ โโโ __init__.py
โ โ โโโ nfe_generator.py # NFeGenerator โ generates unsigned NF-e/NFC-e 4.00
โ โโโ validators/
โ โ โโโ __init__.py
โ โ โโโ nfe_xsd.py # NFeXSDValidator โ validates against PL_010d XSD (unsigned variant)
โ โโโ schemas/nfe/ # Bundled XSDs (official + "_unsigned" variants)
โ โโโ tools/
โ โ โโโ __init__.py
โ โ โโโ validation.py # br__validate_cpf, br__validate_cnpj
โ โ โโโ generation.py # br__generate_nfe, br__validate_nfe_xml, br__build_access_key
โ โโโ utils/
โ โโโ __init__.py
โ โโโ document_ids.py # validate_cpf, validate_cnpj
โ โโโ access_key.py # build_access_key, access_key_check_digit
โโโ tests/
โ โโโ conftest.py
โ โโโ fixtures/
โ โโโ test_tools/
โ โ โโโ test_validation.py
โ โ โโโ test_generation.py
โ โโโ test_standards/
โ โ โโโ test_nfe_generator.py
โ โโโ test_validators/
โ โ โโโ test_nfe_xsd.py
โ โโโ test_utils/
โ โโโ test_access_key.py
โโโ specs/nfe/ # Normative material (XSDs, MOC, Technical Notes, not published)
โโโ audit/
โ โโโ audit_vs_core.py
โ โโโ report.json
โโโ .github/workflows/publish.yml
โโโ pyproject.toml
โโโ RELEASE.md
โโโ LICENSE
mcp-einvoicing-coremcp-einvoicing-core provides:
InvoiceDocument, InvoiceLineItem, TaxIdValidationResult)EInvoicingMCPServer)mcp-nfe-br adds Brazil-specific logic:
BRInvoice (extends InvoiceDocument, as NF-e/NFC-e has no EN 16931 lineage)BRInvoiceLineContributions are welcome. Please open an issue to discuss significant changes before submitting a pull request.
git clone https://github.com/cmendezs/mcp-nfe-br.git
cd mcp-nfe-br
uv sync --all-extras
uv run pytest
uv run ruff check src/mcp_nfe_br tests audit
uv run mypy src/mcp_nfe_br
| Country | Server |
|---|---|
| ๐ Global | mcp-einvoicing-core |
| ๐ง๐ช Belgium | mcp-einvoicing-be |
| ๐ง๐ท Brazil | mcp-nfe-br |
| ๐ซ๐ท France | mcp-facture-electronique-fr |
| ๐ฉ๐ช Germany | mcp-einvoicing-de |
| ๐ฎ๐น Italy | mcp-fattura-elettronica-it |
| ๐ต๐ฑ Poland | mcp-ksef-pl |
| ๐ช๐ธ Spain | mcp-facturacion-electronica-es |
This project is licensed under Apache 2.0. See LICENSE for details.
See RELEASE.md for the full version history.
Be the first to review this server!
by Modelcontextprotocol ยท Developer Tools
Read, search, and manipulate Git repositories programmatically
by Modelcontextprotocol ยท Developer Tools
Web content fetching and conversion for efficient LLM usage
by Toleno ยท Developer Tools
Toleno Network MCP Server โ Manage your Toleno mining account with Claude AI using natural language.