Skip to main content
Glama
PHIAI-IO

mcp-empresas-brasil

by PHIAI-IO

mcp-empresas-brasil

Servidor MCP do cadastro de empresas do Brasil (Receita Federal, dados abertos do CNPJ) — com as armadilhas do dump oficial declaradas na resposta.

Quatro tools que não mentem, em vez de quarenta que não sabem.


O problema que este servidor resolve

O dump mensal do CNPJ é a melhor fotografia pública das empresas do país — e é fácil tirar dele um número errado sem perceber:

O código de município da Receita não é o do IBGE. Canoas/RS é 8589 no dump e 4304606 no IBGE. E a tabela de municípios da Receita nem traz a UF — só código e nome sem acento. Qualquer cruzamento direto com IBGE, DATASUS ou CNES volta vazio, sem erro.

E não é o único: contar só pelo CNAE principal subestima o setor (muita empresa registra a atividade de interesse como secundária); "ATIVA" não é "operando"; e cada filial é um estabelecimento, então uma rede de 20 lojas vira 20.

Este servidor guarda só o recorte de CNAEs que você pede, converte o município para IBGE no build (e lista o que não casou), e devolve cada contagem com os caveats que se aplicam.

Related MCP server: cnpj-br

A garantia

Toda resposta segue o phi-data-contract v0.1: data + provenance (mês do dump, recorte, data de construção) + caveats (com evidência e data de verificação) + cannot_answer (o que a pergunta pediu e o cadastro não responde — por exemplo, número de profissionais ou faturamento).

Privacidade

Guardados: CNPJ, nome fantasia, atividade, situação, data de abertura, bairro, CEP, município, porte, capital social, natureza jurídica e razão social apenas de pessoa jurídica. A razão social não é guardada quando a natureza é de pessoa física — empresário individual/MEI (213-5), EIRELI (230-5, 231-3), sociedade unipessoal de advocacia (232-1) e naturezas 4xxx —, porque ali ela é o nome de uma pessoa. E-mail, telefone e sócios nunca são lidos.

Instalação

Requer Node ≥ 22.5.

npm install && npm run build
npm run db:build -- --preset odontologia                    # último mês publicado (~4 GB baixados, ~20 min)
npm run db:build -- --cnaes 4645103,8630504 --mes 2026-09   # recorte próprio
npm run db:build -- --preset odontologia --partes 1         # teste rápido: 1 de 10 arquivos

Cada zip é baixado para um temporário, lido em stream e apagado. Nada é redistribuído.

{ "mcpServers": { "empresas": { "command": "node", "args": ["--experimental-sqlite", "/caminho/mcp-empresas-brasil/dist/index.js"] } } }

As tools

Tool

O que faz

empresas_contagem

Estabelecimentos (ou empresas = CNPJ básico) por município IBGE, UF, CNAE, grupo, porte ou situação. Diz quantos entraram pelo CNAE principal.

empresas_listar

Estabelecimentos de um município ou UF no recorte, ordenados por capital social.

empresas_cnpj

Um estabelecimento do recorte pelo CNPJ.

empresas_data_caveats

As armadilhas + o relatório do build (mês, recorte, municípios que não casaram).

O preset odontologia cobre a cadeia dental: atacado odontológico e médico-hospitalar, máquinas odonto-médicas, representantes comerciais odonto-médico-hospitalares, varejo de artigos médicos, atividade odontológica, prótese dentária e fabricação de materiais — agrupados em distribuicao, representacao, varejo, clinica, laboratorio, industria.

Os caveats

id

Severidade

Corrigido?

municipio_receita_nao_e_ibge

crítico

✅ convertido no build (nome + UF), não casados listados

cnae_secundario_subconta

crítico

✅ padrão "principal ou secundário", com a origem de cada linha

pessoa_fisica_fora_do_cnpj

crítico

❌ impossível — o dado não está no CNPJ; declarado em cannot_answer

ativa_nao_e_operando

aviso

❌ exige outra fonte

estabelecimento_nao_e_empresa

aviso

✅ contar: "empresas"

recorte_fixo_no_build

info

—

npm test

Fonte: Receita Federal do Brasil — Dados Abertos do CNPJ (compartilhamento público em arquivos.receitafederal.gov.br, acesso WebDAV). Conversão de município: IBGE Localidades.

MIT · Autor: Luis Delfin · parte da rede de servidores MCP de dados públicos de Phi AI


English

MCP server for Brazil's company registry (Federal Revenue open CNPJ data) — with the official dump's traps declared in the response.

The Revenue municipality code is not the IBGE code (Canoas/RS = 8589 in the dump, 4304606 at IBGE), and the Revenue municipality table has no state. Direct joins with IBGE, DATASUS or CNES return empty, silently. Counting by main activity code only undercounts; "active" is not "operating"; each branch is a separate establishment.

