mcp-brasil
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
mcp-brasil
Servidor MCP para dados públicos brasileiros: CNPJ, CEP, IBGE e busca no Diário Oficial da União.
An MCP server that gives AI assistants access to Brazilian public data, with no API keys.
Other Brazilian-data MCP servers cover CNPJ, CEP and IBGE. None of them search the Diário Oficial da União (DOU), the federal official gazette where laws, procurement notices, appointments and public contracts are published. This one does. CNPJ, CEP and IBGE are here too, built to keep working when a provider is down.
Tools
Tool | What it does | Source |
| Company registration data for a CNPJ (numeric or alphanumeric, check digits verified locally) | BrasilAPI, fallback OpenCNPJ |
| Address for a postal code | BrasilAPI v2, fallback ViaCEP |
| Municipalities of a state (name + IBGE code) | IBGE localities API |
| Search DOU acts. | in.gov.br |
| Full text of one DOU act, by the | in.gov.br |
Every tool returns compact JSON with the same shape whichever provider answered, plus a source field. Missing fields are null; keys are always present. An unknown CNPJ or CEP returns {"found": false, "query": "..."}, not an error.
Examples
Real output, trimmed. Call: cnpj_lookup {"cnpj": "33000167000101"}
{
"found": true,
"cnpj": "33000167000101",
"razao_social": "PETROLEO BRASILEIRO S A PETROBRAS",
"situacao": "ATIVA",
"data_abertura": "1966-09-28",
"cnae_principal": { "codigo": "0600001", "descricao": "Extração de petróleo e gás natural" },
"natureza_juridica": "Sociedade de Economia Mista",
"endereco": { "logradouro": "REPUBLICA DO CHILE", "numero": "65", "municipio": "RIO DE JANEIRO", "uf": "RJ", "cep": "20031170" },
"socios": [{ "nome": "...", "qualificacao": "..." }],
"source": "brasilapi"
}cep_lookup {"cep": "01310-100"}
{ "found": true, "cep": "01310100", "logradouro": "Avenida Paulista", "bairro": "Bela Vista",
"cidade": "São Paulo", "uf": "SP", "ibge": "3550308", "source": "brasilapi" }ibge_municipios {"uf": "RJ"}
{ "uf": "RJ", "total": 92, "municipios": [ { "codigo": "3300100", "nome": "Angra dos Reis" }, { "codigo": "3300159", "nome": "Aperibé" } ] }dou_search {"query": "licitação", "period": "semana"} (first of 20 results)
{
"query": "licitação", "section": "todos", "period": "semana", "total": 3527,
"results": [{
"title": "PORTARIA MRE Nº 707, DE 18 DE NOVEMBRO DE 2026",
"date": "19/11/2026", "section": "DO1_EXTRA_C", "edition": "218-C", "page": "39", "type": "Portaria",
"organ": "Ministério das Relações Exteriores/Gabinete do Ministro",
"excerpt": "... A possibilidade de prorrogação deve estar prevista no ato convocatório de licitação ...",
"slug": "portaria-mre-n-707-de-18-de-novembro-de-2026-745538851",
"url": "https://www.in.gov.br/web/dou/-/portaria-mre-n-707-de-18-de-novembro-de-2026-745538851"
}]
}dou_article {"slug": "portaria-mre-n-707-de-18-de-novembro-de-2026-745538851"}
{
"slug": "portaria-mre-n-707-de-18-de-novembro-de-2026-745538851",
"url": "https://www.in.gov.br/web/dou/-/portaria-mre-n-707-de-18-de-novembro-de-2026-745538851",
"title": "PORTARIA MRE Nº 707, DE 18 DE NOVEMBRO DE 2026",
"text": "PORTARIA MRE Nº 707, DE 18 DE NOVEMBRO DE 2026 Aprova o novo Regulamento Consular Brasileiro (RCB) ...",
"truncated": true
}text is capped at 20,000 characters; truncated says when that happened.
Related MCP server: MCP Brazil Public Data
Install
Requires Node.js 22 or newer.
Claude Code:
claude mcp add mcp-brasil -- npx -y @vinicius-carv/mcp-brasilClaude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"mcp-brasil": {
"command": "npx",
"args": ["-y", "@vinicius-carv/mcp-brasil"]
}
}
}From source:
git clone https://github.com/vinicius-carv/mcp-brasil && cd mcp-brasil
npm ci && npm run build
node dist/index.js # stdio server; point your MCP client at this commandRobustness
Fallback only when it makes sense. A provider is skipped on network error, timeout, HTTP 429, HTTP 5xx or invalid JSON. A 404 (or ViaCEP's
erro) means "does not exist" and returnsfound: falsewithout trying the next provider.Errors say what happened. A failed call lists every provider tried and why each failed, as a one-line tool error.
Retries: up to 2, with 500 ms x 2^n backoff;
Retry-Afteris honored up to 5 s.Throttling: requests to the same host are serialized, with a minimum interval of 250 ms (1 s for in.gov.br). No parallel fan-out.
Timeouts: 10 s (20 s for in.gov.br).
In-memory cache (max 500 entries, oldest dropped first). Errors are never cached.
Data | Cache TTL |
CNPJ | 24 h |
CEP | 7 days |
IBGE municipalities | 7 days |
DOU search | 10 min |
DOU article | 24 h |
Not found (404) | 1 h |
ViaCEP | 7 days (normal CEP TTL) |
Inputs are validated before any network call (CNPJ check digits, 8-digit CEP, the 27 UF codes, DOU enums).
DOU caveats
in.gov.br refuses connections from outside Brazil.
dou_searchanddou_articleneed a Brazilian IP; from elsewhere they fail with an error that says so. The other tools work anywhere.First page only: a search returns the first 20 results (
totalshows the full count). Narrow withperiodandsectioninstead of paging.It is scraping. in.gov.br has no public search API, so the parser reads the search page's embedded JSON and the article HTML. If the site changes, the tool fails with "DOU page format changed". Run
npm run test:liveand open an issue.
Development
npm ci
npm test # build + offline tests (recorded fixtures, no network)
npm run test:live # one real call per tool; DOU needs a Brazilian IPCI runs the offline suite on Node 22 and 24, Linux and Windows. It never runs the live tests.
Data sources and terms
Data comes from public services; check their terms before heavy use. This project sends a User-Agent identifying itself and keeps request volume low.
BrasilAPI (CNPJ, CEP)
OpenCNPJ (CNPJ fallback)
ViaCEP (CEP fallback)
Imprensa Nacional, in.gov.br (Diário Oficial da União)
Not affiliated with any of these services or with the Brazilian government.
License
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Brazilian company data & sanctions screening for AI agents. Certified. Pay-per-call x402.
Brazil CNPJ, CEP, Selic/IPCA/PTAX, holidays, banks/ISPB for agents. Pay per call in USDC (x402).
Official-source lookups on people and companies: registration status (CPF/CNPJ), Simples/MEI, SINTEG
Free lookup of 28.4M active Brazilian companies by CNPJ or name (Receita Federal open data).
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceBrazilian company-registry lookup via Receita Federal, allowing AI agents to query CNPJ data.59 npmMIT
- 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
- AlicenseAqualityBmaintenanceEnables AI assistants to query Brazilian public data through BrasilAPI, including company registry details and partners by CNPJ, addresses by CEP, and national holidays. It also performs offline CNPJ/CPF validation before any network request and does not store queried numbers.560 npmMIT