sunat-datos-abiertos-mcp
This server provides access to SUNAT's (Peru's tax authority) open datasets published on Peru's National Open Data Platform (datosabiertos.gob.pe), enabling you to explore and download tax-related data.
List available SUNAT datasets: Retrieve a catalog of all SUNAT datasets (e.g., taxpayer registries, electronic payment receipts, IGV retention/perception agents), including their slugs, titles, and resource counts.
Get dataset details: Given a dataset slug, retrieve its full description and a list of all its resources (files), including each resource's ID needed for further operations.
Get resource metadata and download URL: Given a resource ID, retrieve complete metadata including the direct download URL. Note: the declared format (e.g., CSV) may not always be accurate — some files are ZIP archives containing CSVs.
Preview resource rows: Stream only the beginning of a resource (CSV or CSV inside a ZIP) to return the header and first N rows (up to 200) without downloading the entire file — useful since some files can be hundreds of MB.
Download a resource: Fully download a CSV or ZIP file to disk, returning its file path and size.
All tools cache results locally (configurable TTL, default ~6 hours) to reduce redundant API calls. The server is also usable as a standalone CLI with commands: list, show, resource, preview, download, and cache clear.
Click on "Install 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., "@sunat-datos-abiertos-mcplista los datasets de SUNAT disponibles"
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.
sunat-datos-abiertos-mcp
Servidor MCP (Model Context Protocol) que expone los datasets de SUNAT publicados en la Plataforma Nacional de Datos Abiertos del Perú (padrón RUC con clasificación de actividad económica CIIU, comprobantes de pago electrónicos, agentes de retención/percepción de IGV, etc.).
Requisitos
Node.js 18+
Related MCP server: datagovma-mcp
Instalación
npm install
npm run buildTools disponibles (MCP)
Tool | Descripción |
| Lista los datasets de SUNAT disponibles (slug, título, cantidad de recursos). Cacheado localmente. |
| Detalle y lista de recursos de un dataset dado su slug. Cacheado localmente. |
| Metadata y URL real de descarga de un recurso dado su id. |
| Previsualiza las primeras filas de un recurso (csv suelto o csv dentro de zip) sin descargarlo completo. |
| Descarga el recurso completo (csv o zip) a disco y devuelve la ruta y el tamaño descargado. |
Flujo típico: sunat_listar_datasets → sunat_obtener_dataset (con el dataset elegido) →
sunat_previsualizar_recurso o sunat_descargar_recurso (con el id del recurso elegido).
Caché local
sunat_listar_datasets y sunat_obtener_dataset (y sus equivalentes en la CLI, list/show)
cachean su resultado en disco en ~/.sunat-mcp-cache, ya que el catálogo de SUNAT cambia con poca
frecuencia. El TTL por defecto es 6 horas y se puede ajustar con la variable de entorno
SUNAT_CACHE_TTL_MS (en milisegundos; 0 desactiva la caché). Para limpiarla manualmente:
sunat cache clear.
Nota sobre el portal
La API de este portal es CKAN, pero con dos particularidades verificadas contra la API real:
package_searchyorganization_listestán deshabilitados (devuelven 404); por eso este servidor navega por el grupo de SUNAT (group_package_show) en vez de buscar por palabra clave.package_showygroup_package_showenvuelven su resultado en un array adicional de un solo elemento, a diferencia depackage_list/resource_show. El servidor ya lo maneja.El campo
formatode un recurso no siempre es confiable: varios recursos declarados comocsvson en realidad un.zipque contiene el csv adentro.sunat_previsualizar_recursodetecta esto y descomprime en streaming, cortando la descarga apenas junta las filas pedidas.
Uso con Claude Desktop / Claude Code
Agrega en tu configuración de servidores MCP (claude_desktop_config.json o equivalente):
{
"mcpServers": {
"sunat-datos-abiertos": {
"command": "node",
"args": ["C:\\source\\mcp-sunat\\build\\index.js"]
}
}
}Uso como CLI en terminal
Además del servidor MCP, este paquete instala un comando sunat para usar directamente en la
terminal, sin pasar por un cliente MCP.
npm run build
npm link # instala el comando `sunat` globalmente (symlink al build local)Después de eso, sunat queda disponible desde cualquier carpeta:
sunat list # lista los datasets de SUNAT
sunat show <dataset> # detalle y recursos de un dataset
sunat resource <resource_id> # metadata y URL de un recurso
sunat preview <resource_id> -n 50 # previsualiza filas (default 20)
sunat download <resource_id> -o ./padron.csv # descarga el recurso completo
sunat cache clear # limpia la caché local de datasetsFlags globales:
--json: imprime la respuesta como JSON crudo (útil para scripting/pipes) en vez de tablas.--no-color: desactiva colores en la salida.
Para desinstalar el comando global: npm unlink -g sunat-datos-abiertos-mcp (o el nombre que
muestre npm ls -g --depth=0).
Desarrollo
npm run build # compila TypeScript a build/
npm start # corre el servidor MCP compilado (build/index.js)
node build/cli.js list # corre la CLI sin necesidad de npm linkMaintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityCmaintenanceMCP server for Peruvian public-data lookups including SUNAT RUC registrations, BCRP exchange rates, and SEACE tenders. Provides official open-data access through tools for Claude, Cursor, and other MCP clients.Last updatedMIT
- Alicense-qualityCmaintenanceMCP server for the Moroccan Open Data portal (data.gov.ma) enabling search and retrieval of datasets, resources, organizations, and groups via CKAN API.Last updated1MIT
- AlicenseAqualityDmaintenanceAn MCP server to find and fetch Norwegian open government data from data.norge.no. Enables search, metadata retrieval, and data download.Last updated53MIT
- -license-qualityCmaintenanceMCP server for Peruvian government data, enabling search and anomaly detection in public procurement (OSCE) and legislative tracking (Congress), plus semantic search over both domains.Last updated
Related MCP Connectors
MCP server for Brazilian Federal Senate open data (legislative, administrative, e-Cidadania).
MCP server for live, sourced Brazilian public data from the official IBGE APIs.
This MCP server provides seamless access to Malaysia's government open data, including datasets, w…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/AnderMC66/mcp-sunat'
If you have feedback or need assistance with the MCP directory API, please join our Discord server