This server keeps only the CNAE cut you request, converts municipalities to IBGE at build time (listing what didn't match), and returns every count with the caveats that apply — phi-data-contract v0.1. Company name is stored only for legal entities (never for sole traders / micro-entrepreneurs, where it is a person's name); e-mail, phone and partners are never read.

Requires Node ≥ 22.5 · npm run db:build -- --preset odontologia · no data is redistributed.

MIT · Author: Luis Delfin

Available Tools

4 tools
empresas_cnpjB

Um estabelecimento do recorte pelo CNPJ de 14 dígitos: situação, atividade, município IBGE, porte, capital.

ParametersJSON Schema
NameRequiredDescriptionDefault
cnpjYes

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description must disclose behavior, but it only describes the resource. It does not state that this is a read-only lookup, what occurs if the CNPJ is not found, whether multiple records could be returned, or any access constraints. The singular 'Um estabelecimento' implies one record, but this is implicit.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence with no filler. The scoping by CNPJ is front-loaded, and the field enumeration is succinct. Every word contributes to conveying the tool's core subject.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema and no annotations, the description must explain the operation and expectations. It lists some output fields but does not explicitly say this is a lookup operation, does not cover error behavior, and does not situate the tool relative to its siblings. An agent would remain uncertain about the return envelope and failure modes.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema only defines 'cnpj' as a string with no description. The description adds crucial semantics by specifying the CNPJ must be 14 digits and that it is the selection key for the establishment. This helps the agent construct a valid request, though it does not detail validation rules.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description identifies the tool as providing an establishment for a given 14-digit CNPJ and lists the included fields (situação, atividade, município IBGE, porte, capital). This distinguishes it from the sibling tools, which handle counting, listing, and data caveats. The lack of an explicit verb like 'retrieve' or 'get' prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is given about when to use this tool versus the siblings. There is no mention of selecting this tool when you have a specific CNPJ and need establishment details, nor any exclusion of alternatives. The agent must infer the usage context from the resource-focused description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

empresas_contagemA

Contagem de estabelecimentos (ou empresas) por município, UF, CNAE, grupo, porte ou situação, a partir do dump oficial da Receita. O município já vem convertido para IBGE (o código da Receita é outro). A resposta diz quantos entraram pelo CNAE principal.

ParametersJSON Schema
NameRequiredDescriptionDefault
ufNoSigla da UF.
baseNoDefault: principal_ou_secundario.
cnaesNoCNAEs (7 dígitos) dentro do recorte do build.
grupoNoGrupo do preset (odontologia: distribuicao, representacao, varejo, clinica, laboratorio, industria).
limitNo
contarNoempresas = CNPJ básico (grupo econômico). Default: estabelecimentos.
situacaoNoDefault: ativa.
municipiosNoCódigos IBGE de 7 dígitos ou DATASUS de 6.
agrupar_porNoDefault: ['grupo'].

TDQS

A3.8/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the behavioral burden. It discloses a non-obvious transformation ('município já vem convertido para IBGE') and clarifies that the count reflects entries by CNAE principal, which prevents misinterpretation of the result. It does not cover output format or data freshness, but the key behaviors are surfaced.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two dense sentences with no filler. The main capability and dimensions are front-loaded, and the caveats are placed immediately after, making the description efficient and scannable.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 9 parameters, no output schema, and no annotations, the description should do more to explain the response shape and when to use this tool. It provides two important caveats but omits result format, pagination/limit behavior, and explicit routing among the sibling tools, leaving the agent with incomplete context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 89%, so the schema already documents most parameters. The description adds meaningful parameter-related semantics: it warns that Receita municipality codes differ from IBGE codes and clarifies that the count is based on the principal CNAE, which is not fully captured in the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Contagem') and resource ('estabelecimentos (ou empresas)') and lists the grouping dimensions: município, UF, CNAE, grupo, porte, situação. It does not explicitly contrast with sibling tools like empresas_listar, but the counting verb clearly differentiates it from listing or single-CNPJ tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies use when aggregate counts are needed and specifies the data source (official Receita dump), but it does not explicitly say when to prefer this over empresas_listar, empresas_cnpj, or how to handle caveats via empresas_data_caveats. Usage context is implied rather than stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

empresas_data_caveatsC

As armadilhas do dump do CNPJ, com evidência, e o relatório do build (mês, recorte, municípios que não casaram com o IBGE).

ParametersJSON Schema
NameRequiredDescriptionDefault
idNo

TDQS

