BCRP MCP
Servidor Model Context Protocol (MCP) para consultar BCRPData, la base oficial de estadísticas económicas del Banco Central de Reserva del Perú (BCRP).
Permite a clientes MCP y agentes de IA consultar tipos de cambio, tasas de interés, reservas internacionales, liquidez, crédito, commodities, bolsa y PBI. La API del BCRP es pública: no se necesita API key ni registro.
Instalación rápida
Se requiere Python 3.11 o posterior.
Con uvx (recomendado para clientes MCP)
uvx bcrp-mcp
Con pip
python -m pip install bcrp-mcp
bcrp-mcp
La instalación también proporciona el CLI bcrp:
bcrp --help
bcrp catalog search "tipo de cambio"
bcrp series latest PD04637PD --n 5
Desde el código fuente
git clone https://github.com/JOSETRA44/BCRP-mcp.git
cd BCRP-mcp
uv sync
uv run bcrp-mcp
Configuración en clientes MCP
El servidor usa transporte stdio. Con uvx, la configuración es la misma en
Claude Desktop, Claude Code, Cursor y otros clientes compatibles:
{
"mcpServers": {
"bcrp": {
"command": "uvx",
"args": ["bcrp-mcp"]
}
}
}
En VS Code + GitHub Copilot (.vscode/mcp.json):
{
"servers": {
"bcrp": {
"type": "stdio",
"command": "uvx",
"args": ["bcrp-mcp"]
}
}
}
Herramientas MCP
| Herramienta | Uso |
|---|---|
bcrp_get_series |
Obtiene 1–10 series con un rango opcional; deben compartir frecuencia. |
bcrp_get_latest |
Obtiene los últimos valores de 1–10 series. |
bcrp_get_series_long |
Exporta hasta 50 series en una tabla larga, incluso con frecuencias mixtas. |
bcrp_describe_series |
Consulta nombre, frecuencia y rango disponible de una serie. |
bcrp_search_catalog |
Busca códigos en el catálogo curado de indicadores. |
bcrp_list_catalog_categories |
Lista las categorías disponibles. |
bcrp_get_macro_snapshot |
Devuelve un resumen de indicadores macroeconómicos clave. |
Ejemplos de preguntas:
¿Cuál es el tipo de cambio actual en Perú?
Compara la tasa de referencia y las reservas internacionales desde 2020.
Obtén un snapshot de los principales indicadores de la economía peruana.
CLI
El comando bcrp usa la misma lógica que el servidor MCP y admite salida para
terminal o automatización:
bcrp series describe PD04637PD
bcrp series latest PD04637PD PD12301MD --n 5
bcrp series get PN00196MM --start 2020-1 --end 2024-12
bcrp catalog categories
bcrp macro snapshot
Opciones útiles:
bcrp series latest PD04637PD --n 5 --json
bcrp series latest PD04637PD --n 5 --ascii --no-color
Los formatos de período dependen de la frecuencia: diario
DD-MM-YYYY, mensual YYYY-M, trimestral YYYY-Q y anual YYYY.
Las series de una misma consulta deben tener la misma frecuencia, salvo
bcrp_get_series_long.
Configuración opcional
Todos los valores tienen valores predeterminados razonables y pueden definirse
con variables de entorno o un archivo .env:
| Variable | Predeterminado | Descripción |
|---|---|---|
BCRP_CACHE_TTL |
300 |
Duración de la caché en segundos; 0 la desactiva. |
BCRP_TIMEOUT |
30 |
Timeout HTTP en segundos. |
BCRP_MAX_RETRIES |
3 |
Reintentos ante errores transitorios. |
BCRP_LANGUAGE |
esp |
Idioma de nombres: esp o ing. |
LOG_LEVEL |
INFO |
Nivel de logging. |
No se configura ninguna credencial: BCRPData es de acceso abierto.
Desarrollo
uv sync
uv run pytest -q
uv run python -m build
El proyecto usa src/ layout, Hatchling para construir el paquete y publica
dos entry points: bcrp-mcp (servidor) y bcrp (CLI).
Publicación
Las versiones se publican mediante GitHub Actions al crear un release de
GitHub. El workflow .github/workflows/publish.yml ejecuta las pruebas,
construye los artefactos y publica en PyPI usando Trusted Publishing (OIDC);
no requiere un token de PyPI almacenado en secretos.
Datos y licencia
Los datos provienen de BCRPData. Consulte sus condiciones de uso.
MIT — consulte LICENSE.
Documentación del proyecto
- CHANGELOG.md: historial de cambios.
- CONTRIBUTING.md: guía para contribuir.
- SECURITY.md: reporte de vulnerabilidades.
- server.json: metadatos para el registro MCP.
Metadata
Release files for bcrp-mcp 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bcrp_mcp-0.1.0.tar.gz | 76.6 kB | With provenance | Details for bcrp_mcp-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bcrp_mcp-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for bcrp_mcp-0.1.0-py3-none-any.whl |
Total release size: 134.2 kB
Release files / bcrp_mcp-0.1.0.tar.gz
| Download URL | bcrp_mcp-0.1.0.tar.gz |
|---|---|
| Size | 76.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ee0d98f42f03f4eeb255340bfe30da340a39b5d30a0318eaa3c982fc87adcd63
|
|
BLAKE2b-256 checksum How to use checksums |
b196c2e4101020592d2aafb4281df0a8fe954b994bb4f62619fce1a434d9ffaa
|
| 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 Nov 4, 2026.
Transparency logRelease files / bcrp_mcp-0.1.0-py3-none-any.whl
| Download URL | bcrp_mcp-0.1.0-py3-none-any.whl |
|---|---|
| Size | 57.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
621a6a9467512254784fc8aa6b5a8710ae5ba52b84c3ea3df14e23e99a52ad1f
|
|
BLAKE2b-256 checksum How to use checksums |
d568fa8dae10fc4f7972bc8518a278b3c1798798220395cf2915701ce194e865
|
| 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 Nov 4, 2026.
Transparency logSecurity for bcrp-mcp 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.
Attestation for bcrp_mcp-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 Nov 4, 2026.
Transparency logA 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.