# NF-e Access Key Validator MCP

> NF-e Access Key Validator checks Brazilian Electronic Invoice (NF-e) access keys for structural integrity and compliance. This MCP validates complex 44-digit tax keys, ensuring they pass mathematical checksums (Modulo 11) and adhere to current tax authority standards before your system uses them.

## Overview
- **Category:** finance
- **Price:** Free
- **Tags:** nfe, brazil, tax, invoice, validation

## Description

Dealing with Brazilian fiscal data means handling complicated keys that can't just be treated like normal strings of numbers. This MCP lets you validate those NF-e access keys, confirming they are both mathematically correct and legally compliant right out of the gate. You input a key, and it doesn't just tell you 'yes' or 'no.' It breaks down exactly what that key means—extracting crucial data points like the CNPJ number, state code, and document model. Furthermore, it checks those components against official tax authority rules. If your system needs reliable fiscal data for invoicing, this is essential. You can connect to this MCP through Vinkius, accessing these specialized tools alongside thousands of others in one place.

## Tools

### extract_key_metadata
Splits a working access key into its individual business parts like the CNPJ or State Code for inspection.

### validate_business_compliance
Checks if all components found in the key match current, allowed tax authority standards.

### verify_key_structure
Determines if an access key is valid by checking its length and running a mathematical checksum test (Modulo 11).

## Prompt Examples

**Prompt:** 
```
Is this NF-e key valid: 3523100000000000015555001000000001?
```

**Response:** 
```
The access key is structurally valid and passes the Modulo 11 checksum.
```

**Prompt:** 
```
Extract information from this key: 3523100000000000015555001000000001
```

**Response:** 
```
The extracted metadata includes State Code: 35, CNPJ: 23100000000000, Model: 55, Series: 001, Number: 000000001, and Emission Type: 1.
```

**Prompt:** 
```
Check if this key follows tax standards: 3523100000000000015555001000000001
```

**Response:** 
```
The key is compliant with all checked regulatory standards.
```

## Capabilities

### Check Key Validity
Determines if a key's length and mathematical checksum are correct using the Modulo 11 algorithm.

### Decompose Key Data
Splits a valid access key into its core components, such as CNPJ and State Code.

### Audit Tax Compliance
Verifies that the extracted data fields follow current Brazilian tax authority regulations.

## Use Cases

### Processing a Batch of Partner Invoices
A financial operations specialist receives 500 invoices from a partner. Instead of running each key manually through multiple validation scripts, they ask their agent to run the batch against this MCP. The tool first uses `verify_key_structure` on every single key. It then groups all keys that pass into two buckets: 'Compliant' and 'Needs Review,' dramatically speeding up reconciliation.

### Integrating a New Partner Feed
An integration engineer must connect the core ERP to a new supplier feed containing NF-e keys. To prevent data corruption, they use `extract_key_metadata` first. This allows them to pull out only the necessary CNPJ and State Code fields, confirming the key format before writing any data into the live system.

### Auditing Historical Data for Tax Changes
A tax compliance analyst needs to know if a set of old keys still meet current tax authority standards. They run the batch through `validate_business_compliance`. This checks the components against today's rules, flagging any historical keys that might now be considered non-compliant.

### Real-time Data Gateway Check
A payments gateway needs to quickly verify a key as soon as it arrives. They use this MCP for instant validation. If the `verify_key_structure` check fails, the payment is instantly rejected with a clear structural error code, preventing bad transactions.

## Benefits

- Prevents system failures by verifying structure. Using `verify_key_structure` immediately tells you if a key fails the Modulo 11 checksum or length check, saving runtime errors down the line.
- Extracts necessary metadata instantly. Instead of manual parsing, the `extract_key_metadata` tool pulls out the CNPJ and State Code so your agent can use them directly in subsequent actions.
- Guarantees regulatory compliance. The `validate_business_compliance` tool audits components against official tax standards, meaning you process keys that are legally sound from day one.
- Reduces manual verification steps. You no longer need multiple systems or spreadsheets to check if a key is valid; this MCP handles the full lifecycle validation in one place.
- Increases data reliability for finance teams. By ensuring every incoming NF-e key passes both structural and compliance checks, your team gets cleaner data for reporting.

## How It Works

The bottom line is you get a definitive pass/fail grade on both structural integrity and regulatory compliance for any given NF-e key.

1. Pass the NF-e access key you need to check into this MCP.
2. The tool first runs a structural validation, confirming the length and checksum using Modulo 11. If that passes, it proceeds to decompose the key's components (CNPJ, State Code).
3. Finally, it audits those extracted components against current tax authority rules, giving you a full compliance report.

## Frequently Asked Questions

**How does NF-e Access Key Validator check for structural validity?**
The MCP uses the `verify_key_structure` tool. This function checks both the required 44-digit length and runs a mathematical checksum using the Modulo 11 algorithm to ensure the key is mathematically sound.

**What information can I get from extract_key_metadata?**
The `extract_key_metadata` tool breaks down the key into its core components. You'll receive distinct fields, including the CNPJ (company tax ID), State Code, Model number, and Series.

**Does this MCP only check if the key is formatted correctly?**
No. It goes much further than format. While `verify_key_structure` checks the math, you also must use `validate_business_compliance` to ensure those components comply with actual tax authority rules.

**Can NF-e Access Key Validator handle different types of invoices?**
It focuses specifically on Brazilian Electronic Invoice (NF-e) keys. The tools are designed around the required structure and compliance framework for that specific document type in Brazil.

**Is this MCP faster than using a dedicated tax software tool?**
When integrated into an automated agent workflow, it is much faster. It lets you run validation checks against thousands of keys instantly without needing to switch between separate vendor platforms or manual interfaces.