brasilapi-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@brasilapi-mcp Look up CNPJ 00.000.000/0001-91 and tell me if it's active, plus its partners."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
brasilapi-mcp
An MCP server that gives AI assistants Brazilian public data through BrasilAPI: company registry lookups by CNPJ (including partners), addresses by CEP, offline CNPJ/CPF validation and national holidays.
It was built from experience with company due-diligence (KYC) workflows, where an agent has to check that a company exists, is active and who its partners are, and must not trust a number that fails its check digits. It is an independent project and is not affiliated with BrasilAPI or the Receita Federal.
Tools
Tool | What it does | Network |
| Legal name, registration status, main activity, address, size, tax regime and partners (QSA) of a company. Accepts CNPJ with or without punctuation, numeric or alphanumeric. | BrasilAPI |
| Checks format and check digits, numeric and alphanumeric CNPJ. | none |
| Checks format and check digits of a CPF. Nothing is stored or sent. | none |
| Street, neighborhood, city, state, IBGE code and coordinates for a CEP. | BrasilAPI |
| National holidays of a year, with weekdays. | BrasilAPI |
lookup_cnpj rejects a number with wrong check digits before making any request, so a typo costs nothing and never reaches the API. Partner CPFs come masked by the registry (***123456**); the server does not unmask or store anything.
Example, lookup_cnpj with include_partners: false:
{
"cnpj": "00000000000191",
"razaoSocial": "BANCO DO BRASIL SA",
"situacaoCadastral": { "descricao": "ATIVA", "desde": "2005-11-03", "motivo": "SEM MOTIVO" },
"tipo": "MATRIZ",
"naturezaJuridica": "Sociedade de Economia Mista",
"cnaePrincipal": { "codigo": 6422100, "descricao": "Bancos múltiplos, com carteira comercial" },
"endereco": { "municipio": "BRASILIA", "uf": "DF", "cep": "70040912", "...": "..." },
"totalSocios": 41
}Related MCP server: MCP Brazil Public Data
Install
Requires Node 20 or newer.
Claude Code:
claude mcp add brasilapi -- npx -y @renatoctti/brasilapi-mcpClaude Desktop, Cursor and other clients that read an mcpServers block:
{
"mcpServers": {
"brasilapi": {
"command": "npx",
"args": ["-y", "@renatoctti/brasilapi-mcp"]
}
}
}From source:
git clone https://github.com/renatoctti/brasilapi-mcp
cd brasilapi-mcp
npm install
npm run build
node dist/src/index.js # speaks MCP over stdioNotes
Data source. BrasilAPI is a free community service that aggregates public data. It has rate limits, and the server reports a 429 in plain words instead of retrying. Each request has a 10 second timeout.
Identification. BrasilAPI sits behind a firewall that refuses requests from anonymous default HTTP agents, so every request carries
User-Agent: brasilapi-mcp/<version> (+repo url).Alphanumeric CNPJ. Since 2026 the Receita Federal issues CNPJs with letters. The validator follows the published check-digit rule (the value of a character is its ASCII code minus 48). Whether a lookup finds the company depends on BrasilAPI having it.
Freshness. Registry data can be days behind the Receita Federal. Treat it as a first check, not as a certificate.
No state. The server keeps nothing between calls and writes no logs of the numbers you ask about; the only output on stderr is a start-up line.
Development
npm test # builds, then runs the unit and protocol tests (no network)
npm run smoke # starts the built server over stdio and calls every tool on the real APIThe tests cover the check-digit rules (numeric and alphanumeric CNPJ, CPF), the reshaping of each answer, the error paths (not found, rate limit, unreachable) and the server itself through an in-memory MCP client, with a fake fetch standing in for BrasilAPI.
License
MIT
Available Tools
5 toolslist_holidaysList Brazilian national holidaysARead-onlyIdempotent
National holidays of a year with their dates and weekdays, via BrasilAPI. Useful for business-day and deadline calculations.
Inputs: year (required).
lookup_cepLook up an address by CEPARead-onlyIdempotent
Street, neighborhood, city, state, IBGE city code and coordinates for a Brazilian postal code (CEP), via BrasilAPI.
Inputs: cep (required).
lookup_cnpjLook up a company by CNPJARead-onlyIdempotent
Public registry data for a Brazilian company (Receita Federal, via BrasilAPI): legal name, registration status, main activity, address, size, tax regime and partners (QSA). Accepts a CNPJ with or without punctuation, including the alphanumeric format. Partner CPFs come masked by the registry. Use it to check that a company exists and is active.
Inputs: cnpj (required), include_partners.
validate_cnpjValidate a CNPJ offlineARead-onlyIdempotent
Checks the format and the check digits of a CNPJ (numeric or alphanumeric) without any network call. A valid number is not proof that the company exists: use lookup_cnpj for that.
Inputs: cnpj (required).
validate_cpfValidate a CPF offlineARead-onlyIdempotent
Checks the format and the check digits of a CPF without any network call. The number is not stored or sent anywhere.
Inputs: cpf (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool has a clearly distinct purpose: CNPJ registry lookup, CNPJ check-digit validation, CPF validation, CEP lookup, and holiday listing. The descriptions explicitly separate lookup from validation, preventing confusion between the two CNPJ tools.
All tool names follow a consistent verb_noun pattern: lookup_cnpj, validate_cnpj, validate_cpf, lookup_cep, list_holidays. The convention is predictable and readable.
Five tools is well-scoped for a focused BrasilAPI utility server. Each tool earns its place without redundancy, and the set stays easy to navigate.
The surface covers CNPJ lookup/validation, CPF validation, CEP lookup, and holidays, but leaves out many BrasilAPI domains such as DDD, banks, FIPE, IBGE, NCM, and PIX. These are notable gaps relative to the server name and BrasilAPI's broader scope.
Maintenance
Related MCP Connectors
Brazil CNPJ, CEP, Selic/IPCA/PTAX, holidays, banks/ISPB for agents. Pay per call in USDC (x402).
Brazilian company data & sanctions screening for AI agents. Certified. Pay-per-call x402.
Company by CNPJ, CEP, holidays, area codes, banks, NCM, Selic, CDI and IPCA, and CPF and CNPJ checks
WhatsApp Business + CNPJ enrichment (71M RFB) for Brazilian AI workflows.
Related MCP Servers
- FlicenseBqualityDmaintenanceQuery a variety of data from Brasil resources seamlessly. Access information on postal codes, area codes, banks, holidays, taxes, and more through a unified interface. Enhance your AI agents and applications with rich and updated data from BrasilAPI effortlessly.67-
- AlicenseAqualityCmaintenanceEnables lookup of Brazilian public data including companies (CNPJ), postal codes (CEP), banking, economy, geography, and more through 15 tools and 2 guided prompts, powered by BrasilAPI with no API key required.15MIT
- AlicenseAqualityCmaintenanceEnables LLM clients to query public Brazilian data through tools for CEP addresses, CNPJ registrations, banks, FIPE vehicle prices, national holidays, and DDD area codes, with no API key required.8MIT
- AlicenseAqualityCmaintenanceExposes Brazilian public data — postal codes (CEP), company registrations (CNPJ), CPF/CNPJ validation, banks, national holidays, municipalities, and DDD area codes — as MCP tools and resources, backed by BrasilAPI, ViaCEP, and IBGE with caching, fallback, and rate limiting. Any MCP client such as Claude Desktop or Claude Code can query and validate this reference and registration data through natural language or programmatic calls.1MIT