brasilapi-mcp-server
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-serverList the national holidays for 2025"
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-server
Servidor MCP que expõe a BrasilAPI (pública, sem autenticação) como ferramentas para LLMs: consulta de CNPJ, CEP, bancos e feriados nacionais.
Serve dois papéis:
Standalone: conectado ao Claude Desktop/Claude Code via stdio, permite que o modelo consulte dados públicos brasileiros durante uma conversa.
Serviço de enriquecimento: usado por outros projetos deste portfólio (
lead-router) para enriquecer leads com dados de CNPJ/CEP.
Ferramentas expostas
Tool | Descrição |
| Razão social, endereço, situação cadastral e CNAE de uma empresa |
| Endereço e coordenadas de um CEP |
| Lista de bancos registrados no Banco Central (códigos COMPE/ISPB) |
| Feriados nacionais de um ano |
Related MCP server: mcp-brasil
Rodando localmente
uv sync
uv run brasilapi-mcp-serverConectando no Claude Desktop
Adicione em claude_desktop_config.json:
{
"mcpServers": {
"brasilapi": {
"command": "uv",
"args": ["--directory", "/caminho/para/brasilapi-mcp-server", "run", "brasilapi-mcp-server"]
}
}
}Rodando como serviço HTTP (streamable-http)
Para ser chamado por outros serviços deste portfólio (lead-router) sem um
processo MCP dedicado por cliente:
MCP_TRANSPORT=streamable-http MCP_HTTP_PORT=8001 uv run brasilapi-mcp-serverOu via Docker:
docker build -t brasilapi-mcp-server .
docker run -p 8001:8001 brasilapi-mcp-serverResiliência
Cache em memória (1h de TTL) para respostas de sucesso — ver
cache.py.Retry com backoff exponencial (2 tentativas) em 429/5xx; um 404 nunca é re-tentado — ver
client.py.Erros tipados:
NotFoundError,RateLimitedError,BrasilAPIError— ver AGENTS.md para o contrato completo de comportamento.Logs estruturados (JSON-lines em stderr) —
logging_config.py.
Testes
uv sync --group dev
uv run pytest
uv run ruff check .Roadmap
Cobertura de mais endpoints da BrasilAPI (DDD, tabela FIPE, câmbio)
Cache compartilhado (Redis) se rodar com mais de uma réplica
Available Tools
4 toolsget_holidaysARead-onlyIdempotent
List Brazilian national holidays for a given year.
Args: year: Four-digit year (e.g. 2026).
| Name | Required | Description | Default |
|---|---|---|---|
| year | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already establish read-only, idempotent, non-destructive behavior. The description adds the useful boundary that only Brazilian national holidays are returned and requires a four-digit year, going slightly beyond the structured hints.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two compact, front-loaded sentences plus an Args listing. Every sentence earns its place with no filler or repetition of schema details.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a single-parameter read-only tool with annotations and an output schema, this is complete. It covers input format, scope, and safety implications without missing anything critical.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema only defines year as an integer, so the description's 'Four-digit year (e.g. 2026)' adds essential format and semantic meaning. It fully compensates for the 0% schema description coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The opening sentence names a precise verb and resource ('List Brazilian national holidays') and scopes it to a year. It is clearly distinct from sibling tools that look up CNPJ, CEP, or banks.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives clear invocation context: use this when you need Brazilian national holidays for a given year. It implies the exclusivity to national holidays, though it does not explicitly name alternative tools or negative cases.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_banksARead-onlyIdempotent
List all Brazilian banks registered with the Central Bank, with their codes (COMPE/ISPB).
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint, openWorldHint, idempotentHint, and destructiveHint=false, so the safety profile is fully covered. The description adds context about the data source and output codes but does not disclose additional behavioral traits such as pagination, freshness, or rate limits. With strong annotations, this is acceptable but not exceptional.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence that front-loads the verb, resource, and scope, then adds the relevant output fields. There is no wasted wording.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a zero-parameter read-only list tool with comprehensive annotations and an output schema, the description is sufficient. It states the authoritative source, the scope, and the codes returned, leaving no critical gap for an agent to call it correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has zero parameters, so there is no parameter detail for the description to add. The schema coverage is effectively complete, and the description reinforces the unbounded 'all banks' scope. Baseline for zero parameters is 4.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('List') and a precise resource ('Brazilian banks registered with the Central Bank'), and it specifies the key output fields (COMPE/ISPB codes). It is clearly distinguishable from sibling lookup tools such as lookup_cnpj and lookup_cep.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description makes the tool's scope obvious: it is for listing all Brazilian banks, not for looking up specific entities or dates. It does not explicitly name alternatives or exclusions, but the sibling names make the intended use clear.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
lookup_cepARead-onlyIdempotent
Look up a Brazilian postal code (CEP) — street, neighborhood, city, state, and coordinates.
Args: cep: CEP number, with or without formatting (e.g. "01310930" or "01310-930").
| Name | Required | Description | Default |
|---|---|---|---|
| cep | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, so the agent knows this is a safe, non-mutating lookup. The description adds the specific return fields (street, neighborhood, city, state, coordinates), which is useful behavioral context beyond the annotations. However, it doesn't disclose potential error behavior (e.g., invalid CEP, not found) or rate limits, which would be valuable for a lookup tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is compact and front-loaded. The first sentence states the purpose and return data, and the Args section provides parameter guidance. Every sentence earns its place; there is no fluff or repetition of schema information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple, single-parameter lookup tool with annotations covering the safety profile, the description is nearly complete. It covers what the tool does, what it returns, and how to format the parameter. The only gap is error handling behavior (e.g., what happens with an invalid or nonexistent CEP), but this is a minor omission for a read-only lookup tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It does: it explains the cep parameter accepts a CEP number with or without formatting, providing examples ('01310930' or '01310-930'). This adds meaning beyond the schema, which only says the parameter is a string. The description could mention validation rules (e.g., 8 digits) but the format guidance is solid.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: looking up a Brazilian postal code (CEP) and lists the specific data returned (street, neighborhood, city, state, coordinates). This is a specific verb+resource combination that distinguishes it from siblings like lookup_cnpj, which looks up a different Brazilian identifier.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies when to use this tool: when you need to look up a Brazilian postal code. It doesn't explicitly state when not to use it or name alternatives, but the sibling tools (lookup_cnpj, list_banks, get_holidays) are clearly different in purpose, so the usage context is reasonably clear. The description could be stronger with an explicit exclusion, but the context is sufficient.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
lookup_cnpjARead-onlyIdempotent
Look up a Brazilian company (CNPJ) — legal name, address, status, and business activity.
Args: cnpj: CNPJ number, with or without formatting (e.g. "19131243000197" or "19.131.243/0001-97").
| Name | Required | Description | Default |
|---|---|---|---|
| cnpj | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, so the safety profile is clear. The description adds the expected data categories returned, but does not disclose behavior around invalid CNPJs, response structure, or external data source variability. This is adequate but not especially rich.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is compact and well-structured: the first sentence states purpose and output, and the Args section precisely documents the sole input. There is no filler or redundant restatement of the tool name.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With no output schema, the description compensates by listing the key returned fields and fully documenting the one required parameter. Annotations cover side effects and idempotency. Missing details like error behavior or exact response envelope are minor for a simple read-only lookup.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema property has 0% description coverage, so the description carries the full documentation burden. It does so well by specifying that the CNPJ may be formatted or unformatted and providing two concrete examples. This is nearly all an agent needs for a single string parameter.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb and resource: 'Look up a Brazilian company (CNPJ)' and names the data returned (legal name, address, status, business activity). This clearly distinguishes it from siblings like lookup_cep, list_banks, and get_holidays without needing to open their schemas.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The use case is implied strongly by 'Brazilian company (CNPJ)', but there is no explicit guidance about when to choose this tool over alternatives or when not to use it. Sibling tools exist, yet the description does not acknowledge them or provide selection criteria.
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.
4 tool updates
v0.1.0- First observed
get_holidays - First observed
list_banks - First observed
lookup_cep - First observed
lookup_cnpj
TDQS
Scored across 4 tools
Each tool targets a completely distinct resource: companies (CNPJ), postal codes (CEP), banks, and holidays. There is no overlap in purpose or potential for misselection.
Naming is readable and noun-focused, but verbs are inconsistent: 'lookup_' for two tools, then 'list_', and 'get_'. The pattern is not uniform, though the differences are minor and contextually acceptable.
Four tools is slightly thin for a general Brazil data API but reasonable for a focused utility server. Each tool covers a meaningful public data lookup without redundancy.
The server covers a few common lookups but lacks many obvious BrasilAPI endpoints such as CPF (individual taxpayer), state/IBGE data, FIPE vehicle pricing, or DDD area codes. Agents needing these will hit dead ends.
Maintenance
Related MCP Connectors
Brazilian public data API for AI agents. BCB, IBGE, CVM, B3, compliance. x402 payments on Base.
IBGE: geography, census, economy and health from the official APIs, with provenance. 23 tools.
Brazilian legal stack in one MCP: lawsuits, court publications, case law, tenders, certificates.
Official remote MCP server for Brazilian company data (CNPJ): lookup, filtered search, contacts and partners with masked CPF. 70M CNPJs, base of Aug 2026; updated monthly, with the base date in every response. https://cnpj.ia.br/?utm_source=glama&utm_medium=listing
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
- AlicenseAqualityDmaintenanceMCP Server for accessing 36 Brazilian public data sources and 1 agent, enabling AI agents to query government data on economy, legislation, transparency, judiciary, elections, environment, health, and more.6MIT
- AlicenseAqualityCmaintenanceExposes the BrasilAPI as MCP tools, enabling AI agents to query Brazilian public data such as CEP, CNPJ, DDD, IBGE, banks, PIX, FIPE, NCM, exchange rates, taxes, weather, CVM information, holidays, ISBN, domains, stock tickers, and TUSS.41Apache 2.0
- AlicenseAqualityBmaintenanceEnables 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