# CNAE Activities MCP

> IBGE Economia — CNAE Activities provides immediate access to Brazil's official economic classification system. It maps over 1,300 specific codes across 21 sectors, 87 divisions, and 285 groups. This is the definitive resource for anyone needing accurate tax, licensing, or market research data based on Brazilian business activity.

## Overview
- **Category:** data-analytics
- **Price:** Free
- **Tags:** economic-data, cnae-codes, market-analysis, regulatory-compliance, tax-classification, brazil-economy

## Description

The CNAE system governs how every economic activity in Brazil registers. If you're dealing with compliance, tax filing, or deep market analysis, you need to know the exact classification code—there’s no guessing here. This MCP gives your agent mastery over that entire taxonomy, letting it drill down through sectors (like Agriculture or Finance) all the way to a specific subclass used on a CNPJ registration.

Instead of juggling massive government PDFs and trying to manually find the right section, you just ask for the activity. Your AI client handles the traversal across the complex structure—from the top-level sector down through divisions, groups, and classes. This level of detail is critical for accurate business modeling, whether you’re building a compliance tool or running competitive analysis. You connect everything via Vinkius, getting immediate access to this deep layer of Brazilian economic data.

## Tools

### list_secoes_cnae
Retrieves the list of all 21 top-level CNAE economic sectors (A through U).

### list_divisoes_cnae
Lists specific industries that fall under a broader economic section.

### list_classes_cnae
Lists all general business classes within a defined industry division.

### get_subclasse_cnae
Retrieves specific details for an individual CNAE subclass code.

### list_subclasses_por_classe
Lists every specific subclass option available within a given business class.

## Prompt Examples

**Prompt:** 
```
What CNAE code should I use for a software development company?
```

**Response:** 
```
💻 **Software Development — CNAE Codes**

- **6201-5/01** — Custom software development
- **6201-5/02** — Web development
- **6202-3/00** — IT consulting and support
- **6203-1/00** — Software product development

Section J → Division 62 → Group 620 → Class 6201

Most software houses use 6201-5/01 as primary code.
```

**Prompt:** 
```
What economic sectors exist under section C (Manufacturing)?
```

**Response:** 
```
🏭 **Section C — Manufacturing (24 Divisions)**

10. Food products | 11. Beverages
13. Textiles | 14. Apparel
20. Chemicals | 21. Pharmaceuticals
25. Metal products | 26. Electronics
29. Vehicles | 30. Other transport

Manufacturing is Brazil's largest section with 24 divisions covering 180+ classes.
```

**Prompt:** 
```
What is CNAE subclass 4711-3/01?
```

**Response:** 
```
🛒 **CNAE 4711-3/01**

**Comércio varejista de mercadorias em geral, com predominância de produtos alimentícios — hipermercados**

Hierarchy:
- Section G: Commerce
- Division 47: Retail trade
- Group 471: Non-specialized retail
- Class 4711-3: Food retail
- Subclass /01: Hypermarkets
```

## Capabilities

### Identify the highest-level industry sector
Finds and lists all 21 top-tier economic sectors (A through U) used for grouping business types.

### Map specific industries within a sector
Lists detailed divisions that fall under a chosen top-level economic section.

### Pinpoint granular business groups and classes
Narrows the focus by listing all potential operational groups or general classes belonging to an established industry division.

### Retrieve highly specific activity codes
Gets the final, most detailed subclass code (the 1,332 options) for precise compliance documentation.

## Use Cases

### Onboarding a new client company
A compliance officer needs to verify if a tech startup's services match an existing code. They ask their agent, which uses `list_secoes_cnae` to start in IT, then drills down through the appropriate divisions and classes until it confirms the correct subclass using `get_subclasse_cnae`.

### Comparing market segments
A market analyst wants to see how many different retail types exist under 'Commerce.' They prompt their agent, which executes `list_divisoes_cnae` and then uses `list_classes_cnae` across that division to build a comprehensive comparison list.

