ibge-br-mcp
MCP Server for IBGE (Brazilian Institute of Geography and Statistics) APIs. π§π· Leia em PortuguΓͺs
This server implements the Model Context Protocol (MCP) to provide access to IBGE's public APIs, enabling AI assistants to query geographic, demographic, and statistical data from Brazil.
Features
23 specialized tools covering all major IBGE data domains
227 automated tests with 97%+ core coverage
Automatic caching with configurable TTL for optimal performance
Retry mechanism with exponential backoff for network resilience
Comprehensive validation for all input parameters
Standardized error handling with helpful suggestions
Full TypeScript support with strict typing
Related MCP server: Brasil API MCP
Available Tools
Localities & Geography
Tool | Description |
| List Brazilian states with region filtering |
| List municipalities by state or search by name |
| Get details of a locality by IBGE code |
| Decode IBGE codes or search codes by name |
| Find neighboring municipalities |
Statistical Data (SIDRA)
Tool | Description |
| Query SIDRA tables (Census, PNAD, GDP, etc.) |
| List and search available SIDRA tables |
| Get table metadata (variables, periods, levels) |
| List IBGE research surveys and their tables |
Economic & Social Indicators
Tool | Description |
| Economic and social indicators (GDP, IPCA, unemployment) |
| Census data (1970-2022) with 16 themes |
| Compare indicators across localities with rankings |
Municipal Data (Cidades@)
Tool | Description |
| Municipal indicators (population, HDI, GDP per capita, etc.) |
International Data
Tool | Description |
| Country data following UN M49 methodology |
Demographics
Tool | Description |
| Real-time Brazilian population projection |
| Name frequency and rankings in Brazil |
Classifications
Tool | Description |
| CNAE (National Classification of Economic Activities) |
Maps & Geographic Meshes
Tool | Description |
| Geographic meshes (GeoJSON, TopoJSON, SVG) |
| Thematic meshes (biomes, Legal Amazon, semi-arid) |
External Data (BCB & Health)
Tool | Description |
| Central Bank data (SELIC, IPCA, exchange rates) |
| Health indicators via IBGE/DataSUS |
News & Calendar
Tool | Description |
| IBGE news and press releases |
| IBGE release and collection calendar |
Installation
Prerequisites
Node.js 18.x or higher
npm or yarn
From npm (recommended)
From source
Configuration
Claude Desktop
Add to your Claude Desktop configuration file (claude_desktop_config.json):
Or if installed from source:
Claude Code
Tool Usage Examples
ibge_estados
List all Brazilian states.
ibge_municipios
List Brazilian municipalities.
ibge_cidades
Query municipal indicators (similar to Cidades@ portal).
Available indicators: populacao, area, densidade, pib_per_capita, idh, escolarizacao, mortalidade, salario_medio, receitas, despesas
ibge_paises
Query international country data.
Regions: americas, europa, africa, asia, oceania
ibge_sidra
Query SIDRA tables (IBGE's Automatic Recovery System).
Common tables:
Code | Description |
6579 | Population estimates (annual) |
9514 | Census 2022 population |
4714 | Unemployment rate (PNAD) |
6706 | GDP at current prices |
Territorial levels:
Code | Level |
1 | Brazil |
2 | Region (North, Northeast, etc.) |
3 | State (UF) |
6 | Municipality |
7 | Metropolitan Region |
106 | Health Region |
127 | Legal Amazon |
128 | Semi-arid |
ibge_censo
Query Census data (1970-2022).
Available themes: populacao, alfabetizacao, domicilios, idade_sexo, religiao, cor_raca, rendimento, migracao, educacao, trabalho
ibge_indicadores
Query economic and social indicators.
Available indicators:
Category | Indicators |
Economic | pib, pib_variacao, pib_per_capita, industria, comercio, servicos |
Prices | ipca, ipca_acumulado, inpc |
Labor | desemprego, ocupacao, rendimento, informalidade |
Population | populacao, densidade |
Agriculture | agricultura, pecuaria |
ibge_nomes
Query name frequency and rankings.
ibge_malhas
Get geographic meshes (maps).
Resolution levels:
Value | Internal Divisions |
0 | No divisions (outline only) |
2 | States |
5 | Municipalities |
bcb
Query Central Bank of Brazil data.
Available indicators: selic, cdi, tr, ipca, ipca_acum, igpm, inpc, dolar_compra, dolar_venda, euro, desemprego
datasaude
Query health indicators via IBGE/DataSUS.
Available indicators: mortalidade_infantil, esperanca_vida, nascidos_vivos, obitos, fecundidade, saneamento_agua, saneamento_esgoto, plano_saude
APIs Used
IBGE APIs
Localities:
servicodados.ibge.gov.br/api/v1/localidadesNames:
servicodados.ibge.gov.br/api/v2/censos/nomesAggregates/SIDRA:
servicodados.ibge.gov.br/api/v3/agregadosSIDRA API:
apisidra.ibge.gov.br/valuesMeshes:
servicodados.ibge.gov.br/api/v3/malhasNews:
servicodados.ibge.gov.br/api/v3/noticiasPopulation:
servicodados.ibge.gov.br/api/v1/projecoes/populacaoCNAE:
servicodados.ibge.gov.br/api/v2/cnaeCalendar:
servicodados.ibge.gov.br/api/v3/calendarioCountries:
servicodados.ibge.gov.br/api/v1/paisesResearch:
servicodados.ibge.gov.br/api/v1/pesquisas
External APIs
Central Bank (BCB):
api.bcb.gov.br/dados/serie/bcdata.sgs- Interest rates, exchange rates, inflation
Development
Project Structure
Testing
The project includes a comprehensive test suite with 227 tests covering:
Validation functions
Retry mechanism
Formatting utilities
Error handling
Cache operations
Integration tests with mocks
Quality Assurance
This project maintains high code quality standards:
227 automated tests covering validation, caching, retry logic, formatting, and integrations
97%+ test coverage on core modules (cache, validation, errors, types)
ESLint for code linting with zero warnings
Prettier for consistent code formatting
TypeScript strict mode for type safety
Automated CI/CD via GitHub Actions
Run tests locally:
License
MIT
Author
Sidney Bissoli