MCPInstall

mcp-brasil-server

MCP Server connecting AI agents to 70+ Brazilian public APIs for government data, economy, legislation, transparency, judiciary, elections, environment, health, education, and more

Installs
225
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/reason-machines/mcp-skills --skill mcp-brasil-server
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads mcp-brasil-server automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

mcp-brasil-server

Skill by ara.so — MCP Skills collection.

MCP Server providing 533 tools across 70+ Brazilian public data sources including economy (Banco Central, IBGE), legislation (Câmara, Senado), transparency (Portal da Transparência, TCU), judiciary (DataJud, STF), elections (TSE), environment (INPE, IBAMA), health (DataSUS, ANVISA), education (INEP), and more. Most APIs require no authentication; 4 features use free API keys. Includes local dataset caching with DuckDB for large datasets (TSE elections, SPU properties, ANP fuel prices, INEP school census).

Installation

pip/uv

pip install mcp-brasil
uv add mcp-brasil

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "mcp-brasil": {
      "command": "uvx",
      "args": ["--from", "mcp-brasil", "python", "-m", "mcp_brasil.server"],
      "env": {
        "TRANSPARENCIA_API_KEY": "your-transparencia-key",
        "DATAJUD_API_KEY": "your-datajud-key",
        "META_ACCESS_TOKEN": "your-meta-token",
        "MCP_BRASIL_DATASETS": "tse_candidatos,anp_precos"
      }
    }
  }
}

Environment variables:

  • TRANSPARENCIA_API_KEY (optional) - Portal da Transparência API key
  • DATAJUD_API_KEY (optional) - DataJud/CNJ API key
  • META_ACCESS_TOKEN (optional) - Meta Graph API token for electoral ads
  • MCP_BRASIL_DATASETS (optional) - Comma-separated list of local datasets to enable: spu_siapa, tse_candidatos, tse_bens, tse_votacao, tse_redes_sociais, tse_fefc, anp_precos, inep_censo_escolar, inep_enem

VS Code / Cursor

Create .vscode/mcp.json:

{
  "servers": {
    "mcp-brasil": {
      "command": "uvx",
      "args": ["--from", "mcp-brasil", "python", "-m", "mcp_brasil.server"],
      "env": {
        "TRANSPARENCIA_API_KEY": "your-key-here"
      }
    }
  }
}

Claude Code CLI

claude mcp add mcp-brasil -- uvx --from mcp-brasil python -m mcp_brasil.server

HTTP Mode (for other MCP clients)

fastmcp run mcp_brasil.server:mcp --transport http --port 8000
# Server available at http://localhost:8000/mcp

Key Features

533 Tools Across 70 Data Sources

The server auto-discovers features from the features/ directory. Each feature provides multiple tools:

  • Economy: bacen (9 tools), bcb_olinda (8), bndes (4), ipeadata (5), b3 (6)
  • Geography: ibge (9 tools for states, municipalities, statistics)
  • Legislative: camara (11), senado (26), governadores (4)
  • Transparency: transparencia (54), tcu (9), tce_* (multiple state courts)
  • Judiciary: datajud (7), jurisprudencia (6)
  • Electoral: tse (15), anuncios_eleitorais (6)
  • Environment: inpe (4), ana (3), ibama (4)
  • Health: saude (10), opendatasus (7), anvisa (10), imunizacao (10)
  • Education: inep (4), fnde (4)
  • Security: atlas_violencia (7), sinesp (6)
  • Utilities: brasilapi (16), dados_abertos (4), diario_oficial (11)

Smart Tool Discovery

The server uses BM25 search to filter tools based on context:

# When user asks about "inflation and interest rates"
# Only economy-related tools (bacen, bcb_olinda) are shown
# 533 total tools filtered down to ~20 relevant ones

Cross-Reference Planning

Use planejar_consulta to create multi-API execution plans:

# Tool: planejar_consulta
# Input: {"objetivo": "Compare spending of deputy X with their voting record on health bills"}
# Returns: Execution plan combining camara tools for expenses + voting + propositions

Batch Execution

Execute multiple queries in parallel:

# Tool: executar_lote
# Input: {
#   "consultas": [
#     {"tool": "bacen_sgs_serie", "params": {"codigo": 433}},  # IPCA
#     {"tool": "bacen_sgs_serie", "params": {"codigo": 4189}}, # Selic
#     {"tool": "ibge_agregados", "params": {"indicador": "pib"}}
#   ]
# }

