mcp-server-brasil
This MCP server gives an AI agent validated, read-only access to Brazilian public data — addresses, company records, document validation, holidays, business days, economic indicators, municipalities and area codes.
Look up an address by CEP (
consultar_cep) — street, district, city, UF, IBGE code and coordinates.Fetch company records by CNPJ (
consultar_cnpj) — name, status, CNAE, address and size from the Receita Federal.Validate CPF/CNPJ offline (
validar_documento) — check digits for numeric or alphanumeric documents, no network call.List national holidays for a year (
feriados_nacionais) — including Carnaval, Good Friday and Corpus Christi.Count business days between two dates (
dias_uteis) — excludes weekends and national holidays.Get latest Banco Central indicators (
indicador_economico) — Selic target, Selic, CDI, IPCA, IGP-M, dollar and euro.List municipalities of a state with IBGE codes (
listar_municipios).Find state and cities for an area code (
consultar_ddd).
Provides tools for searching recent news through Google News RSS feeds and listing news items with title, outlet, date, and link. Google News links can be listed, but articles are not fetched directly from them.
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., "@mcp-server-brasil What's the address for CEP 01310-100?"
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.
mcp-server-brasil
A Model Context Protocol server that gives LLM agents reliable access to Brazilian public data: addresses by CEP, company records by CNPJ, holidays and business days, Banco Central indicators and IBGE municipalities.
🇧🇷 Servidor MCP com dados públicos do Brasil para agentes de IA: CEP, CNPJ (inclusive o alfanumérico), feriados, dias úteis, Selic/IPCA/dólar do Banco Central e municípios do IBGE.
Why
Agents keep getting Brazilian data wrong: they invent CEPs, can't count business days around Carnaval and don't know the current Selic. This server turns the official public sources into typed, validated tools, so the model asks instead of guessing.
Validates before calling the network. CPF/CNPJ check digits and CEP shape are checked locally, so a hallucinated document never becomes an HTTP request.
Ready for the alphanumeric CNPJ (IN RFB 2.229/2024, in effect since July 2026).
Structured output. Every tool returns a JSON schema'd result, with errors reported as tool errors the model can read and recover from.
A good citizen of free APIs. TTL cache, timeouts and retry with backoff for 5xx only.
stdio and Streamable HTTP transports, Docker image with healthcheck and DNS rebinding protection for public deployments.
Related MCP server: brasilapi-mcp
Tools
Tool | What it does | Source |
| Street, district, city, UF, IBGE code and coordinates | BrasilAPI |
| Company name, status, CNAE, address, size | BrasilAPI / Receita Federal |
| Offline CPF / CNPJ (numeric or alphanumeric) validation | — |
| National holidays for a year | BrasilAPI |
| Business days between two dates, minus weekends and national holidays | BrasilAPI |
| Latest values for | Banco Central (SGS) |
| Municipalities of a UF with IBGE codes | IBGE |
| UF and cities for an area code | BrasilAPI |
It also exposes the resource brasil://indicadores (indicator catalog with SGS codes) and the
prompt resumo_macro (rates, inflation and FX summary).
News and public information (--server noticias)
A second tool set, served on its own (mcp-server-brasil --server noticias, or MCP_SERVER=noticias):
Tool | What it does | Source |
| Recent news for a query: title, outlet, date, link | Google News RSS, InfoMoney |
| Latest items from an outlet's feed, optionally filtered | Agência Brasil, g1, InfoMoney, Poder360 |
| Article text (up to ~6k characters) | Direct links from an allowlist |
| IBGE news and releases (PNAD, IPCA, GDP...) | IBGE |
| Senate bills mentioning a term, newest first | Senado (dados abertos) |
| Chamber of Deputies bills mentioning a term | Câmara (dados abertos) |
ler_noticia is not a generic fetcher: it only reads https pages from a fixed list of outlets and
government sites, checks robots.txt, refuses redirects that leave the list, caps the download at
1.5 MB and returns plain text only. Google News links are listed but not read (they don't point to
the article itself); results carry legivel: true when ler_noticia can open them.
Quickstart
Claude Code
claude mcp add brasil -- uvx mcp-server-brasilClaude Desktop / Cursor / any MCP client
{
"mcpServers": {
"brasil": {
"command": "uvx",
"args": ["mcp-server-brasil"]
}
}
}Hosted (Streamable HTTP)
A public instance runs at https://mcp.vgmelo.tech/mcp:
claude mcp add --transport http brasil https://mcp.vgmelo.tech/mcpDocker
docker run --rm -p 8000:8000 -e MCP_ALLOWED_HOSTS=localhost:8000 ghcr.io/vicgamelo/mcp-server-brasil
curl localhost:8000/healthRunning it in public
HTTP mode is built to sit on the open internet behind a reverse proxy:
Protection | Default | Flag / env |
Rate limit per IP (token bucket, | 30/min, burst 10 |
|
Requests in flight ( | 16 |
|
Request body ( | 64 KB |
|
Host header allowlist (DNS rebinding) | off |
|
Proxies whose | none |
|
The client IP is the socket peer unless that peer is a trusted proxy, so a client can't pick its own
IP by sending X-Forwarded-For. /health is not rate limited. Tools only call fixed BrasilAPI, BCB
and IBGE URLs and validate their arguments before building them, so there is no way to make the
server fetch an arbitrary URL. The Docker image runs as a non-root user and works with --read-only.
Example
You: How many business days are there in November 2026, and what's the Selic rate today?
Agent →
dias_uteis(inicio="2026-11-01", fim="2026-11-30")→19, excluding Finados (11/02) and Consciência Negra (11/20) →indicador_economico(indicador="selic_meta", ultimos=1)→13.75% a.a.
Development
uv sync
uv run pytest # in-process MCP client + mocked HTTP, no network needed
uv run ruff check . && uv run mypy
uv run mcp-server-brasil --http --port 8000Tests run a real MCP Client against the server in-process, with the public APIs replaced by
httpx.MockTransport, so they cover the protocol layer, input validation, caching and retry
behavior without hitting the network.
Project layout
src/mcp_server_brasil/
├── server.py # MCP tools, resource and prompt
├── sources.py # BrasilAPI / BCB / IBGE clients with cache + retry
├── documents.py # CPF, CNPJ (alphanumeric) and CEP validation
├── business_days.py # business-day arithmetic
├── http_guard.py # rate limit, concurrency and body size for HTTP mode
└── __main__.py # CLI: stdio or Streamable HTTPRoadmap
State and municipal holidays
PIX key format validation
FIPE vehicle prices
Optional Redis cache for multi-replica deployments
License
MIT © Victor Gabriel Andrade de Melo
Available Tools
8 toolsconsultar_cepConsultar CEPCRead-onlyIdempotent
Endereço (logradouro, bairro, cidade, UF e coordenadas quando houver) de um CEP.
Inputs: cep (required). Returns: object
consultar_cnpjConsultar CNPJBRead-onlyIdempotent
Dados cadastrais públicos de uma empresa na Receita Federal a partir do CNPJ.
Inputs: cnpj (required). Returns: object
consultar_dddCidades por DDDCRead-onlyIdempotent
UF e cidades atendidas por um DDD.
Inputs: ddd (required). Returns: object
dias_uteisContar dias úteisARead-onlyIdempotent
Quantidade de dias úteis entre duas datas (inclusive), descontando fins de semana e feriados nacionais. Não considera feriados estaduais/municipais.
Inputs: fim (required), inicio (required). Returns: object
feriados_nacionaisFeriados nacionaisBRead-onlyIdempotent
Feriados nacionais de um ano (inclui Carnaval, Sexta-feira Santa e Corpus Christi).
Inputs: ano (required). Returns: result
indicador_economicoIndicador econômico (BCB)BRead-onlyIdempotent
Últimos valores de um indicador do Banco Central (SGS): selic_meta, selic, cdi, ipca, igpm, dolar ou euro.
Inputs: indicador (required), ultimos. Returns: object
listar_municipiosMunicípios por UF (IBGE)ARead-onlyIdempotent
Lista os municípios de uma UF com o código IBGE de cada um.
Inputs: uf (required). Returns: object
validar_documentoValidar CPF/CNPJARead-onlyIdempotent
Valida os dígitos verificadores de um CPF ou CNPJ (numérico ou alfanumérico), sem rede.
Inputs: documento (required). Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool targets a clearly distinct resource or operation: CEP, CNPJ, document validation, holidays, business days, economic indicators, municipalities, and DDD. The only closely related pair is feriados_nacionais and dias_uteis, but their descriptions make the boundary explicit.
All names use consistent snake_case Portuguese and are readable, but the convention is not uniformly verb-first: consultar_cep, consultar_cnpj, validar_documento, and listar_municipios use verbs while feriados_nacionais, dias_uteis, indicador_economico, and consultar_ddd include noun-style names. This is a minor deviation rather than confusion.
Eight tools is well within the ideal 3–15 range and each tool covers a distinct Brazilian data utility. None appear redundant or trivial.
The set covers core Brazilian lookup and validation workflows well: CEP, CNPJ, CPF/CNPJ validation, holidays, business days, economic indicators, municipalities, and DDD. Minor gaps exist, such as no state list to support UF-based municipality lookup, no municipal/state holiday support beyond national holidays, and no reverse CEP/address geocoding.
Maintenance
Related MCP Connectors
Brazil CNPJ, CEP, Selic/IPCA/PTAX, holidays, banks/ISPB for agents. Pay per call in USDC (x402).
Brazilian public data API for AI agents. BCB, IBGE, CVM, B3, compliance. x402 payments on Base.
Brazilian CNH reports, traffic-violation lookup and points calculator for AI agents.
Brazilian company data & sanctions screening for AI agents. Certified. Pay-per-call x402.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to query Brazilian public data such as CEP, CNPJ, DDD, exchange rates, banks, and holidays via the Model Context Protocol.12MIT
- AlicenseAqualityDmaintenanceEnables 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
- AlicenseAqualityCmaintenanceEnables LLMs to access Brazilian public data through MCP tools for querying CNPJ, CEP, banks, and national holidays.4MIT
- AlicenseAqualityBmaintenanceEnables AI agents to query Brazilian public data such as CEP, CNPJ, banks, holidays, business days, FIPE vehicle prices, DDD, IBGE municipalities, .br domains, and ISBN, with read-only tools and offline document validation.1461 npmMIT