### Validating product lines
A manufacturer is expanding its product scope. To ensure they cover all bases, their agent runs through the entire hierarchy, calling `list_subclasses_por_classe` for every relevant class to guarantee no code gaps are missed.

### Automating tax registration data prep
A developer builds a tool that accepts a general activity description. The agent uses the MCP's sequence of tools—starting with `list_secoes_cnae` and progressing downward—to output the structured, official CNAE code ready for database insertion.

## Benefits

- Stop relying on outdated industry guides. You can immediately check the required scope by calling `list_secoes_cnae` to establish the highest level of classification first.
- Avoid manual data entry errors when classifying businesses. By systematically calling tools like `list_divisoes_cnae`, your agent handles the complex parent-child relationship for you.
- Drill down from broad sectors to specific codes with confidence. The combination of `list_classes_cnae` and `list_subclasses_por_classe` ensures you get to the precise 1,332 subclass level needed for compliance.
- Validate business inputs in real time. If a client submits an activity code, your agent can use `get_subclasse_cnae` to verify its existence and context against the official taxonomy.
- Build better internal tools. Instead of hard-coding classification logic, you integrate this MCP, allowing your application to dynamically navigate the entire CNAE structure.

## How It Works

The bottom line is that it turns a multi-step, manual government lookup process into a single, structured conversation with your agent.

1. First, you ask your agent to list all major economic sections using `list_secoes_cnae` to set the general scope.
2. Next, based on a selected section, you call `list_divisoes_cnae` to narrow down the industry focus (e.g., from 'Commerce' to 'Retail Trade').
3. Finally, you drill down using `list_classes_cnae` or `list_subclasses_por_classe` until your agent retrieves the exact code details via `get_subclasse_cnae`.

## Frequently Asked Questions

**How do I find all possible CNAE codes for a given industry division using list_divisoes_cnae?**
To start listing divisions, first call `list_secoes_cnae` to pick the relevant top section. Then use `list_divisoes_cnae` with that selected section ID to pull all available industries within it.

**What is the best way to find a subclass code for tax compliance?**
The most reliable method is sequential traversal. Start by calling `list_secoes_cnae`, then move down through divisions, classes (using `list_classes_cnae`), and finally request subclasses using `list_subclasses_por_classe` or `get_subclasse_cnae`.

**Do I need to use list_secoes_cnae before calling any other tool?**
Yes, generally. The CNAE structure is hierarchical. Starting with `list_secoes_cnae` establishes the highest-level context, which helps your agent correctly inform subsequent calls like `list_divisoes_cnae`.

**Can I use get_subclasse_cnae to validate a code?**
Absolutely. Calling `get_subclasse_cnae` is the final step in validation. It confirms that a specific, precise subclass code exists within the entire system and provides its full context.

**If I provide an invalid division code when calling list_classes_cnae, how should my agent handle the error?**
The MCP returns a specific API error detailing the bad input. Your AI client catches this failure and provides a clear message like 'Invalid Division Code.' You can build explicit logic to prompt the user for corrected data.

**I need to list every single subclass code across all groups; how do I prevent hitting rate limits when running many calls to list_subclasses_por_classe?**
We recommend batch processing or iterating through classes in chunks. The underlying system supports pagination, so your agent only needs to track the continuation token rather than making repeated requests.

**Does running list_secoes_cnae guarantee that I am retrieving the most current CNAE structure available for compliance?**
Since this MCP pulls data directly from IBGE's official source, it maintains high authority. However, regulatory bodies occasionally update codes, so always verify major changes against the original IBGE documentation.

**What specific format must my input take when calling get_subclasse_cnae to ensure I retrieve the correct details?**
The tool requires a complete and valid code string formatted as 'XXXX-X/XX.' Providing just the class or group level will result in an invalid response; you need the full subclass identifier.

**Why do I need CNAE codes?**
**CNAE is mandatory** for every business operating in Brazil. It determines your tax regime (Simples Nacional, Lucro Presumido), eligible activities for MEI registration, CNPJ registration, municipal licensing, and regulatory compliance.