Local Datasets with DuckDB

Enable large datasets via MCP_BRASIL_DATASETS environment variable:

export MCP_BRASIL_DATASETS="tse_candidatos,tse_votacao,anp_precos"

Available datasets:

  • spu_siapa - 813k federal properties
  • tse_candidatos - 4M+ candidate records (2014-2024)
  • tse_bens - Candidate asset declarations
  • tse_votacao - Vote counts by municipality/zone
  • tse_redes_sociais - Candidate social media URLs
  • tse_fefc - Electoral fund distributions
  • anp_precos - Weekly fuel prices at gas stations
  • inep_censo_escolar - 180k+ schools infrastructure data
  • inep_enem - 3.9M+ ENEM exam records

First load downloads and ingests data (minutes); subsequent queries run in milliseconds.

Common Usage Patterns

Query Economic Indicators

# Get Selic rate time series
tool: bacen_sgs_serie
params:
  codigo: 432
  data_inicio: "2024-01-01"
  data_fim: "2024-12-31"

# Get IPCA inflation
tool: bacen_sgs_serie
params:
  codigo: 433
  
# Get official exchange rate (PTAX)
tool: bcb_olinda_ptax
params:
  data_cotacao: "2024-05-15"
  moeda: "USD"

Search Legislative Data

# Find bills about AI in the Chamber
tool: camara_proposicoes_buscar
params:
  keywords: "inteligência artificial"
  ano: 2024

# Get deputy expenses
tool: camara_deputados_despesas
params:
  deputado_id: "204554"
  mes: 5
  ano: 2024

# Search Senate matters
tool: senado_materias_buscar
params:
  assunto: "meio ambiente"

Access Transparency Data

# Search federal contracts
tool: transparencia_contratos
params:
  data_inicio: "2024-01-01"
  data_fim: "2024-12-31"
  valor_minimo: 1000000

# Get civil servant salaries
tool: transparencia_servidores
params:
  orgao: "Ministério da Saúde"
  mes: 5
  ano: 2024

# Query TCU court decisions
tool: tcu_acordaos
params:
  ano: 2024
  palavras_chave: "licitação fraude"

Electoral Data Queries

# Search candidates (requires tse_candidatos dataset)
tool: tse_candidatos_query
params:
  sql: "SELECT * FROM candidatos WHERE ano_eleicao = 2024 AND uf = 'SP' LIMIT 100"

# Get candidate assets (requires tse_bens dataset)
tool: tse_bens_query
params:
  sql: "SELECT * FROM bens WHERE sq_candidato = '123456' ORDER BY valor DESC"

# Electoral ads from Meta
tool: anuncios_eleitorais_buscar
params:
  eleicao: "2024"
  candidato: "João Silva"

Health and Environment Data

# Search health facilities
tool: saude_cnes_estabelecimentos
params:
  municipio: "São Paulo"
  tipo: "Hospital Geral"

# Get vaccination coverage
tool: imunizacao_cobertura_vacinal
params:
  uf: "SP"
  ano: 2024

# Query wildfire hotspots
tool: inpe_focos_queimadas
params:
  data_inicio: "2024-08-01"
  data_fim: "2024-08-31"
  bioma: "Amazônia"

Geographic and Statistical Data

# List municipalities in a state
tool: ibge_municipios
params:
  uf: "SP"

# Get statistical aggregates
tool: ibge_agregados
params:
  indicador: "população"
  nivel_territorial: "município"
  localidade: "3550308"  # São Paulo city code

Fuel Prices (requires anp_precos dataset)

tool: anp_precos_query
params:
  sql: """
    SELECT municipio, avg(preco_venda) as preco_medio
    FROM precos_gasolina
    WHERE uf = 'SP' AND data_coleta >= '2024-01-01'
    GROUP BY municipio
    ORDER BY preco_medio DESC
    LIMIT 10
  """

School Census (requires inep_censo_escolar dataset)

tool: inep_censo_query
params:
  sql: """
    SELECT uf, count(*) as total_escolas
    FROM escolas
    WHERE tem_internet = 1 AND tem_biblioteca = 1
    GROUP BY uf
    ORDER BY total_escolas DESC
  """

