ibge-br-mcp 3.0.2 → 3.2.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.
Files changed (73) hide show
  1. package/README.md +33 -2
  2. package/README.pt-BR.md +34 -2
  3. package/dist/index.js +7 -11
  4. package/dist/index.js.map +1 -1
  5. package/dist/prompts.d.ts +1 -1
  6. package/dist/prompts.d.ts.map +1 -1
  7. package/dist/prompts.js +4 -4
  8. package/dist/prompts.js.map +1 -1
  9. package/dist/resources.d.ts +1 -1
  10. package/dist/resources.d.ts.map +1 -1
  11. package/dist/server.d.ts +19 -3
  12. package/dist/server.d.ts.map +1 -1
  13. package/dist/server.js +138 -114
  14. package/dist/server.js.map +1 -1
  15. package/dist/stats.d.ts +92 -0
  16. package/dist/stats.d.ts.map +1 -0
  17. package/dist/stats.js +288 -0
  18. package/dist/stats.js.map +1 -0
  19. package/dist/structured.d.ts +1 -1
  20. package/dist/structured.d.ts.map +1 -1
  21. package/dist/tools/calendario.d.ts +8 -62
  22. package/dist/tools/calendario.d.ts.map +1 -1
  23. package/dist/tools/censo.d.ts +78 -37
  24. package/dist/tools/censo.d.ts.map +1 -1
  25. package/dist/tools/censo.js +30 -3
  26. package/dist/tools/censo.js.map +1 -1
  27. package/dist/tools/cidades.d.ts +9 -42
  28. package/dist/tools/cidades.d.ts.map +1 -1
  29. package/dist/tools/cnae.d.ts +22 -155
  30. package/dist/tools/cnae.d.ts.map +1 -1
  31. package/dist/tools/comparar.d.ts +19 -68
  32. package/dist/tools/comparar.d.ts.map +1 -1
  33. package/dist/tools/datasaude.d.ts +50 -33
  34. package/dist/tools/datasaude.d.ts.map +1 -1
  35. package/dist/tools/datasaude.js +31 -1
  36. package/dist/tools/datasaude.js.map +1 -1
  37. package/dist/tools/estados.d.ts +15 -37
  38. package/dist/tools/estados.d.ts.map +1 -1
  39. package/dist/tools/geocodigo.d.ts +12 -82
  40. package/dist/tools/geocodigo.d.ts.map +1 -1
  41. package/dist/tools/indicadores.d.ts +58 -36
  42. package/dist/tools/indicadores.d.ts.map +1 -1
  43. package/dist/tools/indicadores.js +28 -1
  44. package/dist/tools/indicadores.js.map +1 -1
  45. package/dist/tools/localidade.d.ts +19 -133
  46. package/dist/tools/localidade.d.ts.map +1 -1
  47. package/dist/tools/malhas-tema.d.ts +28 -47
  48. package/dist/tools/malhas-tema.d.ts.map +1 -1
  49. package/dist/tools/malhas.d.ts +32 -36
  50. package/dist/tools/malhas.d.ts.map +1 -1
  51. package/dist/tools/municipios.d.ts +3 -33
  52. package/dist/tools/municipios.d.ts.map +1 -1
  53. package/dist/tools/nomes.d.ts +28 -139
  54. package/dist/tools/nomes.d.ts.map +1 -1
  55. package/dist/tools/noticias.d.ts +7 -68
  56. package/dist/tools/noticias.d.ts.map +1 -1
  57. package/dist/tools/paises.d.ts +20 -168
  58. package/dist/tools/paises.d.ts.map +1 -1
  59. package/dist/tools/pesquisas.d.ts +9 -78
  60. package/dist/tools/pesquisas.d.ts.map +1 -1
  61. package/dist/tools/populacao.d.ts +6 -34
  62. package/dist/tools/populacao.d.ts.map +1 -1
  63. package/dist/tools/sidra-metadados.d.ts +9 -161
  64. package/dist/tools/sidra-metadados.d.ts.map +1 -1
  65. package/dist/tools/sidra-tabelas.d.ts +3 -37
  66. package/dist/tools/sidra-tabelas.d.ts.map +1 -1
  67. package/dist/tools/sidra.d.ts +51 -60
  68. package/dist/tools/sidra.d.ts.map +1 -1
  69. package/dist/tools/sidra.js +45 -1
  70. package/dist/tools/sidra.js.map +1 -1
  71. package/dist/tools/vizinhos.d.ts +4 -54
  72. package/dist/tools/vizinhos.d.ts.map +1 -1
  73. package/package.json +6 -4
