Skip to main content
Glama
monkaS013

brasilapi-mcp

by monkaS013

brasilapi-mcp

An authored Model Context Protocol (MCP) server that exposes the public BrasilAPI as tools an LLM client (Claude Desktop, Claude Code, or any MCP host) can call: look up a CEP, a CNPJ, banks, FIPE vehicle prices, national holidays, and DDD area codes.

README em português

Why this exists

Consuming someone else's MCP server is easy; I wanted to prove I can build one — tool schemas, a typed HTTP client, and a boundary that keeps the whole thing testable. BrasilAPI is a good fit: it needs no API key and serves public data, so anyone can clone this and run it immediately, and every tool is exercised in tests without touching the network.

Related MCP server: MCP Brasil API

Tools

Tool

What it returns

cep

Address for a Brazilian postal code (accepts 01001-000 or 01001000)

cnpj

Company registration for a CNPJ (legal name, address, activity, status)

banks

Every bank registered at the Brazilian Central Bank

bank

A single bank by its numeric code (e.g. 001)

holidays

National holidays for a given year

ddd

State and cities served by a two-digit phone area code

fipe_brands

FIPE vehicle brands for carros, motos or caminhoes

fipe_price

FIPE reference price table for a model code

Install

pip install -e .

Dependencies are just mcp (the official Python SDK, v2) and httpx.

Run it

brasilapi-mcp            # runs the MCP server over stdio (what an MCP client launches)
brasilapi-mcp --help     # prints usage and exits, without opening a socket

The server speaks MCP over stdio — you normally don't run it by hand; an MCP client launches it and talks to it. python -m brasilapi_mcp.server works too.

Wire it into a client

Claude Desktop — add to claude_desktop_config.json:

{
  "mcpServers": {
    "brasilapi": {
      "command": "brasilapi-mcp"
    }
  }
}

If brasilapi-mcp isn't on your PATH, point command at your venv's script (e.g. .../.venv/Scripts/brasilapi-mcp on Windows) or use "command": "python", "args": ["-m", "brasilapi_mcp.server"].

Claude Code — one command:

claude mcp add brasilapi -- brasilapi-mcp

Then ask, in plain language: "what's the address for CEP 01001-000?" or "list the national holidays in 2026", and the model will call the matching tool.

Design — why it tests offline

The network sits behind an injectable boundary. BrasilAPIClient takes an optional httpx.Client/transport, so the test suite passes an httpx.MockTransport with canned JSON and runs with no real network I/O. The tool bodies are thin wrappers over plain, synchronous functions that take the client explicitly, so the logic is unit-testable in isolation, and a BrasilAPIError becomes a clean message the model can read instead of a traceback.

Testing

pip install -e ".[dev]"
pytest -q

The suite covers the client (every endpoint, input normalization, 404/500 handling) against a mock transport, the tool logic functions, and the server's tool registration. Nothing hits the network.

A note on the data

BrasilAPI is a public service and needs no key; this server stores no secrets and reads no environment variables. Live responses are owned by BrasilAPI and its upstream sources.

License

MIT — see LICENSE.

A
license - permissive license
A
quality
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    B
    quality
    D
    maintenance
    Query 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.
    6
    7
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables LLMs to query Brazilian public data such as CEP, CNPJ, DDD, exchange rates, banks, and holidays via the Model Context Protocol.
    12
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Exposes 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.
    41
    Apache 2.0
  • A
    license
    Not graded
    quality
    C
    maintenance
    Brazilian company-registry lookup via Receita Federal, allowing AI agents to query CNPJ data.
    6
    MIT

View all related MCP servers

Related MCP Connectors

  • Validate LatAm IDs: Mexican CLABE, Brazilian CNPJ/CPF checksums + BrasilAPI company/CEP/bank lookups

  • IBGE: geography, census, economy and health from the official APIs, with provenance. 21 tools.

  • Free Brazilian CNPJ lookup (legal name, status, partners) + lawsuit discovery. Public data, no login

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/monkaS013/brasilapi-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server