Skip to main content

mcp-inegi

Servidor MCP para que cualquier asistente de IA (Claude, ChatGPT, Gemini, Cursor o un modelo local) consulte indicadores oficiales del INEGI y conteste citando la fuente: población, inflación, empleo, PIB e IGAE, a nivel nacional, estatal y, para datos censales, municipal.

Forma parte de Itzamná, una familia de servidores MCP de código abierto sobre los datos públicos de México. Proyecto independiente, sin afiliación con el INEGI.

Qué puedes preguntarle

  • ¿Cuál fue la inflación anual de septiembre? → 3.45 % (INPC, indicador 910406, periodo 2026/09)
  • ¿Cuánta gente vive en Naucalpan? → 834,434 personas (Censo 2020, municipio 15057)
  • ¿Qué estados tienen más población desocupada? → compara las 32 entidades con la ENOE
  • ¿Cómo va el PIB? → variación anual, PIB real en millones de pesos de 2018 e IGAE mensual

Cada respuesta trae el ID del indicador, el periodo, la unidad, la fuente oficial y la fecha de última actualización, para que cualquiera la pueda verificar.

Herramientas

Herramienta Qué hace
indicadores_clave Catálogo de indicadores verificados, con su ID y cobertura geográfica
consultar_indicador Último valor o serie de un indicador para el país, un estado o un municipio
comparar_areas El mismo indicador en varios estados o municipios, ordenado de mayor a menor
buscar_municipio Clave de un municipio o alcaldía por nombre, sin importar acentos
metadatos_indicador Nombre oficial, unidad, frecuencia, fuente y periodo cubierto

consultar_indicador acepta las claves del catálogo (INFLACION_ANUAL, POBLACION_TOTAL, TASA_DESOCUPACION, PIB_REAL, IGAE…) o cualquier ID numérico del Banco de Indicadores. Las áreas se pueden dar por nombre o por clave: estados (Jalisco, CDMX, 14) y los 2,478 municipios y alcaldías (Naucalpan, Juárez, Chihuahua, 15057). Si un nombre existe en varios estados, como Benito Juárez, el servidor devuelve los candidatos en lugar de adivinar.

Instalación

  1. Pide tu token gratuito en el INEGI.
  2. Verifica la conexión:
export INEGI_TOKEN="tu_token"
uvx mcp-inegi --test
  1. Agrégalo a tu cliente MCP. En Claude Desktop (claude_desktop_config.json):
{
  "mcpServers": {
    "inegi": {
      "command": "uvx",
      "args": ["mcp-inegi"],
      "env": { "INEGI_TOKEN": "tu_token" }
    }
  }
}

En Claude Code:

claude mcp add inegi -e INEGI_TOKEN=tu_token -- uvx mcp-inegi

Servidor remoto

mcp-inegi --transport streamable-http --host 127.0.0.1 --port 8000 --allowed-host tu.dominio

Detrás de un proxy inverso, --allowed-host declara el nombre público para la protección contra DNS rebinding.

Notas sobre la API del INEGI

Cosas que descubrimos al construirlo (octubre de 2026) y que el servidor ya resuelve por ti:

  • El banco económico se llama BIE-BISE; con BIE a secas la API responde que no hay resultados.
  • Se pide siempre la serie completa: con reciente=true la API falla en municipios cuando el periodo nacional más nuevo (p. ej. 2025) no existe a ese nivel.
  • El token va en la URL, así que el servidor silencia los logs de httpx para no filtrarlo.
  • El catálogo de municipios viene incluido en el paquete (scripts/generar_municipios.py lo regenera desde el Marco Geoestadístico).
  • Las respuestas se guardan en caché una hora (INEGI_CACHE_TTL, en segundos).

Desarrollo

uv venv && uv pip install -e ".[dev]"
pytest
ruff check .

Licencia MIT.

Metadata

Release files for mcp-inegi 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-inegi 0.1.0
File Size Uploaded Provenance
mcp_inegi-0.1.0.tar.gz 44.4 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-inegi 0.1.0
File Interpreter ABI Platform
mcp_inegi-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 85.1 kB

Release files / mcp_inegi-0.1.0.tar.gz

Download URL mcp_inegi-0.1.0.tar.gz
Size 44.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c2d6409f02bb063b202ccb5f5dc50e265152752c1efca645cd107de4b41294b0
BLAKE2b-256 checksum
How to use checksums
f84f227dc8fbe9d6fddd8abcae037ce4d32302d026282f1396c3f759ab374fe1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / mcp_inegi-0.1.0-py3-none-any.whl

Download URL mcp_inegi-0.1.0-py3-none-any.whl
Size 40.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
16ef9d3ceee62cb7a1a4b18b245948c6fd049c0210416f0ddf2a016ec37a8f7b
BLAKE2b-256 checksum
How to use checksums
38e81c55e60ad4a4cc2d7a39fba0903fb6d2dfa83dc495df45393fd9e4d5ecfe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Security for mcp-inegi 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mcp_inegi-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page