mcpField
M
mcp-focus-nfe

mcp-focus-nfe

Local
github.com/codesparFinance275Updated 4w ago

About mcp-focus-nfe

mcp-focus-nfe is an MCP server for the Focus NFe service, used to emit, look up and cancel Brazilian electronic fiscal documents such as NFe, NFSe and NFCe. It suits agents and developers handling invoicing in Brazil. A homologation sandbox is available for testing.

Key features

  1. 01Emit NFe, NFSe and NFCe fiscal documents
  2. 02Retrieve document details and status
  3. 03Cancel authorized fiscal documents
  4. 04Get DANFE PDF download links for NFe
  5. 05Send correction letters (CCe) for NFe
  6. 06Register, list and delete webhooks

Use cases

  1. 01Have an agent issue NFe from sales records
  2. 02Check NFSe status and cancel when needed
  3. 03Receive fiscal document events through webhooks

MCP support

This project is an MCP server that exposes 19 tools to MCP clients, covering emission, lookup, cancellation and webhook management for Brazilian fiscal documents.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"codespar-mcp-focus-nfe": {
"command": "npx",
"args": [
"-y",
"@codespar/mcp-focus-nfe"
],
"env": {
"FOCUS_NFE_TOKEN": "<FOCUS_NFE_TOKEN>"
}
}
}
}
Run commandnpx -y @codespar/mcp-focus-nfe
Environment variables to set
FOCUS_NFE_TOKENSecretAPI key for focus-nfe

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@codespar/mcp-focus-nfe0.2.2

Tools

19

Saved tool list · updated 2w ago

ParameterTypeRequiredDescription
refstringYesUnique reference ID for this NFe
itemsarrayYesNFe items
cnpj_emitentestringYesEmitter CNPJ
tipo_documentonumberYesDocument type (0=entrada, 1=saida)
forma_pagamentostringNoPayment form code
cpf_destinatariostringNoRecipient CPF
cnpj_destinatariostringNoRecipient CNPJ
natureza_operacaostringYesOperation nature (e.g. 'Venda de mercadoria')
nome_destinatariostringNoRecipient name

Details

From the project README

@codespar/mcp-focus-nfe

MCP server for Focus NFe — NFe, NFSe, and NFCe fiscal document emission

npm License: MIT

Quick Start

Claude Desktop

Add to ~/.config/claude/claude_desktop_config.json:

{
  "mcpServers": {
    "focus-nfe": {
      "command": "npx",
      "args": ["-y", "@codespar/mcp-focus-nfe"],
      "env": {
        "FOCUS_NFE_TOKEN": "your-token",
        "FOCUS_NFE_SANDBOX": "true"
      }
    }
  }
}
Claude Code
claude mcp add focus-nfe -- npx @codespar/mcp-focus-nfe
Cursor / VS Code

Add to .cursor/mcp.json or .vscode/mcp.json:

{
  "servers": {
    "focus-nfe": {
      "command": "npx",
      "args": ["-y", "@codespar/mcp-focus-nfe"],
      "env": {
        "FOCUS_NFE_TOKEN": "your-token",
        "FOCUS_NFE_SANDBOX": "true"
      }
    }
  }
}

Tools (19)

ToolPurpose
create_nfeCreate and emit an NFe (nota fiscal eletronica)
get_nfeGet NFe details and status by reference
cancel_nfeCancel an authorized NFe (within 24h of emission)
get_nfe_pdfGet NFe PDF (DANFE) download URL
send_correction_letterSend a correction letter (Carta de Correcao / CCe) for an authorized NFe
create_nfseCreate and emit an NFSe (nota fiscal de servico)
get_nfseGet NFSe details and status by reference
cancel_nfseCancel an authorized NFSe
create_nfceCreate and emit an NFCe (nota fiscal do consumidor eletronica)
get_nfceGet NFCe details and status by reference
cancel_nfceCancel an authorized NFCe
create_cteCreate and emit a CTe (conhecimento de transporte eletronico) for cargo transport
get_cteGet CTe details and status by reference
cancel_cteCancel an authorized CTe
create_mdfeCreate and emit an MDFe (manifesto eletronico de documentos fiscais) for cargo transport manifest
close_mdfeClose/finalize an MDFe (encerramento) after trip completion
register_webhookRegister a webhook trigger (gatilho) that notifies your URL when fiscal document events occur
list_webhooksList all registered webhooks (gatilhos)
delete_webhookDelete a registered webhook by ID

Authentication

Focus NFe uses Basic Auth with the API token as username and empty password.

Sandbox / Testing

Focus NFe provides a homologation environment at homologacao.focusnfe.com.br. Set FOCUS_NFE_SANDBOX=true to use it.

Get your credentials
  1. Go to Focus NFe
  2. Create an account
  3. Get your API token from the dashboard
  4. Set the FOCUS_NFE_TOKEN environment variable

Environment Variables

VariableRequiredDescription
FOCUS_NFE_TOKENYesAPI token from Focus NFe
FOCUS_NFE_SANDBOXNoSet to "true" for homologation mode

Roadmap

v0.2 (planned)
  • create_cte — Create a CT-e (electronic transport document)
  • get_cte — Get CT-e details by ID
  • correction_letter — Issue a correction letter for an NF-e
  • manifest_recipient — Manifest recipient awareness of an NF-e
  • get_nfse_pdf — Get PDF for a service invoice (NFS-e)
v0.3 (planned)
  • batch_nfe — Create multiple NF-e in a single request
  • batch_nfse — Create multiple NFS-e in a single request

Want to contribute? Open a PR or request a tool.

Links

Enterprise

Need governance, budget limits, and audit trails for agent payments? CodeSpar Enterprise adds policy engine, payment routing, and compliance templates on top of these MCP servers.

License

MIT

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.