ibge-br-mcp 5.12.0 → 5.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,14 +13,17 @@
13
13
  [![GitHub Sponsors](https://img.shields.io/github/sponsors/SidneyBissoli?logo=githubsponsors&label=Sponsor&color=db61a2)](https://github.com/sponsors/SidneyBissoli)
14
14
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
15
15
 
16
+ 🇧🇷 [Leia em Português](https://github.com/SidneyBissoli/ibge-br-mcp/blob/main/LEIA-ME.md)
17
+
16
18
  **Live, exact Brazilian public data for your AI assistant — with provenance, not guesswork.**
17
19
 
18
20
  Ask an LLM _"what was Belo Horizonte's population in the 2022 Census?"_ and you get a plausible number from its training data: maybe right, maybe outdated, with no source. `ibge-br-mcp` instead has your assistant query the official **IBGE** APIs in real time — returning the exact figure together with the table and period it came from.
19
21
 
20
- 🇧🇷 [Leia em Português](LEIA-ME.md)
21
-
22
22
  This server implements the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) to give AI assistants live, structured access to Brazil's public geographic, demographic, economic, and health data — sourced from the IBGE APIs (including health indicators served through IBGE's SIDRA system).
23
23
 
24
+ > **Independent project.** A community-built client of the IBGE's public APIs, not affiliated with
25
+ > or endorsed by the Instituto Brasileiro de Geografia e Estatística. The data are the IBGE's.
26
+
24
27
  ## See it in action
25
28
 
26
29
  Ask your assistant, in English or Portuguese:
@@ -58,7 +61,7 @@ ranking all 5,570 municipalities in a single call.
58
61
 
59
62
  ## Data provenance
60
63
 
61
- Since v3.3.0 every successful tool response carries a **provenance block**
64
+ Every successful tool response carries a **provenance block**
62
65
  ([portfolio contract v1.0](https://www.npmjs.com/package/@sbissoli/mcp-provenance)),
63
66
  so each number is citable, auditable, and reproducible. The block is emitted on
64
67
  three channels:
@@ -85,8 +88,7 @@ aggregates are computed server-side from the raw IBGE values.
85
88
  its period nor whether it is a monthly change, a year-to-date or 12-month
86
89
  accumulation, an index or a level — the record's period column and its
87
90
  `Variável` label do, and each `ibge_indicadores` entry is pinned to the one
88
- variable its name promises (since 5.7.0; before, nine of them mixed every
89
- variable of the table). `data_vintage` is ordered by the SIDRA period code, so
91
+ variable its name promises, never a mix of the table's variables. `data_vintage` is ordered by the SIDRA period code, so
90
92
  a January–December request reads "janeiro 2024–dezembro 2024". Every value is
91
93
  the version SIDRA publishes at `retrieved_at`: IBGE revises published figures
92
94
  (quarterly GDP, PNAD reweighting, PIM/PMC/PMS) and keeps no earlier version.
@@ -199,15 +201,13 @@ Discover → inspect → query: `ibge_pesquisas` / `ibge_sidra_tabelas` (find a
199
201
 
200
202
  ### Ask in your words, not the IBGE's
201
203
 
202
- The IBGE names its tables in official statistical Portuguese, and `ibge_sidra_tabelas` matched
203
- your words against the table name as a plain substring, accents included — so `populacao`
204
- (no tilde, as anyone types it) returned *nothing at all*, and so did the everyday word for a
205
- concept the IBGE names differently. Measured over the 9,336 tables of the Aggregates API
206
- (2026-09-16), fixed since 5.1.0: both sides are normalised, every word must match (AND), and
207
- the everyday word is expanded to the IBGE's own — the response says so in `notas_vocabulario`,
204
+ The IBGE names its tables in official statistical Portuguese, so `populacao` (no tilde, as
205
+ anyone types it) or the everyday word for a concept the IBGE names differently would match no
206
+ table name literally. `ibge_sidra_tabelas` therefore normalises both sides, requires every word to match (AND) and
207
+ expands the everyday word to the IBGE's own — the response says so in `notas_vocabulario`,
208
208
  and zero results come with a way out.
209
209
 
210
- | you ask | hits before | the IBGE writes | hits |
210
+ | you ask | literal matches | the IBGE writes | hits |
211
211
  | --- | ---: | --- | ---: |
212
212
  | `populacao`, `ocupacao`, `instrucao`, `saude`, `area`, `agua` | 0 | população, ocupação, instrução, saúde, área, água | 520, 364, 698, 518, 956, 256 |
213
213
  | `desemprego` | 4 | desocupação | 33 |
@@ -557,7 +557,7 @@ ibge_datasaude(indicador="listar")
557
557
 
558
558
  - **Localities**: `servicodados.ibge.gov.br/api/v1/localidades`
559
559
  - **Names**: `servicodados.ibge.gov.br/api/v2/censos/nomes`
560
- - **Aggregates/SIDRA**: `servicodados.ibge.gov.br/api/v3/agregados` (SIDRA tables are read here with `view=flat`; `apisidra.ibge.gov.br` has been behind a browser-only Cloudflare challenge since 2026-09-15)
560
+ - **Aggregates/SIDRA**: `servicodados.ibge.gov.br/api/v3/agregados` (SIDRA tables are read here with `view=flat`; `apisidra.ibge.gov.br` has been behind a browser-only Cloudflare challenge)
561
561
  - **Meshes**: `servicodados.ibge.gov.br/api/v3/malhas`
562
562
  - **News**: `servicodados.ibge.gov.br/api/v3/noticias`
563
563
  - **Population**: `servicodados.ibge.gov.br/api/v1/projecoes/populacao`
@@ -689,6 +689,12 @@ curl -sO https://raw.githubusercontent.com/SidneyBissoli/mcp-br-commons/main/pac
689
689
  node verify.mjs io.github.SidneyBissoli/ibge-br-mcp
690
690
  ```
691
691
 
692
+ ## Contributing
693
+
694
+ Found a wrong number or a confusing answer? Open an [issue](https://github.com/SidneyBissoli/ibge-br-mcp/issues) with the question asked,
695
+ the tool and arguments used and what you expected (English or Portuguese). For code changes, read
696
+ [CONTRIBUTING.md](https://github.com/SidneyBissoli/ibge-br-mcp/blob/main/CONTRIBUTING.md) and open an issue before a large pull request.
697
+
692
698
  ## License
693
699
 
694
700
  MIT
package/dist/server.js CHANGED
@@ -270,7 +270,7 @@ Examples:
270
270
 
271
271
  ${NOTE_WHAT_EACH_NUMBER_IS}
272
272
 
273
- Statistics mode: for **largest/smallest/mean/median/distribution/ranking** questions ("which municipality has the largest population?", "median GDP by state") use estatisticas=true — it computes min/max/mean/median/std-dev/labeled percentiles over ALL data rows BEFORE pagination and returns top/bottom rankings (default 10, cap 100 via topN), so one call answers what would otherwise require paging thousands of records. With agruparPor="<column label>" (e.g. "Unidade da Federação", "Ano") it ranks groups by descending sum, each with its own mini-distribution. Queries mixing several variables auto-group by "Variável" (units differ). SIDRA absence markers ("-", "..", "...", "X") are excluded from n. In this mode pagina/campos/formato are ignored and registros comes empty. Very large queries are refused by the source (since 2026-09-16 SIDRA tables are read through the Aggregates API, whose ceiling is lower than SIDRA's old 100,000-value cap: all municipalities × 12 yearly periods fails, × 8 works) — narrow periodos (e.g. "last 4") or raise nivel_territorial.
273
+ Statistics mode: for **largest/smallest/mean/median/distribution/ranking** questions ("which municipality has the largest population?", "median GDP by state") use estatisticas=true — it computes min/max/mean/median/std-dev/labeled percentiles over ALL data rows BEFORE pagination and returns top/bottom rankings (default 10, cap 100 via topN), so one call answers what would otherwise require paging thousands of records. With agruparPor="<column label>" (e.g. "Unidade da Federação", "Ano") it ranks groups by descending sum, each with its own mini-distribution. Queries mixing several variables auto-group by "Variável" (units differ). SIDRA absence markers ("-", "..", "...", "X") are excluded from n. In this mode pagina/campos/formato are ignored and registros comes empty. Very large queries are refused by the source (SIDRA tables are read through the IBGE Aggregates API, which caps the size of each query: all municipalities × 12 yearly periods fails, × 8 works) — narrow periodos (e.g. "last 4") or raise nivel_territorial.
274
274
 
275
275
  ibge_sidra is the low-level engine. Prefer a friendlier wrapper when it fits:
276
276
  - Census themes (1970–2022) → ibge_censo
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ibge-br-mcp",
3
- "version": "5.12.0",
3
+ "version": "5.13.0",
4
4
  "mcpName": "io.github.SidneyBissoli/ibge-br-mcp",
5
5
  "description": "MCP server giving AI assistants live, sourced access to Brazilian public data — geography, census, economy and health — from the official IBGE APIs. Exact figures with provenance, not approximations.",
6
6
  "type": "module",
@@ -75,7 +75,7 @@
75
75
  "@sbissoli/mcp-evals": "^0.3.0",
76
76
  "@sbissoli/mcp-live-source": "^0.5.0",
77
77
  "@sbissoli/mcp-surface": "^0.6.0",
78
- "@sbissoli/mcp-tool-tests": "^0.2.0",
78
+ "@sbissoli/mcp-tool-tests": "^0.3.0",
79
79
  "@types/node": "^26.5.1",
80
80
  "@vitest/coverage-v8": "^5.0.0",
81
81
  "eslint": "^10.9.1",