# Focus NFe MCP

> Focus NFe is your connection to Brazilian fiscal documentation management. It lets your AI agent handle the entire invoice lifecycle for both services (NFS-e) and products (NF-e). You can issue new invoices, check their official status, cancel them with proper justifications, and download the final XML files—all through natural conversation.

## Overview
- **Category:** erp-operations
- **Price:** Free
- **Tags:** fiscal-invoicing, tax-compliance, brazil-tax, electronic-documents, accounting-automation

## Description

This MCP connects your AI client directly to Brazil's required fiscal APIs. It automates handling service invoices (NFS-e) and product invoices (NF-e), managing everything from creation to archival. You don't need to know API codes or navigate complex government portals; you just tell your agent what needs doing in plain English. For instance, instead of manually logging into a portal to check if an invoice is ready, you simply ask the agent for the status, and it retrieves the authorized details instantly. If the client requests a change, the agent can use its tools to cancel the document correctly, ensuring the right justification reason is attached. The process also handles retrieving the final XML documents needed by accounting teams. By connecting Focus NFe through Vinkius, you give your AI agent reliable access to critical tax compliance functions, making complex Brazilian fiscal workflows manageable from any chat interface.

## Tools

### consult_document
Checks and returns the current status and detailed information of any specified invoice document.

### emit_nfse
Generates and submits a Service Invoice (NFS-e) for professional services rendered.

### cancel_document
Cancels an authorized invoice and requires a specific justification reason for the record.

### download_xml
Retrieves the final, authorized XML file for a given invoice number ready for accounting systems.

### emit_nfe
Creates and issues a new Product Invoice (NF-e) with full item details required by law.

## Prompt Examples

**Prompt:** 
```
Emit a service invoice for R$500 for 'Consulting Services'.
```

**Response:** 
```
Service Invoice emitted! Reference: SERV-001. Status: Authorized.
```

**Prompt:** 
```
Cancel invoice REF-123 with reason 'Client requested cancellation'.
```

**Response:** 
```
Invoice REF-123 cancelled successfully.
```

**Prompt:** 
```
Get the XML for invoice REF-123.
```

**Response:** 
```
XML downloaded successfully. Ready for accounting integration.
```

## Capabilities

### Issue Service Invoices
The MCP issues a new service invoice (NFS-e) instantly when prompted with the required details.

### Generate Product Invoices
It creates product invoices (NF-e), handling complex details for multiple items and services in a single transaction.

### Check Document Status
You can confirm if an invoice is authorized, currently processing, or if it was cancelled at any point in time.

### Cancel Issued Invoices
The MCP cancels existing invoices and requires you to provide a specific justification reason for compliance records.

### Download XML Documents
It retrieves the authorized, final XML file necessary for accounting departments and long-term storage.

## Use Cases

### The monthly cleanup of old invoices
An accountant needs to find all outstanding documents for a client, check their status using `consult_document`, and then download the necessary XML files via `download_xml` before month-end closing. The agent handles this entire audit trail in three conversational steps.

### Client cancels an order after invoicing
A service was invoiced, but the client backed out. Instead of emailing a cancellation request and waiting for manual processing, the manager tells the agent to `cancel_document` immediately, providing the mandatory reason code.

### Launching a new product line
A SaaS developer needs to integrate compliance features. By connecting Focus NFe MCP, they can expose both `emit_nfe` and `emit_nfse` to their platform, making the billing process fully automated within their code.

### Emergency invoice generation
A small business owner just finished a consulting gig. They don't have time to navigate complex forms; they simply tell the agent to `emit_nfse`, and it generates the service invoice instantly.

## Benefits

- Handling cancellations is easy. Instead of manually finding the right form and attaching a justification, you just ask the agent to `cancel_document` with the reason in chat.
- You cut down on compliance errors by centralizing document handling. Whether it's generating an NF-e or NFS-e, your agent manages the process end-to-end using the correct tools.
- Forget logging into five different portals to check status. You ask the agent to `consult_document`, and you get a real-time, single source of truth about the invoice's lifecycle.
- The final output is always ready for accounting. With one command, you can use `download_xml` to pull the authorized file directly into your workflow.
- It handles both service and product invoicing equally well. You can ask it to `emit_nfse` or `emit_nfe`, and it knows exactly which fiscal rules apply.

## How It Works

The bottom line is you get to manage all Brazilian fiscal compliance tasks through conversational chat, without ever touching an API key or dashboard.

1. First, subscribe to this MCP and provide your Focus NFe API Token and Base URL.
2. Next, configure your AI client using those credentials within the Vinkius Marketplace.
3. Finally, start giving instructions—whether it's 'Issue a service invoice for X' or 'What is the status of Y?'—to your agent.

## Frequently Asked Questions

**Does it support both NFS-e and NF-e?**
Yes! The tools allow emitting and managing both Service Invoices (nfse) and Product Invoices (nfe) seamlessly.

**How do I get my API Token?**
Log in to the Focus NFe portal and navigate to the API section to generate your token.

**Can I download the authorized XML?**
Yes, use the `download_xml` tool with the document reference to retrieve the full XML content.

**Is it homologated for all Brazilian cities?**
Focus NFe covers thousands of cities for NFS-e emission. You can check their API documentation for the complete list of supported IBGE city codes.