Resources and Prompts

The server provides 131 resources and 102 prompts for common tasks:

Resources:

  • Dataset schemas and metadata
  • Feature documentation
  • API endpoint references

Prompts:

  • "Analyze deputy spending patterns"
  • "Compare state-level health indicators"
  • "Track bill progress through legislature"
  • "Find contract anomalies"

Development and Extension

Adding a New Feature

  1. Create directory: mcp_brasil/features/my_feature/
  2. Add tools.py:
from mcp_brasil.core import ServerContext
from pydantic import BaseModel, Field

class MyToolInput(BaseModel):
    param1: str = Field(description="Parameter description")
    param2: int = Field(default=10)

async def my_tool(context: ServerContext, params: MyToolInput):
    """Tool description for AI agent."""
    async with context.http.get(
        f"https://api.example.gov.br/endpoint",
        params={"q": params.param1, "limit": params.param2}
    ) as response:
        return await response.json()
  1. Register automatically via auto-discovery (zero configuration)

Local Development

git clone https://github.com/Mcp-Brasil/mcp-brasil.git
cd mcp-brasil
uv venv
source .venv/bin/activate  # or .venv\Scripts\activate on Windows
uv pip install -e ".[dev]"

# Run server
python -m mcp_brasil.server

# Run tests
pytest tests/

Rate Limiting

All HTTP requests use automatic rate limiting with exponential backoff:

# Configured in ServerContext
http = httpx.AsyncClient(
    timeout=30.0,
    limits=httpx.Limits(max_keepalive_connections=10, max_connections=20)
)
# Rate limiting handled automatically per feature

Troubleshooting

API Keys Not Working

# Verify environment variables are set
echo $TRANSPARENCIA_API_KEY
echo $DATAJUD_API_KEY

# Most features work without keys - only 4 require them:
# - transparencia (54 tools)
# - datajud (7 tools)
# - anuncios_eleitorais (6 tools)
# - spu_geo (4 tools - uses TRANSPARENCIA_API_KEY)

Dataset Download Fails

# Check disk space (datasets can be 100MB-1.6GB)
df -h

# Clear cache and retry
rm -rf ~/.mcp_brasil/cache/

# Enable specific datasets only
export MCP_BRASIL_DATASETS="tse_candidatos"  # Start with one

Too Many Tools Shown

The BM25 search transform should filter automatically. If you see all 533 tools:

# Check MCP client supports search transforms
# Claude Desktop and modern MCP clients do this automatically

# Manually use planejar_consulta to scope your query

HTTP Timeouts

# Increase timeout in ServerContext if needed
# Default is 30s, some large queries may need more

# For dataset queries, ensure dataset is downloaded first
# First query triggers download (minutes), subsequent are instant

Invalid SQL Queries on Datasets

# Get schema first
tool: tse_candidatos_schema  # or other *_schema tool
# Then construct SQL based on actual column names

# Example correct query:
tool: tse_candidatos_query
params:
  sql: "SELECT nm_candidato, sg_partido FROM candidatos WHERE ano_eleicao = 2024 LIMIT 10"

API Key Registration

Portal da Transparência (free):

  1. Visit https://api.portaldatransparencia.gov.br/
  2. Click "Solicitar chave"
  3. Fill form with email
  4. Receive key instantly

DataJud/CNJ (free):

  1. Visit https://datajud-api.cnj.jus.br/
  2. Register account
  3. Generate API key in dashboard

Meta Access Token (free):

  1. Create Facebook App at https://developers.facebook.com/
  2. Get User Access Token
  3. Use for electoral ads library

License and Data Usage

  • Code: MIT License
  • Data sources: Each API has its own license/terms (see SOURCES.md in repo)
  • Acceptable Use: Read ACCEPTABLE_USE.md before commercial/journalistic use
  • Not official: Independent project, not affiliated with Brazilian government

Resources

FAQ

What does the mcp-brasil-server skill do?

MCP Server connecting AI agents to 70+ Brazilian public APIs for government data, economy, legislation, transparency, judiciary, elections, environment, health, education, and more

How do I install mcp-brasil-server?

Run npx skills add https://github.com/reason-machines/mcp-skills --skill mcp-brasil-server in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/mcp-brasil-server/ (personal) or .claude/skills/mcp-brasil-server/ (project).