package/README.md CHANGED
@@ -4,11 +4,16 @@
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/ibge-br-mcp.svg)](https://www.npmjs.com/package/ibge-br-mcp)
6
6
  [![npm downloads](https://img.shields.io/npm/dm/ibge-br-mcp.svg)](https://www.npmjs.com/package/ibge-br-mcp)
7
+ [![node](https://img.shields.io/node/v/ibge-br-mcp)](https://www.npmjs.com/package/ibge-br-mcp)
8
+ [![MCP Registry](https://img.shields.io/badge/MCP-Registry-blue)](https://registry.modelcontextprotocol.io)
9
+ [![LobeHub](https://lobehub.com/badge/mcp/sidneybissoli-ibge-br-mcp)](https://lobehub.com/mcp/sidneybissoli-ibge-br-mcp)
10
+ [![smithery badge](https://smithery.ai/badge/sidneybissoli/ibge-br-mcp)](https://smithery.ai/server/sidneybissoli/ibge-br-mcp)
11
+ [![ibge-br-mcp MCP server](https://glama.ai/mcp/servers/@SidneyBissoli/ibge-br-mcp/badges/score.svg)](https://glama.ai/mcp/servers/@SidneyBissoli/ibge-br-mcp)
7
12
  [![Tests](https://img.shields.io/badge/tests-456%20passed-brightgreen.svg)](https://github.com/SidneyBissoli/ibge-br-mcp)
8
13
  [![Coverage](https://img.shields.io/badge/coverage-core%2097%25-brightgreen.svg)](https://github.com/SidneyBissoli/ibge-br-mcp)
14
+ [![GitHub stars](https://img.shields.io/github/stars/SidneyBissoli/ibge-br-mcp?style=flat&logo=github)](https://github.com/SidneyBissoli/ibge-br-mcp)
15
+ [![GitHub Sponsors](https://img.shields.io/github/sponsors/SidneyBissoli?logo=githubsponsors&label=Sponsor&color=db61a2)](https://github.com/sponsors/SidneyBissoli)
9
16
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
10
- [![smithery badge](https://smithery.ai/badge/sidneybissoli/ibge-br-mcp)](https://smithery.ai/server/sidneybissoli/ibge-br-mcp)
11
- [![ibge-br-mcp MCP server](https://glama.ai/mcp/servers/@SidneyBissoli/ibge-br-mcp/badges/score.svg)](https://glama.ai/mcp/servers/@SidneyBissoli/ibge-br-mcp)
12
17
 
13
18
  **Live, exact Brazilian public data for your AI assistant — with provenance, not guesswork.**
14
19
 
@@ -18,6 +23,16 @@ Ask an LLM _"what was Belo Horizonte's population in the 2022 Census?"_ and you
18
23
 
19
24
  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).
20
25
 
26
+ ## See it in action
27
+
28
+ Ask your assistant, in plain Portuguese:
29
+
30
+ - *"Qual era a população de Belo Horizonte no Censo 2022?"* → `ibge_cidades` / `ibge_censo`
31
+ - *"Liste os municípios do Espírito Santo."* → `ibge_municipios`
32
+ - *"Compare o PIB per capita das capitais do Sudeste."* → `ibge_comparar`
33
+
34
+ The answers come live from the official IBGE APIs — exact figures with the table and period they came from, not numbers guessed from training data.
35
+
21
36
  ## Features
22
37
 
23
38
  - **22 specialized tools** covering all major IBGE data domains
@@ -107,6 +122,7 @@ With 22 tools, several can touch the same topic. Quick guide for the common over
107
122
  | Rank/compare 2–10 localities on one indicator | `ibge_comparar` |
108
123
  | A macro indicator time series (GDP, IPCA, unemployment…) | `ibge_indicadores` |
109
124
  | A specific SIDRA table / fine control | `ibge_sidra` |
125
+ | The largest/smallest/mean/median across a whole table | `ibge_sidra`/`ibge_censo`/`ibge_indicadores`/`ibge_datasaude` with `estatisticas=true` |
110
126
 
111
127
  ### Economic indicators
112
128
 
@@ -309,6 +325,21 @@ ibge_sidra(tabela="9514", nivel_territorial="6", localidades="3550308")
309
325
  | 127 | Legal Amazon |
310
326
  | 128 | Semi-arid |
311
327
 
328
+ **Statistics mode** (also on `ibge_censo`, `ibge_indicadores`, `ibge_datasaude`):
329
+ for largest/smallest/mean/median/distribution/ranking questions, pass
330
+ `estatisticas=true` — the server computes the full distribution (min/max/mean/
331
+ median/std-dev/labeled percentiles) over **all** rows before pagination and
332
+ returns `top`/`bottom` rankings (`topN`, default 10). `agruparPor="<column
333
+ label>"` ranks groups by descending sum, each with its own mini-distribution.
334
+
335
+ ```
336
+ # Which state has the largest estimated population?
337
+ ibge_sidra(tabela="6579", nivel_territorial="3", estatisticas=true)
338
+
339
+ # Census 2022 population distribution grouped by state
340
+ ibge_censo(ano="2022", tema="populacao", nivel_territorial="3", estatisticas=true, agruparPor="Unidade da Federação")
341
+ ```
342
+
312
343
  ### ibge_censo
313
344
 
314
345
  Query Census data (1970-2022).
package/README.pt-BR.md CHANGED
@@ -4,11 +4,16 @@
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/ibge-br-mcp.svg)](https://www.npmjs.com/package/ibge-br-mcp)
6
6
  [![npm downloads](https://img.shields.io/npm/dm/ibge-br-mcp.svg)](https://www.npmjs.com/package/ibge-br-mcp)
7
+ [![node](https://img.shields.io/node/v/ibge-br-mcp)](https://www.npmjs.com/package/ibge-br-mcp)
8
+ [![MCP Registry](https://img.shields.io/badge/MCP-Registry-blue)](https://registry.modelcontextprotocol.io)
9
+ [![LobeHub](https://lobehub.com/badge/mcp/sidneybissoli-ibge-br-mcp)](https://lobehub.com/mcp/sidneybissoli-ibge-br-mcp)
10
+ [![smithery badge](https://smithery.ai/badge/sidneybissoli/ibge-br-mcp)](https://smithery.ai/server/sidneybissoli/ibge-br-mcp)
11
+ [![ibge-br-mcp MCP server](https://glama.ai/mcp/servers/@SidneyBissoli/ibge-br-mcp/badges/score.svg)](https://glama.ai/mcp/servers/@SidneyBissoli/ibge-br-mcp)
7
12
  [![Tests](https://img.shields.io/badge/tests-456%20passed-brightgreen.svg)](https://github.com/SidneyBissoli/ibge-br-mcp)
8
13
  [![Coverage](https://img.shields.io/badge/coverage-core%2097%25-brightgreen.svg)](https://github.com/SidneyBissoli/ibge-br-mcp)
14
+ [![GitHub stars](https://img.shields.io/github/stars/SidneyBissoli/ibge-br-mcp?style=flat&logo=github)](https://github.com/SidneyBissoli/ibge-br-mcp)
15
+ [![GitHub Sponsors](https://img.shields.io/github/sponsors/SidneyBissoli?logo=githubsponsors&label=Sponsor&color=db61a2)](https://github.com/sponsors/SidneyBissoli)
9
16
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
10
- [![smithery badge](https://smithery.ai/badge/sidneybissoli/ibge-br-mcp)](https://smithery.ai/server/sidneybissoli/ibge-br-mcp)
11
- [![ibge-br-mcp MCP server](https://glama.ai/mcp/servers/@SidneyBissoli/ibge-br-mcp/badges/score.svg)](https://glama.ai/mcp/servers/@SidneyBissoli/ibge-br-mcp)
12
17
 
13
18
  **Dados públicos brasileiros ao vivo e exatos para o seu assistente de IA — com procedência, não chute.**
14
19
 
@@ -18,6 +23,16 @@ Pergunte a um LLM _"qual era a população de Belo Horizonte no Censo 2022?"_ e
18
23
 
19
24
  Este servidor implementa o [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) para dar aos assistentes de IA acesso ao vivo e estruturado aos dados públicos geográficos, demográficos, econômicos e de saúde do Brasil — vindos das APIs do IBGE (inclusive os indicadores de saúde, servidos pelo SIDRA do IBGE).
20
25
 
26
+ ## Veja na prática
27
+
28
+ Pergunte ao seu assistente, em português:
29
+
30
+ - *"Qual era a população de Belo Horizonte no Censo 2022?"* → `ibge_cidades` / `ibge_censo`
31
+ - *"Liste os municípios do Espírito Santo."* → `ibge_municipios`
32
+ - *"Compare o PIB per capita das capitais do Sudeste."* → `ibge_comparar`
33
+
34
+ As respostas vêm ao vivo das APIs oficiais do IBGE — valores exatos com a tabela e o período de onde vieram, não números chutados do treino.
35
+
21
36
  ## Recursos
22
37
 
23
38
  - **22 ferramentas especializadas** cobrindo todos os principais domínios de dados do IBGE
@@ -107,6 +122,7 @@ Com 22 ferramentas, várias podem tocar no mesmo assunto. Guia rápido para as s
107
122
  | Ranquear/comparar 2–10 localidades num indicador | `ibge_comparar` |
108
123
  | Série temporal de indicador macro (PIB, IPCA, desemprego…) | `ibge_indicadores` |
109
124
  | Uma tabela SIDRA específica / controle fino | `ibge_sidra` |
125
+ | O maior/menor/média/mediana de uma tabela inteira | `ibge_sidra`/`ibge_censo`/`ibge_indicadores`/`ibge_datasaude` com `estatisticas=true` |
110
126
 
111
127
  ### Indicadores econômicos
112
128
 
@@ -309,6 +325,22 @@ ibge_sidra(tabela="9514", nivel_territorial="6", localidades="3550308")
309
325
  | 127 | Amazônia Legal |
310
326
  | 128 | Semiárido |
311
327
 
328
+ **Modo estatístico** (também em `ibge_censo`, `ibge_indicadores`,
329
+ `ibge_datasaude`): para perguntas de maior/menor/média/mediana/distribuição/
330
+ ranking, passe `estatisticas=true` — o servidor computa a distribuição completa
331
+ (mínimo/máximo/média/mediana/desvio-padrão/percentis rotulados) sobre **todos**
332
+ os registros, antes da paginação, e devolve rankings `top`/`bottom` (`topN`,
333
+ padrão 10). `agruparPor="<rótulo da coluna>"` ranqueia os grupos por soma
334
+ decrescente, cada um com sua mini-distribuição.
335
+
336
+ ```
337
+ # Qual estado tem a maior população estimada?
338
+ ibge_sidra(tabela="6579", nivel_territorial="3", estatisticas=true)
339
+
340
+ # Distribuição da população do Censo 2022 agrupada por UF
341
+ ibge_censo(ano="2022", tema="populacao", nivel_territorial="3", estatisticas=true, agruparPor="Unidade da Federação")
342
+ ```
343
+
312
344
  ### ibge_censo
313
345
 
314
346
  Consulta dados censitários (1970-2022).
package/dist/index.js CHANGED
@@ -1,21 +1,17 @@
1
1
  #!/usr/bin/env node
2
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
2
+ import { serveStdio } from "@modelcontextprotocol/server/stdio";
3
3
  import { createServer, SERVER_NAME, SERVER_VERSION } from "./server.js";
4
4
  /**
5
5
  * Entry point: build the IBGE MCP Server and serve it over STDIO.
6
6
  *
7
7
  * Server construction lives in `server.ts` (side-effect-free, testable); this
8
- * file only wires it to the STDIO transport stdout is the MCP protocol
8
+ * file only wires it to the STDIO transport. `serveStdio` owns the connection:
9
+ * it pins one server instance from the factory per connection and serves both
10
+ * the modern and the 2025-era protocol openings. stdout is the MCP protocol
9
11
  * channel, so all logging goes to stderr.
10
12
  */
11
- async function main() {
12
- const server = createServer();
13
- const transport = new StdioServerTransport();
14
- await server.connect(transport);
15
- console.error(`${SERVER_NAME} v${SERVER_VERSION} started`);
16
- }
17
- main().catch((error) => {
18
- console.error("Fatal error:", error);
19
- process.exit(1);
13
+ serveStdio(() => createServer(), {
14
+ onerror: (error) => console.error("Transport error:", error),
20
15
  });
16
+ console.error(`${SERVER_NAME} v${SERVER_VERSION} started`);
21
17
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAExE;;;;;;GAMG;AACH,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAE9B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,OAAO,CAAC,KAAK,CAAC,GAAG,WAAW,KAAK,cAAc,UAAU,CAAC,CAAC;AAC7D,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAExE;;;;;;;;GAQG;AACH,UAAU,CAAC,GAAG,EAAE,CAAC,YAAY,EAAE,EAAE;IAC/B,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,kBAAkB,EAAE,KAAK,CAAC;CAC7D,CAAC,CAAC;AAEH,OAAO,CAAC,KAAK,CAAC,GAAG,WAAW,KAAK,cAAc,UAAU,CAAC,CAAC"}
package/dist/prompts.d.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  * building a demographic profile — so users don't have to remember which tools
7
7
  * to chain.
8
8
  */
9
- import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
9
+ import type { McpServer } from "@modelcontextprotocol/server";
10
10
  /** Registers all analysis-template prompts on the server. */
11
11
  export declare function registerPrompts(server: McpServer): void;
12
12
  //# sourceMappingURL=prompts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAczE,6DAA6D;AAC7D,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA6DvD"}
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAc9D,6DAA6D;AAC7D,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA6DvD"}
package/dist/prompts.js CHANGED
@@ -24,7 +24,7 @@ export function registerPrompts(server) {
24
24
  server.registerPrompt("comparar-municipios", {
25
25
  title: "Comparar municípios",
26
26
  description: "Compara 2 a 10 localidades (municípios ou UFs) em um indicador e produz um ranking comentado.",
27
- argsSchema: {
27
+ argsSchema: z.object({
28
28
  localidades: z
29
29
  .string()
30
30
  .describe("Localidades separadas por vírgula — códigos IBGE ou nomes (ex.: 'São Paulo, Rio de Janeiro, Belo Horizonte')"),
@@ -32,7 +32,7 @@ export function registerPrompts(server) {
32
32
  .string()
33
33
  .optional()
34
34
  .describe("Indicador a comparar (ex.: populacao, pib, densidade, alfabetizacao). Padrão: populacao"),
35
- },
35
+ }),
36
36
  }, ({ localidades, indicador }) => {
37
37
  const ind = indicador?.trim() || "populacao";
38
38
  return userMessage(`Compare as seguintes localidades pelo indicador "${ind}": ${localidades}.
@@ -47,11 +47,11 @@ Passos:
47
47
  server.registerPrompt("perfil-demografico", {
48
48
  title: "Perfil demográfico",
49
49
  description: "Monta um perfil demográfico de uma localidade combinando população, censo e indicadores socioeconômicos.",
50
- argsSchema: {
50
+ argsSchema: z.object({
51
51
  localidade: z
52
52
  .string()
53
53
  .describe("Município ou UF — código IBGE ou nome (ex.: '3550308' ou 'São Paulo')"),
54
- },
54
+ }),
55
55
  }, ({ localidade }) => userMessage(`Monte um perfil demográfico da localidade: ${localidade}.
56
56
 
57
57
  Passos:
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,6EAA6E;AAC7E,SAAS,WAAW,CAAC,IAAY;IAC/B,OAAO;QACL,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAe;gBACrB,OAAO,EAAE,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE;aACzC;SACF;KACF,CAAC;AACJ,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC/C,iDAAiD;IACjD,MAAM,CAAC,cAAc,CACnB,qBAAqB,EACrB;QACE,KAAK,EAAE,qBAAqB;QAC5B,WAAW,EACT,+FAA+F;QACjG,UAAU,EAAE;YACV,WAAW,EAAE,CAAC;iBACX,MAAM,EAAE;iBACR,QAAQ,CACP,8GAA8G,CAC/G;YACH,SAAS,EAAE,CAAC;iBACT,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CACP,yFAAyF,CAC1F;SACJ;KACF,EACD,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,EAAE;QAC7B,MAAM,GAAG,GAAG,SAAS,EAAE,IAAI,EAAE,IAAI,WAAW,CAAC;QAC7C,OAAO,WAAW,CAChB,oDAAoD,GAAG,MAAM,WAAW;;;;6FAIa,GAAG;;0FAEN,CACnF,CAAC;IACJ,CAAC,CACF,CAAC;IAEF,+CAA+C;IAC/C,MAAM,CAAC,cAAc,CACnB,oBAAoB,EACpB;QACE,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EACT,0GAA0G;QAC5G,UAAU,EAAE;YACV,UAAU,EAAE,CAAC;iBACV,MAAM,EAAE;iBACR,QAAQ,CAAC,uEAAuE,CAAC;SACrF;KACF,EACD,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CACjB,WAAW,CACT,8CAA8C,UAAU;;;;;;;iJAOiF,CAC1I,CACJ,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,6EAA6E;AAC7E,SAAS,WAAW,CAAC,IAAY;IAC/B,OAAO;QACL,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAe;gBACrB,OAAO,EAAE,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE;aACzC;SACF;KACF,CAAC;AACJ,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC/C,iDAAiD;IACjD,MAAM,CAAC,cAAc,CACnB,qBAAqB,EACrB;QACE,KAAK,EAAE,qBAAqB;QAC5B,WAAW,EACT,+FAA+F;QACjG,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC;YACnB,WAAW,EAAE,CAAC;iBACX,MAAM,EAAE;iBACR,QAAQ,CACP,8GAA8G,CAC/G;YACH,SAAS,EAAE,CAAC;iBACT,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CACP,yFAAyF,CAC1F;SACJ,CAAC;KACH,EACD,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,EAAE;QAC7B,MAAM,GAAG,GAAG,SAAS,EAAE,IAAI,EAAE,IAAI,WAAW,CAAC;QAC7C,OAAO,WAAW,CAChB,oDAAoD,GAAG,MAAM,WAAW;;;;6FAIa,GAAG;;0FAEN,CACnF,CAAC;IACJ,CAAC,CACF,CAAC;IAEF,+CAA+C;IAC/C,MAAM,CAAC,cAAc,CACnB,oBAAoB,EACpB;QACE,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EACT,0GAA0G;QAC5G,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC;YACnB,UAAU,EAAE,CAAC;iBACV,MAAM,EAAE;iBACR,QAAQ,CAAC,uEAAuE,CAAC;SACrF,CAAC;KACH,EACD,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CACjB,WAAW,CACT,8CAA8C,UAAU;;;;;;;iJAOiF,CAC1I,CACJ,CAAC;AACJ,CAAC"}
@@ -6,7 +6,7 @@
6
6
  * codes, biome codes — without guessing or spending a tool round-trip. Each is
7
7
  * a static `ibge://catalogos/...` resource returning JSON.
8
8
  */
9
- import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
9
+ import type { McpServer } from "@modelcontextprotocol/server";
10
10
  /** Registers all reference-catalog resources on the server. */
11
11
  export declare function registerResources(server: McpServer): void;
12
12
  //# sourceMappingURL=resources.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../src/resources.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAwFzE,+DAA+D;AAC/D,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAmEzD"}
1
+ {"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../src/resources.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAwF9D,+DAA+D;AAC/D,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAmEzD"}
package/dist/server.d.ts CHANGED
@@ -1,6 +1,14 @@
1
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
1
+ import { McpServer } from "@modelcontextprotocol/server";
2
2
  export declare const SERVER_NAME = "ibge-br-mcp";
3
- export declare const SERVER_VERSION = "3.0.2";
3
+ export declare const SERVER_VERSION: string;
4
+ /**
5
+ * Server instructions sent on the MCP handshake (initialize result). They carry
6
+ * what individual tool descriptions cannot: the disambiguation map across the
7
+ * overlapping tool clusters and the cross-tool guidance for the D2 statistics
8
+ * modes. User-facing → pt-BR (repo convention). Shared verbatim by the STDIO
9
+ * entry (`createServer`) and the Cloudflare Worker (`worker/src/server.ts`).
10
+ */
11
+ export declare const SERVER_INSTRUCTIONS: string;
4
12
  /**
5
13
  * Builds and configures the IBGE MCP Server with all tools, resources, and
6
14
  * prompts registered. Side-effect-free: it does NOT connect a transport, so it
@@ -10,11 +18,19 @@ export declare const SERVER_VERSION = "3.0.2";
10
18
  * Statistics) APIs (health data is served via IBGE's SIDRA).
11
19
  */
12
20
  export declare function createServer(): McpServer;
21
+ /**
22
+ * Optional per-tool usage hook: called with `tool_call` on every invocation and
23
+ * additionally with `tool_error` when the call fails (error result or throw).
24
+ * The STDIO entry passes nothing; the Cloudflare Worker passes its Durable
25
+ * Object recorder (fire-and-forget telemetry — names and counts only, never
26
+ * tool arguments or results).
27
+ */
28
+ export type ToolUsageRecorder = (kind: "tool_call" | "tool_error", name: string) => void;
13
29
  /**
14
30
  * Registers every tool, resource, and prompt onto a given `McpServer`. Kept
15
31
  * separate from `createServer` so an alternative transport (e.g. the Cloudflare
16
32
  * Worker in `worker/`, which builds its own `McpServer` with hosted metadata)
17
33
  * can reuse the exact same registrations.
18
34
  */
19
- export declare function registerAll(server: McpServer): void;
35
+ export declare function registerAll(server: McpServer, record?: ToolUsageRecorder): void;
20
36
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAkFpE,eAAO,MAAM,WAAW,gBAAgB,CAAC;AACzC,eAAO,MAAM,cAAc,UAAU,CAAC;AAgBtC;;;;;;;GAOG;AACH,wBAAgB,YAAY,IAAI,SAAS,CAOxC;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAg0BnD"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAwB,MAAM,8BAA8B,CAAC;AAoF/E,eAAO,MAAM,WAAW,gBAAgB,CAAC;AACzC,eAAO,MAAM,cAAc,QAAc,CAAC;AAE1C;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,QAYpB,CAAC;AAgBb;;;;;;;GAOG;AACH,wBAAgB,YAAY,IAAI,SAAS,CAUxC;AAED;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,WAAW,GAAG,YAAY,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;AAEzF;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAk0B/E"}