# CNPJ Validator MCP for AI Agents AI Agent Connect

> CNPJ Validator verifies the mathematical validity and structure of Brazilian business identification numbers. It checks checksums, breaks down IDs into roots and branches, and infers the registration state without needing external database lookups.

## Overview
- **Category:** finance
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_h5b23zF0Z9FsG4JVtouuZu9rJr0WPyPK7WWuZJWt/ai-agent-connect
- **Tags:** cnpj, brazil, validation, business, checksum

## Description

You can have your AI agent handle the heavy lifting of cleaning up Brazilian business data. Instead of manually checking if a CNPJ is real or just a random string of numbers, you can let your agent run these through a specialized validation engine. This is a huge win when you're importing large datasets and need to spot the junk immediately before it messes up your database. You can see the breakdown of the ID, like the root and branch numbers, or process a whole list of identifiers at once to keep your records organized. Since it uses internal regional mapping, it's fast and doesn't rely on a slow government API, which means you won't deal with rate limits or downtime. This is a core part of how I use Vinkius to keep my data pipelines clean and accurate. It turns a tedious, manual compliance task into a background process that happens in seconds. Whether you're auditing a list of vendors or cleaning up a legacy CRM, you get a reliable way to verify that every business ID follows the correct mathematical rules. It handles the heavy lifting so you can focus on the actual analysis of the data rather than the tedious task of data entry and verification.

## Tools

### analyze_cnpj_structure
Deconstructs a CNPJ into its constituent parts. It shows you exactly how the ID is built, including the root, branch, and check digits.

### batch_validate_cnpjs
Validates a large list of CNPJs at once. Use this to clean up massive CSV files or databases quickly to remove invalid entries.

### validate_cnpj_format
Checks if a specific CNPJ string is mathematically valid. It uses a checksum algorithm to catch typos or fake numbers immediately.

## Prompt Examples

**Prompt:** 
```
Is CNPJ 12.345.678/0001-95 valid?
```

**Response:** 
```
Yes, the CNPJ **12.345.678/0001-95** is mathematically valid.
```

**Prompt:** 
```
Break down CNPJ 00.000.000/0001-91.
```

**Response:** 
```
Here is the breakdown for **00.000.000/0001-91**:

*   **Root Identifier:** 00000000
*   **Branch Identifier:** 0001
*   **Check Digits:** 91
*   **Inferred State:** Based on internal regional mapping rules.
```

**Prompt:** 
```
Check these: ['12345678000195', '00000000000191']
```

**Response:** 
```
I have processed the list:

| ID | Status |
| :--- | :--- |
| 12345678000195 | **Valid** |
| 00000000000191 | **Valid** |

**Total processed:** 2
**Valid count:** 2
**Invalid count:** 0
```

## Capabilities

### Check checksum math
Verifies if a CNPJ string follows the correct mathematical rules.

### Deconstruct business IDs
Breaks a CNPJ down into its root, branch, and check digits.

### Batch process lists
Validates a large list of identifiers in a single operation.

### Infer registration state
Identifies the Brazilian state of registration based on regional mapping.

### Filter out junk data
Removes invalid business numbers from your datasets automatically.

## Use Cases

### Cleaning up a messy CSV of leads
Someone has a list of 5,000 Brazilian leads and needs to know which ones are real. They ask their agent to run batch_validate_cnpjs to filter out the junk.

### Real-time form validation
A user is entering a business ID into a signup form. The agent uses validate_cnpj_format to give instant feedback on whether the number is valid.

### Vendor data enrichment
An analyst needs to categorize vendors by state. The agent uses analyze_cnpj_structure to pull the registration state from the ID automatically.

### Audit of legacy CRM records
A compliance officer wants to find formatting errors in an old database. The agent checks the entire list to find IDs that fail the checksum.

## Benefits

- Stop guessing if a CNPJ is valid by using validate_cnpj_format to check the actual checksum math.
- Clean up messy lead lists faster with batch_validate_cnpjs to remove junk records in one go.
- Understand your data better by using analyze_cnpj_structure to see the branch and root identifiers.
- Save time on manual research because the Connector infers the Brazilian state of registration automatically.
- Reduce your dependency on slow external government APIs by using local checksum algorithms for high-speed validation.
- Improve data integrity across your fintech or e-commerce platform by automating the validation of every new business entry.

## How It Works

The bottom line is you get clean, verified Brazilian business data without manual entry or slow external lookups.

1. Connect the CNPJ Validator to your AI client.
2. Pass the CNPJ strings or a list of identifiers to your agent.
3. Receive a breakdown of the validity and structure for every ID.

## Frequently Asked Questions

**Can the CNPJ Validator check if a Brazilian business ID is real?**
Yes, it verifies if the number follows the correct mathematical rules and checksums. This helps you catch typos or fake numbers instantly.

**How does the CNPJ Validator handle large lists of business numbers?**
It can process a batch of identifiers at once. This is perfect for cleaning up thousands of rows in a CSV or database without doing them one by one.

**Does the CNPJ Validator tell me which Brazilian state a company is in?**
Yes, it can infer the registration state based on internal regional mapping rules. This saves you from having to look up the state manually.

**Can I use the CNPJ Validator to clean up my existing database?**
Absolutely. You can have your agent run your existing records through the validator to identify and remove any entries that are mathematically invalid.

**Is the CNPJ Validator fast enough for real-time validation?**
Yes, because it uses local algorithms instead of waiting for an external government API, it provides nearly instant results for your workflows.

**What happens if I give the CNPJ Validator a number with a typo?**
The validator will identify it as mathematically invalid. This allows your agent to flag the error for correction or remove it from your dataset.

**Does this tool require an internet connection to the Brazilian Federal Revenue?**
No. The `validate_cnpj_format` and other tools use a local checksum algorithm (weighted summation) to verify the mathematical validity of the CNPJ without making external API calls to federal databases.

**Can I validate multiple CNPJs at once?**
Yes, you can use the `batch_validate_cnpjs` tool to process an array of CNPJ strings in a single operation and receive summary statistics.

**What information is returned when analyzing a CNPJ?**
By using `analyze_cnpj_structure`, you will receive the root identifier, branch identifier, check digits, and the inferred Brazilian state (UF) based on regional mapping rules.