ibge-microdata-mcp
The ibge-microdata-mcp server is a local-first MCP server for discovering, downloading, converting, querying, and analyzing official Brazilian IBGE public microdata (e.g., PNAD Contínua, POF) using DuckDB and Parquet — no hosted database required.
Survey Discovery & Navigation
List supported survey families, browse/crawl
ftp.ibge.gov.brdirectories, list official download files, and check connectivity to IBGE endpoints
File Inspection & Downloading
Inspect file metadata (size, type, ETag) before downloading; download files to a local cache with automatic cache-hit detection, SHA-256 integrity checks, and HTTPS/HTTP fallback
Cache Management
List, paginate, and selectively clean up cached files by age, size, or URL prefix, with mandatory dry-run preview
Archive & Layout Handling
List ZIP entries and extract individual files without unpacking entire archives; parse official IBGE SAS/TXT fixed-width layouts (variable names, positions, widths, types, descriptions)
Metadata Inventory & Search
Inventory metadata from documentation ZIPs (SAS/TXT layouts, Excel dictionaries, plain-text tables); search variables by name or description; export Base dos Dados–style architecture CSV (variables) and dictionary CSV (value labels)
Data Conversion to Parquet
Convert fixed-width TXT files (from disk or inside ZIPs) to Parquet using official layouts, with optional column selection and row limits; POF-specific conversion with implied decimal scaling
Querying & Analysis
Run read-only DuckDB SQL (SELECT/WITH) over single or multiple named Parquet views; describe/profile views (schema, row counts, nulls, numeric ranges, frequent values, sample rows); compute weighted totals, means, group shares, and top-bracket shares (e.g., top 1%) with proportional tie-breaking
Harmonization Recipes
Validate and apply versioned JSON recipes that declare required views, SQL transformations, and validation checks to produce derived Parquet output
Survey-Specific Helpers
POF: parse Excel dictionaries, map record sheets to ZIP entries
PNAD Contínua: analyze predefined variable sets from TXT/ZIP files; R-backed downloads via
PNADcIBGEordatazoom.social; check local R environment status
Enables querying local IBGE microdata Parquet files using DuckDB SQL, allowing for efficient read-only queries and weighted distribution calculations.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ibge-microdata-mcp list files for the POF survey"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
IBGE Microdata MCP Server
Local-first MCP server for discovering, downloading, unpacking, converting, querying, and analyzing official public IBGE microdata.
This project does not host IBGE datasets. It uses IBGE download servers as the source of truth, downloads only files explicitly requested by the user, mirrors them into a local cache, and runs analysis on local files.
IBGE's raw public download host is ftp.ibge.gov.br. The server accepts both https:// and http:// URLs for that host. It tries to keep official HTTPS URLs where possible, but can fall back to official HTTP for public files when HTTPS is slow or unavailable. Tool output reports the resolved URL, transport used, and SHA-256 hash after download.
Why Local-First
IBGE microdata files are public, but many are large enough that an MCP server should not return them directly in chat responses. The practical workflow is:
discover official files -> inspect size -> download selected archive -> inspect/extract entries -> convert selected variables to Parquet -> query with DuckDBIn plain terms:
DuckDB is a local analytical SQL engine. It can query large local files without running a database server.
Parquet is a compressed columnar file format. Convert fixed-width TXT microdata once, then query only the columns you need.
Related MCP server: recife-open-data-mcp
Core Generic Tools
Tool | Purpose |
| List survey families with convenience support. |
| Check whether this machine can reach IBGE download/API endpoints over HTTPS and HTTP. |
| List known public archive files for supported survey families. |
| List any official |
| Bounded crawl of official IBGE directories to find microdata, data, documentation, and layout files. |
| Bounded crawl focused on likely dictionary, layout, input, codebook, and documentation files. |
| Read file size, type, update timestamp, and validators with HTTP HEAD. |
| Download or reuse one official IBGE file in a local cache. |
| List files already downloaded into a local cache with URLs, paths, sizes, and timestamps. |
| Preview or delete selected cached files using safe filters. |
| List files inside a local ZIP archive without extracting all of it. |
| Extract one selected ZIP entry to a local path. |
| Parse a local IBGE fixed-width input layout and search variables. |
| Parse local dictionaries/layouts or documentation ZIPs into records, variables, positions, types, and value labels. |
| Search local official metadata for variable names, descriptions, and parsed value labels/categories. |
| Export parsed official metadata to a local Base dos Dados-style architecture CSV. |
| Export parsed official value labels/categories to a local Base dos Dados-style |
| Convert a fixed-width TXT file plus official layout into a local Parquet file. |
| Convert one fixed-width TXT entry inside a ZIP directly into local Parquet. |
| Run bounded read-only DuckDB SQL over local Parquet files exposed as |
| Run bounded read-only DuckDB SQL over multiple named Parquet views for joins. |
| Calculate weighted totals, means, group shares, and top-bracket shares over local Parquet views. |
| Inspect schemas, row counts, and sample rows for named Parquet views. |
| Profile local Parquet views with row counts, null counts, numeric ranges, frequent values, and samples. |
| Validate a versioned JSON harmonization recipe without writing output. |
| Apply a versioned JSON harmonization recipe and write a derived Parquet file. |
The generic path is discovery, caching, official metadata inspection/search, Parquet conversion, profiling, and DuckDB querying. These tools are the main public surface of the server.
Optional Survey-Specific Helpers
These helpers are layered on top of the same local-first workflow. They are useful shortcuts for known IBGE formats, but they are not required for the generic workflow.
Tool | Purpose |
| Parse a POF Excel dictionary and map record sheets to data ZIP entries. |
| Convert one POF record from a Dados ZIP to Parquet using the POF dictionary. |
| PNAD Contínua convenience summary over an extracted fixed-width TXT file. |
| PNAD Contínua convenience summary directly over a TXT entry inside a ZIP. |
| Check local |
| Use |
| Use |
Prerequisites
This MCP is a local tool. Users are expected to have:
Node.js 18.20 or newer.
pnpm.
R with
Rscriptavailable onPATH.
R is included as a project prerequisite because PNAD Contínua and Data Zoom workflows are best supported by the existing Brazilian R ecosystem. The MCP server itself still runs as a Node/TypeScript process and returns MCP-friendly JSON, Markdown, and local file paths.
Install
Install system runtimes.
On macOS with Homebrew:
brew install node r
npm install -g pnpm@11.7.0On Windows with winget:
winget install OpenJS.NodeJS
winget install RProject.R
npm install -g pnpm@11.7.0On Ubuntu/Debian:
sudo apt update
sudo apt install -y nodejs npm r-base
sudo npm install -g pnpm@11.7.0Linux package managers sometimes ship older Node.js versions. If node --version is below 18.20, install a newer Node.js release from NodeSource, nvm, or the official Node.js installer.
You can also install the same tools from their official installers:
Check that all three are available:
node --version
pnpm --version
Rscript --versionClone the GitHub repository:
git clone https://github.com/emmanueltsallis/ibge-microdata-mcp.git
cd ibge-microdata-mcpInstall Node dependencies and build the local MCP server:
pnpm install
pnpm run buildInstall the baseline R packages used by the R-backed IBGE workflows:
Rscript -e 'install.packages(c("PNADcIBGE", "survey", "jsonlite", "arrow"), repos = "https://cloud.r-project.org")'
Rscript -e 'install.packages("datazoom.social", repos = c("https://datazoompuc.r-universe.dev", "https://cloud.r-project.org"))'Run
node dist/index.jsGeneric MCP Client Setup
Any MCP client that supports stdio can run this server. After cloning, installing dependencies, and running pnpm run build, configure your client to start the built Node entrypoint.
Use an absolute path to dist/index.js in client configuration. Most clients use the same basic shape:
{
"mcpServers": {
"ibge-microdata": {
"command": "node",
"args": ["/absolute/path/to/ibge-microdata-mcp/dist/index.js"]
}
}
}If your client uses TOML or another config format, the same idea applies: command is the Node executable, and args contains the absolute path to this server's built dist/index.js file.
Most MCP clients start configured servers when the app or session starts, so restart or reload the client after changing MCP configuration. If the tools do not appear immediately, restart the client first before debugging the server.
MCP uses stdout for protocol messages. This server writes startup and fatal logs to stderr, which keeps stdio protocol traffic clean for clients.
You can smoke-test the server independently of any specific client:
node --input-type=module - <<'NODE'
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
const transport = new StdioClientTransport({
command: 'node',
args: ['/absolute/path/to/ibge-microdata-mcp/dist/index.js'],
});
const client = new Client({ name: 'ibge-microdata-smoke', version: '0.0.0' });
await client.connect(transport);
const tools = await client.listTools();
console.log(tools.tools.map((tool) => tool.name).sort().join('\n'));
await client.close();
NODEThe smoke test should list tools such as ibge_microdata_list_surveys, ibge_microdata_metadata_inventory, and ibge_microdata_fixed_width_zip_to_parquet.
For a shorter generic walkthrough, see examples/generic-workflow.md. For a starter harmonization recipe, see examples/harmonization-recipe.json. For external harmonization sources that can inform recipes, see docs/harmonization-sources.md.
R-Backed PNADc Workflow
Use the R status tool first:
ibge_microdata_r_status({})Download PNAD Contínua through PNADcIBGE and write a Parquet file that the MCP can query with DuckDB:
ibge_microdata_pnadc_r_download({
"year": 2024,
"quarter": 4,
"vars": ["UF", "V1028"],
"outputPath": "/Users/you/.cache/ibge-microdata-mcp/converted/pnadc_2024q4.parquet"
})Use datazoom.social when you want Data Zoom's PNAD Contínua processing or panel identifiers:
ibge_microdata_datazoom_pnadc_load({
"outputDir": "/Users/you/.cache/ibge-microdata-mcp/datazoom/pnadc",
"years": [2024],
"quarters": [1, 2, 3, 4],
"panel": "basic",
"outputFormat": "parquet"
})Generic Workflow
Find public files from a known survey family or an official directory:
ibge_microdata_list_surveys({})ibge_microdata_connectivity_check({})ibge_microdata_list_files({
"survey": "pof"
})ibge_microdata_discover({
"rootUrl": "https://ftp.ibge.gov.br/",
"maxDepth": 3,
"maxDirectories": 50
})ibge_microdata_discover_metadata({
"rootUrl": "https://ftp.ibge.gov.br/",
"maxDepth": 4,
"maxDirectories": 100
})Inspect file metadata before downloading:
ibge_microdata_file_info({
"url": "https://ftp.ibge.gov.br/path/to/public/archive.zip"
})Download to a local cache:
ibge_microdata_download_file({
"url": "https://ftp.ibge.gov.br/path/to/public/archive.zip",
"cacheRoot": "/Users/you/.cache/ibge-microdata-mcp"
})The downloader mirrors the official ftp.ibge.gov.br path under cacheRoot. On repeated calls, it checks IBGE content-length metadata first and returns a cache hit when the existing local file has the expected byte size.
If HTTPS to ftp.ibge.gov.br times out, the downloader may retry the same public file over http://ftp.ibge.gov.br. This does not send credentials or private data; it only downloads public IBGE files. The response reports transport, usedFallback, and sha256 so the transfer remains auditable in headless MCP use.
List the cache later if you need to rediscover local paths:
ibge_microdata_list_cache({
"cacheRoot": "/Users/you/.cache/ibge-microdata-mcp",
"limit": 50,
"offset": 0
})Preview cache cleanup when storage grows:
ibge_microdata_cleanup_cache({
"cacheRoot": "/Users/you/.cache/ibge-microdata-mcp",
"dryRun": true,
"olderThanDays": 30,
"minBytes": 100000000
})The cleanup tool defaults to dryRun: true, requires at least one filter, and only considers files under cacheRoot/ftp.ibge.gov.br. Set dryRun: false only after reviewing the preview.
Inspect archive contents:
ibge_microdata_zip_entries({
"zipPath": "/Users/you/.cache/ibge-microdata-mcp/ftp.ibge.gov.br/path/to/public/archive.zip"
})Inventory official metadata and search variables:
ibge_microdata_metadata_inventory({
"zipPaths": ["/Users/you/.cache/ibge-microdata-mcp/ftp.ibge.gov.br/path/to/public/documentation.zip"],
"search": "weight",
"variableLimit": 50
})ibge_microdata_search_variables({
"zipPaths": ["/Users/you/.cache/ibge-microdata-mcp/ftp.ibge.gov.br/path/to/public/documentation.zip"],
"query": "rendimento",
"limit": 50
})The metadata tools parse official SAS/TXT input layouts, POF-style Excel dictionaries, generic Excel dictionary tables, and plain-text dictionary tables with recognizable position/width/variable columns. When available, they return value labels/categories such as state codes or response categories. If a file cannot be parsed, the inventory reports which parser attempts were tried.
Export Base dos Dados-style local documentation CSVs when you want portable metadata files:
ibge_microdata_export_architecture_csv({
"zipPaths": ["/Users/you/.cache/ibge-microdata-mcp/ftp.ibge.gov.br/path/to/public/documentation.zip"],
"outputPath": "/Users/you/.cache/ibge-microdata-mcp/extra/architecture/variables.csv"
})ibge_microdata_export_dictionary_csv({
"zipPaths": ["/Users/you/.cache/ibge-microdata-mcp/ftp.ibge.gov.br/path/to/public/documentation.zip"],
"outputPath": "/Users/you/.cache/ibge-microdata-mcp/extra/dicionario.csv"
})The architecture export writes one row per parsed variable. The dictionary export writes one row per parsed category/code label. These are local documentation artifacts inspired by Base dos Dados workflows; they do not upload anything to BigQuery and do not require Base dos Dados credentials.
Inspect a fixed-width layout directly when you already have the layout file:
ibge_microdata_inspect_layout({
"layoutPath": "/path/to/official-input-layout.txt",
"search": "weight",
"limit": 50
})Convert selected variables to Parquet:
ibge_microdata_fixed_width_zip_to_parquet({
"layoutPath": "/path/to/official-input-layout.txt",
"zipPath": "/Users/you/.cache/ibge-microdata-mcp/ftp.ibge.gov.br/path/to/public/archive.zip",
"entryName": "MICRODATA.txt",
"outputPath": "/Users/you/.cache/ibge-microdata-mcp/converted/sample.parquet",
"selectedVariables": ["record_id", "region", "sample_weight", "target_value"]
})Profile the Parquet file before writing custom SQL:
ibge_microdata_profile_parquet_views({
"views": [
{
"name": "microdata",
"parquetPaths": ["/Users/you/.cache/ibge-microdata-mcp/converted/sample.parquet"]
}
],
"columns": ["region", "sample_weight", "target_value"],
"topK": 10,
"sampleRows": 3
})If columns is omitted, the tool profiles the first 25 columns by default. This keeps wide microdata files manageable while still giving enough information to choose variables and write queries.
Query the Parquet file with DuckDB:
ibge_microdata_query_parquet({
"parquetPaths": ["/Users/you/.cache/ibge-microdata-mcp/converted/sample.parquet"],
"sql": "select region, sum(sample_weight * target_value) / sum(sample_weight) as weighted_mean from microdata group by region order by region",
"maxRows": 100
})The query tools accept only SELECT or WITH queries, reject semicolons and write-oriented keywords, and cap returned rows.
Harmonization Recipes
Recipes are optional JSON files that make harmonization assumptions explicit and reusable. The MCP does not ship one universal harmonization standard; instead, a recipe declares the required input views/columns, an output SELECT transformation, optional source references, and validation checks.
ibge_microdata_validate_recipe({
"recipePath": "/path/to/harmonization-recipe.json",
"views": [
{
"name": "microdata",
"parquetPaths": ["/Users/you/.cache/ibge-microdata-mcp/converted/sample.parquet"]
}
],
"sampleRows": 5
})If the validation output says requirements and validations passed, write the harmonized Parquet file:
ibge_microdata_apply_recipe({
"recipePath": "/path/to/harmonization-recipe.json",
"views": [
{
"name": "microdata",
"parquetPaths": ["/Users/you/.cache/ibge-microdata-mcp/converted/sample.parquet"]
}
],
"outputPath": "/Users/you/.cache/ibge-microdata-mcp/converted/harmonized.parquet",
"sampleRows": 5
})Recipe SQL accepts only SELECT or WITH statements. The validation tool reports missing input columns, output schema, sample output rows, and validation results without writing a file. The apply tool writes the harmonized output only when requirements and validations pass.
Weighted Distributions
Use ibge_microdata_weighted_distribution when a Parquet file contains one row per analytical unit, a numeric value column, and a numeric survey/sample weight column:
ibge_microdata_weighted_distribution({
"views": [
{
"name": "microdata",
"parquetPaths": ["/Users/you/.cache/ibge-microdata-mcp/converted/sample.parquet"]
}
],
"unitSql": "select region, target_value as value, sample_weight as weight from microdata",
"valueColumn": "value",
"weightColumn": "weight",
"groupColumn": "region",
"topPercents": [0.01, 0.05, 0.1]
})The tool ranks units by the value column, applies weights, reports total weight, total value, weighted mean, optional group shares, and top-bracket shares. If a top bracket cuts through tied values at the cutoff, the tied bucket is allocated proportionally.
Relational Records
Some surveys publish multiple record files. Convert each record to Parquet, inspect the resulting schemas, then join named views:
ibge_microdata_describe_parquet_views({
"views": [
{
"name": "record_a",
"parquetPaths": ["/Users/you/.cache/ibge-microdata-mcp/converted/record_a.parquet"]
},
{
"name": "record_b",
"parquetPaths": ["/Users/you/.cache/ibge-microdata-mcp/converted/record_b.parquet"]
}
],
"includeRowCounts": true,
"sampleRows": 3
})ibge_microdata_query_parquet_views({
"views": [
{
"name": "record_a",
"parquetPaths": ["/Users/you/.cache/ibge-microdata-mcp/converted/record_a.parquet"]
},
{
"name": "record_b",
"parquetPaths": ["/Users/you/.cache/ibge-microdata-mcp/converted/record_b.parquet"]
}
],
"sql": "select a.region, count(*) as rows from record_a a join record_b b using (record_id) group by a.region order by a.region",
"maxRows": 100
})POF Dictionaries
POF editions use Excel dictionary workbooks. Use the manifest tool to map dictionary sheets to TXT entries before converting records:
ibge_microdata_pof_manifest({
"dictionaryPath": "/path/to/dictionary.xls",
"dataZipPath": "/Users/you/.cache/ibge-microdata-mcp/ftp.ibge.gov.br/path/to/Dados.zip",
"search": "weight",
"variableLimit": 20
})ibge_microdata_pof_zip_record_to_parquet({
"dictionaryPath": "/path/to/dictionary.xls",
"zipPath": "/Users/you/.cache/ibge-microdata-mcp/ftp.ibge.gov.br/path/to/Dados.zip",
"recordName": "Domicílio",
"outputPath": "/Users/you/.cache/ibge-microdata-mcp/converted/pof_record.parquet",
"selectedVariables": ["UF", "ESTRATO_POF", "TIPO_SITUACAO_REG"]
})The POF converter applies implied decimal scaling from the dictionary and writes DuckDB-queryable Parquet files.
Tests
Offline unit tests:
pnpm testLive smoke tests against official IBGE endpoints:
RUN_IBGE_SMOKE=1 pnpm test -- tests/smoke.test.tsSmoke tests list official directories, read HEAD metadata, and download the smaller POF documentation ZIP to verify dictionary parsing. They do not download large microdata data ZIPs.
Local R setup smoke test:
RUN_R_SMOKE=1 pnpm test -- tests/r-smoke.test.tsThe R smoke test checks Rscript and baseline R package availability. It does not download PNAD microdata.
Current Limits
This is a local-first MCP server, not a hosted warehouse of all IBGE microdata.
Discovery is deliberately bounded; broad root crawls should use explicit
maxDepthandmaxDirectoriesvalues to avoid excessive requests.Generic fixed-width conversion, official metadata inventory/search, Parquet profiling/querying, weighted distribution summaries, and POF dictionary conversion are implemented.
Metadata parsing supports common IBGE SAS/TXT input layouts, POF-style Excel dictionaries, generic Excel dictionary tables, and generic TXT dictionary tables. PDF-only/prose-only codebooks and highly irregular historical layouts may still need parser adapters.
Additional survey-specific harmonized recipes can be added as optional layers without changing the generic workflow.
License
MIT. See LICENSE.
Available Tools
22 toolsibge_microdata_cleanup_cacheCleanup Local IBGE CacheADestructiveIdempotent
Preview or delete selected files from the local IBGE microdata cache.
The tool only considers files under cacheRoot/ftp.ibge.gov.br and requires at least one filter such as olderThanDays, minBytes, or urlPrefix. It defaults to dryRun=true, so use it first to preview what would be deleted. Set dryRun=false only after the user explicitly agrees to delete the matched cached files.
Inputs: cacheRoot (required), dryRun, minBytes, urlPrefix, +1 more.
ibge_microdata_describe_parquet_viewsDescribe Named Local IBGE Parquet ViewsARead-onlyIdempotent
Inspect local Parquet files as named DuckDB views and return columns, DuckDB types, optional row counts, and optional sample rows.
Use this before writing join queries over POF or other relational microdata records so the agent can see actual column names and types.
Inputs: views (required), sampleRows, includeRowCounts.
ibge_microdata_discoverDiscover Official IBGE Microdata FilesARead-onlyIdempotent
Crawl official ftp.ibge.gov.br directories with strict limits to find public microdata directories, data ZIPs, and documentation/layout files.
Use this when a survey-specific convenience listing is not implemented yet. The tool only fetches directory pages; it does not download microdata archives.
Inputs: rootUrl, maxDepth, maxDirectories, includeDocumentation.
ibge_microdata_download_fileDownload IBGE Microdata FileARead-onlyIdempotent
Download or reuse a selected official IBGE microdata file in a local cache path.
This is explicit and local-first: the tool mirrors the ftp.ibge.gov.br URL under cacheRoot, checks official HEAD content-length metadata, and skips re-downloading when a cached file has the expected byte size. Use ibge_microdata_file_info first for large files so the user understands size before downloading.
Inputs: url (required), cacheRoot (required).
ibge_microdata_extract_zip_entryExtract ZIP EntryARead-onlyIdempotent
Extract one selected file from a local IBGE ZIP archive to a local path.
Use this to pull the PNAD fixed-width TXT file or the official input layout out of a downloaded ZIP without unpacking everything manually.
Inputs: zipPath (required), entryName (required), outputPath (required).
ibge_microdata_file_infoInspect IBGE Microdata FileARead-onlyIdempotent
Fetch HTTP HEAD metadata for an official IBGE microdata file URL.
Use this before downloading a large file to check its size, content type, update timestamp, and ETag.
Inputs: url (required).
ibge_microdata_fixed_width_file_to_parquetConvert Fixed-Width IBGE File to ParquetAIdempotent
Convert a local fixed-width IBGE microdata TXT file into a local Parquet file using an official SAS/TXT input layout.
This is the generic optimization path for repeated analysis: use it for PNAD, POF, or other IBGE microdata families that publish fixed-width TXT files and input layouts. Select only needed variables to keep Parquet files small.
Inputs: dataPath (required), layoutPath (required), outputPath (required), rowLimit, +1 more.
ibge_microdata_fixed_width_zip_to_parquetConvert Fixed-Width IBGE ZIP Entry to ParquetAIdempotent
Convert one fixed-width TXT entry inside a local IBGE ZIP archive into a local Parquet file using an official SAS/TXT input layout.
This avoids extracting the full TXT first, writes a local columnar file, and is useful before running repeated DuckDB queries over selected PNAD, POF, or other IBGE variables.
Inputs: zipPath (required), entryName (required), layoutPath (required), outputPath (required), +2 more.
ibge_microdata_inspect_layoutInspect IBGE Fixed-Width LayoutARead-onlyIdempotent
Parse a local official IBGE SAS/TXT input layout and return variable names, positions, widths, types, and descriptions.
Use this before converting fixed-width microdata to Parquet so you can choose selectedVariables without opening the full dictionary manually.
Inputs: layoutPath (required), limit, search.
ibge_microdata_list_cacheList Local IBGE CacheARead-onlyIdempotent
List files already downloaded into a local IBGE microdata cache.
Use this after one or more ibge_microdata_download_file calls to rediscover local paths, original ftp.ibge.gov.br URLs, byte sizes, and modification timestamps without hitting IBGE again. The tool only reads the local cache and supports limit/offset pagination.
Inputs: cacheRoot (required), limit, offset.
ibge_microdata_list_directoryList Official IBGE DirectoryARead-onlyIdempotent
List downloadable files in any official ftp.ibge.gov.br directory.
Use this for IBGE microdata families that do not yet have a survey-specific convenience tool. It only lists links; it does not download file bodies.
Inputs: url (required).
ibge_microdata_list_filesList IBGE Microdata FilesARead-onlyIdempotent
List official IBGE microdata download files for a supported survey.
For PNAD Contínua quarterly files, pass survey="pnadc_trimestral" and a year such as 2024. For POF, pass survey="pof"; this returns known edition-level public archives for 2017-2018, 2008-2009, and 2002-2003. This tool lists URLs only; it does not download large ZIP files.
Inputs: survey (required), year.
ibge_microdata_list_surveysList IBGE Microdata SurveysARead-onlyIdempotent
List the IBGE microdata families currently supported by this local-first MCP.
Use this first when deciding whether the server can help with PNAD Contínua, POF, or another IBGE microdata source. This tool does not download data.
Inputs: no named parameters.
ibge_microdata_pnadc_analyze_fileAnalyze PNAD Contínua Text FileARead-onlyIdempotent
Analyze an extracted PNAD Contínua fixed-width TXT file using the official SAS/TXT input layout.
This is a PNAD-specific convenience helper for a small predefined set of variables. For custom public workflows, prefer converting selected variables to Parquet and using the generic query or weighted-distribution tools. Use it after downloading/extracting PNAD microdata locally when this predefined summary matches your task.
Inputs: dataPath (required), layoutPath (required), topPercents.
ibge_microdata_pnadc_analyze_zipAnalyze PNAD Contínua ZIP EntryARead-onlyIdempotent
Analyze a PNAD Contínua fixed-width TXT entry directly inside a local ZIP archive.
This is a PNAD-specific convenience helper for a small predefined set of variables and avoids extracting the full microdata TXT first. For custom public workflows, prefer converting selected variables to Parquet and using the generic query or weighted-distribution tools. Use it after downloading a PNAD ZIP and extracting or otherwise providing the official input layout when this predefined summary matches your task.
Inputs: zipPath (required), layoutPath (required), entryName, topPercents.
ibge_microdata_pof_manifestInspect POF Dictionary ManifestARead-onlyIdempotent
Parse the POF Excel variable dictionary and return record sheets, mapped TXT data entries, record lengths, and variable layouts.
Use this after downloading/extracting the POF documentation ZIP to understand which POF record to convert and which variables to select.
Inputs: dictionaryPath (required), search, dataZipPath, variableLimit.
ibge_microdata_pof_zip_record_to_parquetConvert POF ZIP Record to ParquetAIdempotent
Convert one POF fixed-width TXT record inside a local Dados ZIP into Parquet using the POF Excel dictionary workbook.
This is the POF-specific optimized path: it understands POF record sheets, maps them to ZIP entries such as DOMICILIO.txt or RENDIMENTO_TRABALHO.txt, applies implied decimal scaling, and writes a local Parquet file for DuckDB queries.
Inputs: zipPath (required), outputPath (required), recordName (required), dictionaryPath (required), +2 more.
ibge_microdata_profile_parquet_viewsProfile Named Local IBGE Parquet ViewsARead-onlyIdempotent
Profile local Parquet files as named DuckDB views and return bounded exploratory statistics.
Use this after converting IBGE fixed-width microdata to Parquet and before writing custom SQL. The tool reports row counts, column types, null/non-null counts, optional numeric min/max/mean, frequent values, and optional sample rows. By default it profiles the first 25 columns to keep exploration bounded; pass columns for a precise subset.
Inputs: views (required), topK, columns, maxColumns, +1 more.
ibge_microdata_query_parquetQuery Local IBGE ParquetARead-onlyIdempotent
Run a bounded read-only DuckDB SELECT/WITH query over local Parquet files.
The provided files are exposed as a view named microdata. Use this after converting IBGE fixed-width microdata to Parquet when you need repeated summaries, grouped tabulations, or weighted statistics without reparsing the original TXT files.
Inputs: sql (required), parquetPaths (required), maxRows.
ibge_microdata_query_parquet_viewsQuery Named Local IBGE Parquet ViewsARead-onlyIdempotent
Run a bounded read-only DuckDB SELECT/WITH query over multiple named local Parquet views.
Use this for relational microdata workflows, especially POF, where separate records such as domicilio, morador, and rendimento_trabalho should be joined by their shared keys after conversion to Parquet.
Inputs: sql (required), views (required), maxRows.
ibge_microdata_weighted_distributionAnalyze Weighted IBGE DistributionARead-onlyIdempotent
Calculate weighted distribution summaries and top-bracket shares over local IBGE Parquet views.
Use this after converting microdata to Parquet when you need income, consumption, wealth, or other distribution statistics without hand-writing all aggregation SQL. Provide unitSql as a read-only SELECT/WITH query that returns a numeric value column, a numeric weight column, and optionally a group column. The tool ranks units by value, computes total weight/value/mean, group population and value shares, and top brackets such as top 1%, 5%, and 10%. Cutoff ties are allocated proportionally across groups.
Inputs: views (required), unitSql (required), valueColumn (required), weightColumn (required), +3 more.
ibge_microdata_zip_entriesList ZIP EntriesARead-onlyIdempotent
List file entries inside a local IBGE ZIP archive without extracting the archive.
Use this after ibge_microdata_download_file to discover the exact TXT, documentation, or table names inside official IBGE microdata ZIPs.
Inputs: zipPath (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 22 tools
Each tool targets a distinct operation in the IBGE microdata workflow, such as browsing remote directories, downloading files, managing cache, extracting ZIP entries, converting formats, inspecting layouts, and running queries. Overlaps are minimal and clearly differentiated by context (e.g., list_directory vs list_files vs list_cache, or query_parquet vs query_parquet_views).
All tools follow a consistent 'ibge_microdata_action_noun' pattern using snake_case. The naming is predictable, with verbs like cleanup, describe, discover, download, extract, etc., followed by the target object. No mixing of conventions (e.g., camelCase or abbreviations) is observed.
22 tools is slightly above the typical 3-15 range, but the domain (IBGE microdata handling) is complex, covering caching, FTP navigation, multiple survey families (PNAD, POF), conversion to Parquet, and analytical queries. Each tool serves a distinct purpose, so the count feels justified rather than bloated.
The tool set covers the full lifecycle: discovery (list surveys, directories, files), acquisition (file info, download), extraction (ZIP entries, extract entry), inspection (layout, manifest), conversion (fixed-width to Parquet, survey-specific conversions), cache management (list, cleanup), and analysis (profile, query, weighted distribution). No obvious gaps for the stated purpose.
Maintenance
Related MCP Connectors
Query, join, profile, clean and convert CSV/JSON/Parquet with server-side DuckDB over MCP.
MCP server for Brazilian Federal Senate open data (legislative, administrative, e-Cidadania).
An MCP server for search and retrieval over a local LanceDB database
UN FAOSTAT global food & agriculture statistics over a local SQLite mirror, via MCP.
Related MCP Servers
- AlicenseAqualityCmaintenanceAn MCP server for discovering, downloading, querying, and analyzing datasets from Ontario's open data portals, allowing natural language questions and high-performance analytics via DuckDB.231MIT
- AlicenseNot gradedqualityDmaintenanceMCP server to query public open data from Recife, Brazil using natural language. It exposes tools for schema exploration and SQL query generation via Gemini 2.5 Flash, backed by a local DuckDB database.1MIT
- AlicenseNot gradedqualityCmaintenanceMCP server for accessing IBGE (Brazilian Institute of Geography and Statistics) data, enabling natural language queries via the Pipeworx gateway.145 npmMIT
- AlicenseAqualityBmaintenanceExposes official IBGE data as MCP tools, including Brazilian localities, SIDRA statistical aggregates, and population indicators.11MIT