C2.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It describes the content (caveats, evidence, build report) but not behavior such as return format, whether the optional id filters results, side effects, or read-only status.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single compact sentence with no filler. It front-loads the main subject ('armadilhas do dump do CNPJ') and adds meaningful detail about evidence and the build report.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with an undocumented parameter and no output schema, the description is not complete enough. It gives content context but omits how the optional id is usedSuccessful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has a single optional id parameter with 0% schema description coverage. The description does not mention the parameter at all, leaving the agent to guess what id refers to and how it affects the returned caveats or build report.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly identifies the tool's content: CNPJ dump pitfalls with evidence and the build report, including month, cut, and unmatched municipalities. This distinguishes it from the sibling listing/counting tools, though it uses a noun phrase rather than an explicit verb like 'returns' or 'shows'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no explicit guidance on when to use this tool versus the siblings (empresas_contagem, empresas_listar, empresas_cnpj). The reader must infer that this tool is for data quality caveats, but no usage context or exclusions are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

empresas_listarA

Lista os estabelecimentos de um município ou UF no recorte (CNPJ, nome fantasia, atividade, bairro, CEP, porte, capital), ordenados por capital social. Razão social só de pessoa jurídica; sem e-mail, telefone ou sócios.

ParametersJSON Schema
NameRequiredDescriptionDefault
ufNoSigla da UF.
baseNoDefault: principal_ou_secundario.
cnaesNoCNAEs (7 dígitos) dentro do recorte do build.
grupoNoGrupo do preset (odontologia: distribuicao, representacao, varejo, clinica, laboratorio, industria).
limitNo
situacaoNoDefault: ativa.
municipioNoCódigo IBGE de 7 ou 6 dígitos.
municipiosNoCódigos IBGE de 7 dígitos ou DATASUS de 6.

TDQS

A3.7/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Não há annotations, então a descrição carrega o ônus da transparência. Ela revela os campos do retorno, a ordenação por capital social e restrições de dados (razão social apenas para PJ, ausência de contatos/sócios). Faltam detalhes como paginação e formato exato da resposta, mas para um listador a transparência é boa.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Duas frases objetivas, começando pela ação principal e pelo escopo. Não há repetição do schema nem conteúdo supérfluo; cada oração agrega informação sobre o que é listado, a ordenação e as limitações do resultado.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

A ferramenta tem 8 parâmetros, nenhum obrigatório, sem output schema e sem annotations, o que aumenta a necessidade de contexto. A descrição cobre bem campos, ordenação e limitações, mas não detalha combinações de filtros, comportamento sem filtros geográficos ou formato da resposta.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Com 88% de cobertura no schema, os parâmetros já estão bem documentados estruturalmente. A descrição acrescenta contexto sobre o recorte e a ordenação, mas não explica a relação entre uf, municipio e municipios nem se algum filtro geográfico é esperado/obrigatório.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

A descrição usa verbo específico ('Lista') e recurso claro (estabelecimentos por município/UF), além de informar ordenação e campos retornados. Não nomeia as ferramentas irmãs explicitamente, mas o escopo e o verbo já diferenciam bem de empresas_contagem, empresas_cnpj e empresas_data_caveats.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Há contexto implícito de uso: a ferramenta serve para listar estabelecimentos filtrados por município ou UF, e a descrição informa limitações relevantes (sem e-mail, telefone ou sócios). Porém, não há orientação explícita sobre quando preferir as alternativas nem sobre exclusões ou pré-requisitos.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv0.1.0
    • First observedempresas_cnpj
    • First observedempresas_contagem
    • First observedempresas_data_caveats
    • First observedempresas_listar

TDQS

B3.4/5.0

Scored across 4 tools

Disambiguation5/5

Each tool has a distinct purpose: aggregate counting, listing establishments, looking up a single CNPJ, and explaining data caveats. There is no meaningful overlap or ambiguity between them.

Naming Consistency4/5

All tool names share the consistent 'empresas_' prefix and use clear Portuguese terms, but they mix noun forms (contagem, cnpj, data_caveats) with a verb form (listar). The pattern is still predictable and readable.

Tool Count4/5

Four tools is a lean but reasonable set for a read-only CNPJ data query server. Each tool covers a core operation, though the set is slightly minimal.

Completeness3/5

Core read operations are present: count, list, and single-record lookup, plus metadata caveats. However, there is no way to list establishments filtered by CNAE even though counts can be broken down by CNAE, and there is no search-by-name or discovery of available recorte slices.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    MCP server for querying Brazilian CNPJ company data, including partner graphs, address/contact joins, CNAE statistics, and national/annual overviews.
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Brazilian company-registry lookup via Receita Federal, allowing AI agents to query CNPJ data.
    4 npm
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Provides Brazilian company basic registration data (legal name, status, legal nature) from CNPJ through a single read-only MCP tool, hosted with pay-per-use credits.
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Provides a single read-only tool to fetch extended Brazilian company registration data from a CNPJ number, including basic details. Works over HTTP MCP with any client.
    MIT