Which AI agents can use mcp-brasil-server?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is mcp-brasil-server safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains mcp-brasil-server?

It is published by reason-machines in reason-machines/mcp-skills. It has 225 recorded installs.

More from reason-machines/mcp-skills

View all →

codebase-memory-mcp-intelligence

reason-machines/mcp-skills

High-performance code intelligence MCP server that indexes codebases into knowledge graphs for structural queries, call traces, and architecture analysis

AI & Agents505 installs

playwright-mcp-server

reason-machines/mcp-skills

Browser automation MCP server using Playwright's accessibility tree for LLM-friendly web interaction

AI & Agents285 installs

tradingview-mcp-assistant

reason-machines/mcp-skills

Open the skill to read its SKILL.md instructions.

AI & Agents256 installs

lanhu-mcp-collaboration

reason-machines/mcp-skills

Open the skill to read its SKILL.md instructions.

AI & Agents245 installs

chrome-devtools-mcp-automation

reason-machines/mcp-skills

Expert guidance for Chrome DevTools MCP server - browser automation, debugging, and performance analysis for AI agents

AI & Agents239 installs

github-mcp-server

reason-machines/mcp-skills

Open the skill to read its SKILL.md instructions.

AI & Agents237 installs

Popular ai & agents skills

View category →

google-agents-cli-publish

google/agents-cli

This skill should be used when the user wants to "publish an agent", "publish my ADK agent", "register an agent with Gemini", "publish to Gemini" (formerly Gemini Enterprise), or needs guidance on the agents-cli publish gemini command. Also use when the user wants to "manage agents in Agent Registry", "list/update/delete registered agents", or "register an MCP server". Covers ADK vs A2A registration modes, programmatic and interactive usage, flag reference, auto-detection from deployment metadata, Agent Registry fleet management, and troubleshooting. Part of the agents-cli skills suite. Do NOT use for deployment (use google-agents-cli-deploy).

AI & Agents513.9K installs

google-agents-cli-eval

google/agents-cli

This skill should be used when the user wants to "run an evaluation", "evaluate my agent", "evaluate my ADK agent", "write an eval dataset", "analyze eval failures", "compare eval results", "optimize agent", or needs guidance on the Gemini platform eval methodology and the Quality Flywheel. Covers eval metrics, dataset schema, LLM-as-judge scoring, and common failure causes. Applies to any agents-cli project, whatever framework the agent is written in. Do NOT use for agent API code patterns (ADK: use google-agents-cli-adk-code), deployment (use google-agents-cli-deploy), or project scaffolding (use google-agents-cli-scaffold).

AI & Agents513.5K installs

skill-creator

anthropics/skills

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.

OfficialAI & Agents416.4K installs

codex-pet

prime-skills/runcomfy-agent-skills

Codex Pet generator on RunComfy. Build a Codex-compatible Codex Pet spritesheet.webp + pet.json from a single reference image, drop it into ${CODEXHOME:-$HOME/.codex}/pets/ / and Codex picks it up as a custom Codex Pet next to the 8 built-ins. This skill produces the exact Codex Pet atlas Codex expects (1536x1872 PNG/WebP, 8 cols x 9 rows, 192x208 cells, 9 animation states — idle, running-right, running-left, waving, jumping, failed, waiting, running, review). Calls OpenAI GPT Image 2 edit ONCE via the local RunComfy CLI as runcomfy run openai/gpt-image-2/edit to produce a canonical Codex Pet pose, then assembles all 9 animation rows programmatically with ImageMagick micro-transforms — no Codex Pro, no $imagegen, no OPENAIAPIKEY required, only RUNCOMFYTOKEN. Triggers on "codex pet", "create codex pet", "make codex pet", "hatch codex pet", "/hatch image", "desktop pet codex", "codex pets", "spritesheet.webp", or any explicit ask to build a custom pet for OpenAI Codex.

AI & Agents402.1K installs

full-output-enforcement

leonxlnx/taste-skill

Overrides default LLM truncation behavior. Enforces complete code generation, bans placeholder patterns, and handles token-limit splits cleanly. Apply to any task requiring exhaustive, unabridged output.

AI & Agents401K installs

executing-plans

obra/superpowers

Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available

AI & Agents245.7K installs