bcrp-mcp 0.1.0__tar.gz
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.
- bcrp_mcp-0.1.0/.env.example +5 -0
- bcrp_mcp-0.1.0/.github/workflows/publish.yml +44 -0
- bcrp_mcp-0.1.0/.gitignore +28 -0
- bcrp_mcp-0.1.0/CHANGELOG.md +38 -0
- bcrp_mcp-0.1.0/CONTRIBUTING.md +49 -0
- bcrp_mcp-0.1.0/LICENSE +21 -0
- bcrp_mcp-0.1.0/PKG-INFO +225 -0
- bcrp_mcp-0.1.0/README.md +174 -0
- bcrp_mcp-0.1.0/SECURITY.md +26 -0
- bcrp_mcp-0.1.0/guia.md +262 -0
- bcrp_mcp-0.1.0/inicio.md +93 -0
- bcrp_mcp-0.1.0/npm/bin/install.js +334 -0
- bcrp_mcp-0.1.0/npm/package.json +42 -0
- bcrp_mcp-0.1.0/npm/scripts/stage-skill.js +26 -0
- bcrp_mcp-0.1.0/pyproject.toml +68 -0
- bcrp_mcp-0.1.0/scripts/gen_skill_refs.py +95 -0
- bcrp_mcp-0.1.0/server.json +24 -0
- bcrp_mcp-0.1.0/skills/bcrp/SKILL.md +157 -0
- bcrp_mcp-0.1.0/skills/bcrp/references/api.md +194 -0
- bcrp_mcp-0.1.0/skills/bcrp/references/series-codes.md +158 -0
- bcrp_mcp-0.1.0/src/bcrp_mcp/__init__.py +3 -0
- bcrp_mcp-0.1.0/src/bcrp_mcp/cache.py +202 -0
- bcrp_mcp-0.1.0/src/bcrp_mcp/catalog.py +368 -0
- bcrp_mcp-0.1.0/src/bcrp_mcp/cli/__init__.py +14 -0
- bcrp_mcp-0.1.0/src/bcrp_mcp/cli/app.py +366 -0
- bcrp_mcp-0.1.0/src/bcrp_mcp/cli/commands.py +172 -0
- bcrp_mcp-0.1.0/src/bcrp_mcp/cli/describe.py +156 -0
- bcrp_mcp-0.1.0/src/bcrp_mcp/cli/output.py +265 -0
- bcrp_mcp-0.1.0/src/bcrp_mcp/cli/render.py +282 -0
- bcrp_mcp-0.1.0/src/bcrp_mcp/cli/rows.py +120 -0
- bcrp_mcp-0.1.0/src/bcrp_mcp/cli/views.py +225 -0
- bcrp_mcp-0.1.0/src/bcrp_mcp/client.py +185 -0
- bcrp_mcp-0.1.0/src/bcrp_mcp/config.py +25 -0
- bcrp_mcp-0.1.0/src/bcrp_mcp/exceptions.py +111 -0
- bcrp_mcp-0.1.0/src/bcrp_mcp/formatters.py +170 -0
- bcrp_mcp-0.1.0/src/bcrp_mcp/periods.py +162 -0
- bcrp_mcp-0.1.0/src/bcrp_mcp/prompts/__init__.py +0 -0
- bcrp_mcp-0.1.0/src/bcrp_mcp/prompts/economic.py +364 -0
- bcrp_mcp-0.1.0/src/bcrp_mcp/resources/__init__.py +0 -0
- bcrp_mcp-0.1.0/src/bcrp_mcp/resources/guides.py +277 -0
- bcrp_mcp-0.1.0/src/bcrp_mcp/server.py +101 -0
- bcrp_mcp-0.1.0/src/bcrp_mcp/tools/__init__.py +0 -0
- bcrp_mcp-0.1.0/src/bcrp_mcp/tools/bulk.py +282 -0
- bcrp_mcp-0.1.0/src/bcrp_mcp/tools/catalog.py +92 -0
- bcrp_mcp-0.1.0/src/bcrp_mcp/tools/macro.py +96 -0
- bcrp_mcp-0.1.0/src/bcrp_mcp/tools/series.py +223 -0
- bcrp_mcp-0.1.0/tests/__init__.py +0 -0
- bcrp_mcp-0.1.0/tests/conftest.py +123 -0
- bcrp_mcp-0.1.0/tests/test_cache.py +487 -0
- bcrp_mcp-0.1.0/tests/test_cli_render.py +116 -0
- bcrp_mcp-0.1.0/tests/test_exit_codes.py +312 -0
- bcrp_mcp-0.1.0/tests/test_formatters.py +249 -0
- bcrp_mcp-0.1.0/tests/test_periods.py +210 -0
- bcrp_mcp-0.1.0/tests/test_registry_metadata.py +78 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
publish:
|
|
13
|
+
name: Build and publish
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
environment:
|
|
16
|
+
name: pypi
|
|
17
|
+
url: https://pypi.org/p/bcrp-mcp
|
|
18
|
+
permissions:
|
|
19
|
+
contents: read
|
|
20
|
+
id-token: write
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- name: Check out repository
|
|
24
|
+
uses: actions/checkout@v4
|
|
25
|
+
|
|
26
|
+
- name: Set up Python
|
|
27
|
+
uses: actions/setup-python@v5
|
|
28
|
+
with:
|
|
29
|
+
python-version: "3.11"
|
|
30
|
+
|
|
31
|
+
- name: Install build and test dependencies
|
|
32
|
+
run: |
|
|
33
|
+
python -m pip install --upgrade pip
|
|
34
|
+
python -m pip install build pytest pytest-asyncio respx
|
|
35
|
+
python -m pip install .
|
|
36
|
+
|
|
37
|
+
- name: Run test suite
|
|
38
|
+
run: python -m pytest -q
|
|
39
|
+
|
|
40
|
+
- name: Build distributions
|
|
41
|
+
run: python -m build
|
|
42
|
+
|
|
43
|
+
- name: Publish distributions to PyPI
|
|
44
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
*$py.class
|
|
4
|
+
*.so
|
|
5
|
+
.Python
|
|
6
|
+
.venv/
|
|
7
|
+
venv/
|
|
8
|
+
env/
|
|
9
|
+
dist/
|
|
10
|
+
build/
|
|
11
|
+
*.egg-info/
|
|
12
|
+
.eggs/
|
|
13
|
+
.env
|
|
14
|
+
.env.local
|
|
15
|
+
.env.*.local
|
|
16
|
+
*.key
|
|
17
|
+
.pytest_cache/
|
|
18
|
+
.mypy_cache/
|
|
19
|
+
.ruff_cache/
|
|
20
|
+
uv.lock
|
|
21
|
+
.DS_Store
|
|
22
|
+
Thumbs.db
|
|
23
|
+
|
|
24
|
+
# npm installer package
|
|
25
|
+
node_modules/
|
|
26
|
+
*.tgz
|
|
27
|
+
# staged at pack time from the canonical skills/ at the repo root
|
|
28
|
+
npm/skills/
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here.
|
|
4
|
+
|
|
5
|
+
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
|
|
6
|
+
this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2026-08-22
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Conformance with [`ARSENAL-SPEC.md`](../ARSENAL-SPEC.md), the CLI contract shared
|
|
15
|
+
by every research server in this workspace:
|
|
16
|
+
- Five output formats: `table`, `json`, `jsonl`, `csv`, `md`.
|
|
17
|
+
- A stable JSON envelope (`ok`, `command`, `source`, `fetched_at`, `cached`,
|
|
18
|
+
`count`, `meta`, `data`, `rows`) and a matching error envelope carrying an
|
|
19
|
+
actionable `hint`.
|
|
20
|
+
- Seven documented exit codes, so a script can branch on *why* a call failed.
|
|
21
|
+
- A disk cache shared across invocations, with `--refresh`, `--no-cache` and a
|
|
22
|
+
`cache stats|clear|path` subcommand.
|
|
23
|
+
- `describe --json`: a machine-readable manifest derived from the parser
|
|
24
|
+
itself, so it cannot drift from the real commands.
|
|
25
|
+
- UTF-8 output forced on Windows consoles, which default to a code page that
|
|
26
|
+
cannot encode accented text.
|
|
27
|
+
- A curated catalog so you can find a series code by keyword.
|
|
28
|
+
- Multi-series export in tidy long format (series_code, period, value).
|
|
29
|
+
- `server.json` for the official MCP registry, plus `LICENSE`, `SECURITY.md` and
|
|
30
|
+
`CONTRIBUTING.md`.
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
- Data goes to stdout and notes to stderr, so piping to `jq` always yields
|
|
35
|
+
parseable output.
|
|
36
|
+
|
|
37
|
+
[Unreleased]: https://github.com/JOSETRA44/bcrp-mcp/compare/v0.1.0...HEAD
|
|
38
|
+
[0.1.0]: https://github.com/JOSETRA44/bcrp-mcp/releases/tag/v0.1.0
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thanks for taking the time. This project is small and the bar is simple: it
|
|
4
|
+
should keep working for the people already using it.
|
|
5
|
+
|
|
6
|
+
## Getting set up
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
git clone https://github.com/JOSETRA44/bcrp-mcp
|
|
10
|
+
cd BCRP-mcp
|
|
11
|
+
uv sync # creates the venv and installs dev dependencies
|
|
12
|
+
uv run pytest -q # run the test suite
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## The contract
|
|
16
|
+
|
|
17
|
+
This CLI implements [`ARSENAL-SPEC.md`](../ARSENAL-SPEC.md), shared with the other
|
|
18
|
+
research servers in this workspace. If you add or change a command, it must keep:
|
|
19
|
+
|
|
20
|
+
- all five output formats working, including on an **empty** result set;
|
|
21
|
+
- the JSON envelope shape, with `count == len(rows)`;
|
|
22
|
+
- the documented exit codes — an empty result is exit 0, not an error;
|
|
23
|
+
- `describe --json` listing your new command, with `row_fields` and an example;
|
|
24
|
+
- data on stdout, notes and progress on stderr.
|
|
25
|
+
|
|
26
|
+
Check it with:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
arsenal doctor bcrp --live
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Tests
|
|
33
|
+
|
|
34
|
+
- `uv run pytest -q` — the suite must be green before you open a PR.
|
|
35
|
+
|
|
36
|
+
Tests must be **hermetic**: no network calls, no reliance on the developer's real
|
|
37
|
+
cache directory or credentials. Mock the transport and point the cache at a
|
|
38
|
+
temporary directory.
|
|
39
|
+
|
|
40
|
+
Name a test so its failure reads as a sentence about the behaviour that broke,
|
|
41
|
+
and add a comment when the *reason* the test exists is not obvious.
|
|
42
|
+
|
|
43
|
+
## Pull requests
|
|
44
|
+
|
|
45
|
+
- One logical change per PR.
|
|
46
|
+
- Update `CHANGELOG.md` under `## [Unreleased]`.
|
|
47
|
+
- If you change a tool's description, remember the model reads it on every call:
|
|
48
|
+
say what the tool returns, when to prefer it over a sibling, and what its
|
|
49
|
+
parameters mean, with a real example value.
|
bcrp_mcp-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 JOSETRA44
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
bcrp_mcp-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: bcrp-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP server for the Banco Central de Reserva del Peru (BCRP) statistics API — access macroeconomic data, exchange rates, interest rates, monetary indicators, and more
|
|
5
|
+
Project-URL: Homepage, https://github.com/JOSETRA44/bcrp-mcp
|
|
6
|
+
Project-URL: Repository, https://github.com/JOSETRA44/bcrp-mcp
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/JOSETRA44/bcrp-mcp/issues
|
|
8
|
+
Project-URL: Documentation, https://estadisticas.bcrp.gob.pe/estadisticas/series/ayuda/api
|
|
9
|
+
Author-email: JOSETRA44 <drivearchiver@gmail.com>
|
|
10
|
+
License: MIT License
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2026 JOSETRA44
|
|
13
|
+
|
|
14
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
16
|
+
in the Software without restriction, including without limitation the rights
|
|
17
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
18
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
19
|
+
furnished to do so, subject to the following conditions:
|
|
20
|
+
|
|
21
|
+
The above copyright notice and this permission notice shall be included in all
|
|
22
|
+
copies or substantial portions of the Software.
|
|
23
|
+
|
|
24
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
26
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
27
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
28
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
29
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
30
|
+
SOFTWARE.
|
|
31
|
+
License-File: LICENSE
|
|
32
|
+
Keywords: ai,banco-central,bcrp,economic-data,exchange-rate,gdp,inflation,llm,macroeconomics,mcp,model-context-protocol,peru,statistics
|
|
33
|
+
Classifier: Development Status :: 4 - Beta
|
|
34
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
35
|
+
Classifier: Intended Audience :: Science/Research
|
|
36
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
37
|
+
Classifier: Programming Language :: Python :: 3
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
40
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
41
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
42
|
+
Requires-Python: >=3.11
|
|
43
|
+
Requires-Dist: anyio>=4.0.0
|
|
44
|
+
Requires-Dist: httpx>=0.27.0
|
|
45
|
+
Requires-Dist: mcp<2.0.0,>=1.0.0
|
|
46
|
+
Requires-Dist: platformdirs>=4.0.0
|
|
47
|
+
Requires-Dist: pydantic-settings>=2.0.0
|
|
48
|
+
Requires-Dist: pydantic>=2.0.0
|
|
49
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
50
|
+
Description-Content-Type: text/markdown
|
|
51
|
+
|
|
52
|
+
<img width="1600" height="500" alt="BCRP MCP" src="https://github.com/user-attachments/assets/79323612-ebec-49ea-91d5-321b5950bbbc" />
|
|
53
|
+
|
|
54
|
+
[](https://pypi.org/project/bcrp-mcp/)
|
|
55
|
+
[](https://pypi.org/project/bcrp-mcp/)
|
|
56
|
+
[](https://github.com/JOSETRA44/BCRP-mcp/actions/workflows/publish.yml)
|
|
57
|
+
[](LICENSE)
|
|
58
|
+
|
|
59
|
+
# BCRP MCP
|
|
60
|
+
|
|
61
|
+
<!-- mcp-name: io.github.JOSETRA44/bcrp-mcp -->
|
|
62
|
+
|
|
63
|
+
Servidor [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) para
|
|
64
|
+
consultar **BCRPData**, la base oficial de estadísticas económicas del
|
|
65
|
+
[Banco Central de Reserva del Perú (BCRP)](https://www.bcrp.gob.pe/).
|
|
66
|
+
|
|
67
|
+
Permite a clientes MCP y agentes de IA consultar tipos de cambio, tasas de
|
|
68
|
+
interés, reservas internacionales, liquidez, crédito, commodities, bolsa y PBI.
|
|
69
|
+
La API del BCRP es pública: **no se necesita API key ni registro**.
|
|
70
|
+
|
|
71
|
+
## Instalación rápida
|
|
72
|
+
|
|
73
|
+
Se requiere Python 3.11 o posterior.
|
|
74
|
+
|
|
75
|
+
### Con `uvx` (recomendado para clientes MCP)
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
uvx bcrp-mcp
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Con `pip`
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
python -m pip install bcrp-mcp
|
|
85
|
+
bcrp-mcp
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
La instalación también proporciona el CLI `bcrp`:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
bcrp --help
|
|
92
|
+
bcrp catalog search "tipo de cambio"
|
|
93
|
+
bcrp series latest PD04637PD --n 5
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Desde el código fuente
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
git clone https://github.com/JOSETRA44/BCRP-mcp.git
|
|
100
|
+
cd BCRP-mcp
|
|
101
|
+
uv sync
|
|
102
|
+
uv run bcrp-mcp
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Configuración en clientes MCP
|
|
106
|
+
|
|
107
|
+
El servidor usa transporte stdio. Con `uvx`, la configuración es la misma en
|
|
108
|
+
Claude Desktop, Claude Code, Cursor y otros clientes compatibles:
|
|
109
|
+
|
|
110
|
+
```json
|
|
111
|
+
{
|
|
112
|
+
"mcpServers": {
|
|
113
|
+
"bcrp": {
|
|
114
|
+
"command": "uvx",
|
|
115
|
+
"args": ["bcrp-mcp"]
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
En VS Code + GitHub Copilot (`.vscode/mcp.json`):
|
|
122
|
+
|
|
123
|
+
```json
|
|
124
|
+
{
|
|
125
|
+
"servers": {
|
|
126
|
+
"bcrp": {
|
|
127
|
+
"type": "stdio",
|
|
128
|
+
"command": "uvx",
|
|
129
|
+
"args": ["bcrp-mcp"]
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Herramientas MCP
|
|
136
|
+
|
|
137
|
+
| Herramienta | Uso |
|
|
138
|
+
|---|---|
|
|
139
|
+
| `bcrp_get_series` | Obtiene 1–10 series con un rango opcional; deben compartir frecuencia. |
|
|
140
|
+
| `bcrp_get_latest` | Obtiene los últimos valores de 1–10 series. |
|
|
141
|
+
| `bcrp_get_series_long` | Exporta hasta 50 series en una tabla larga, incluso con frecuencias mixtas. |
|
|
142
|
+
| `bcrp_describe_series` | Consulta nombre, frecuencia y rango disponible de una serie. |
|
|
143
|
+
| `bcrp_search_catalog` | Busca códigos en el catálogo curado de indicadores. |
|
|
144
|
+
| `bcrp_list_catalog_categories` | Lista las categorías disponibles. |
|
|
145
|
+
| `bcrp_get_macro_snapshot` | Devuelve un resumen de indicadores macroeconómicos clave. |
|
|
146
|
+
|
|
147
|
+
Ejemplos de preguntas:
|
|
148
|
+
|
|
149
|
+
```text
|
|
150
|
+
¿Cuál es el tipo de cambio actual en Perú?
|
|
151
|
+
Compara la tasa de referencia y las reservas internacionales desde 2020.
|
|
152
|
+
Obtén un snapshot de los principales indicadores de la economía peruana.
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## CLI
|
|
156
|
+
|
|
157
|
+
El comando `bcrp` usa la misma lógica que el servidor MCP y admite salida para
|
|
158
|
+
terminal o automatización:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
bcrp series describe PD04637PD
|
|
162
|
+
bcrp series latest PD04637PD PD12301MD --n 5
|
|
163
|
+
bcrp series get PN00196MM --start 2020-1 --end 2024-12
|
|
164
|
+
bcrp catalog categories
|
|
165
|
+
bcrp macro snapshot
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Opciones útiles:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
bcrp series latest PD04637PD --n 5 --json
|
|
172
|
+
bcrp series latest PD04637PD --n 5 --ascii --no-color
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Los formatos de período dependen de la frecuencia: diario
|
|
176
|
+
`DD-MM-YYYY`, mensual `YYYY-M`, trimestral `YYYY-Q` y anual `YYYY`.
|
|
177
|
+
Las series de una misma consulta deben tener la misma frecuencia, salvo
|
|
178
|
+
`bcrp_get_series_long`.
|
|
179
|
+
|
|
180
|
+
## Configuración opcional
|
|
181
|
+
|
|
182
|
+
Todos los valores tienen valores predeterminados razonables y pueden definirse
|
|
183
|
+
con variables de entorno o un archivo `.env`:
|
|
184
|
+
|
|
185
|
+
| Variable | Predeterminado | Descripción |
|
|
186
|
+
|---|---:|---|
|
|
187
|
+
| `BCRP_CACHE_TTL` | `300` | Duración de la caché en segundos; `0` la desactiva. |
|
|
188
|
+
| `BCRP_TIMEOUT` | `30` | Timeout HTTP en segundos. |
|
|
189
|
+
| `BCRP_MAX_RETRIES` | `3` | Reintentos ante errores transitorios. |
|
|
190
|
+
| `BCRP_LANGUAGE` | `esp` | Idioma de nombres: `esp` o `ing`. |
|
|
191
|
+
| `LOG_LEVEL` | `INFO` | Nivel de logging. |
|
|
192
|
+
|
|
193
|
+
No se configura ninguna credencial: BCRPData es de acceso abierto.
|
|
194
|
+
|
|
195
|
+
## Desarrollo
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
uv sync
|
|
199
|
+
uv run pytest -q
|
|
200
|
+
uv run python -m build
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
El proyecto usa `src/` layout, Hatchling para construir el paquete y publica
|
|
204
|
+
dos entry points: `bcrp-mcp` (servidor) y `bcrp` (CLI).
|
|
205
|
+
|
|
206
|
+
## Publicación
|
|
207
|
+
|
|
208
|
+
Las versiones se publican mediante GitHub Actions al crear un release de
|
|
209
|
+
GitHub. El workflow `.github/workflows/publish.yml` ejecuta las pruebas,
|
|
210
|
+
construye los artefactos y publica en PyPI usando Trusted Publishing (OIDC);
|
|
211
|
+
no requiere un token de PyPI almacenado en secretos.
|
|
212
|
+
|
|
213
|
+
## Datos y licencia
|
|
214
|
+
|
|
215
|
+
Los datos provienen de [BCRPData](https://estadisticas.bcrp.gob.pe/estadisticas/series/).
|
|
216
|
+
Consulte sus [condiciones de uso](https://estadisticas.bcrp.gob.pe/estadisticas/series/ayuda/condicionesUso).
|
|
217
|
+
|
|
218
|
+
MIT — consulte [LICENSE](LICENSE).
|
|
219
|
+
|
|
220
|
+
## Documentación del proyecto
|
|
221
|
+
|
|
222
|
+
- [CHANGELOG.md](CHANGELOG.md): historial de cambios.
|
|
223
|
+
- [CONTRIBUTING.md](CONTRIBUTING.md): guía para contribuir.
|
|
224
|
+
- [SECURITY.md](SECURITY.md): reporte de vulnerabilidades.
|
|
225
|
+
- [server.json](server.json): metadatos para el registro MCP.
|
bcrp_mcp-0.1.0/README.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
<img width="1600" height="500" alt="BCRP MCP" src="https://github.com/user-attachments/assets/79323612-ebec-49ea-91d5-321b5950bbbc" />
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/bcrp-mcp/)
|
|
4
|
+
[](https://pypi.org/project/bcrp-mcp/)
|
|
5
|
+
[](https://github.com/JOSETRA44/BCRP-mcp/actions/workflows/publish.yml)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
# BCRP MCP
|
|
9
|
+
|
|
10
|
+
<!-- mcp-name: io.github.JOSETRA44/bcrp-mcp -->
|
|
11
|
+
|
|
12
|
+
Servidor [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) para
|
|
13
|
+
consultar **BCRPData**, la base oficial de estadísticas económicas del
|
|
14
|
+
[Banco Central de Reserva del Perú (BCRP)](https://www.bcrp.gob.pe/).
|
|
15
|
+
|
|
16
|
+
Permite a clientes MCP y agentes de IA consultar tipos de cambio, tasas de
|
|
17
|
+
interés, reservas internacionales, liquidez, crédito, commodities, bolsa y PBI.
|
|
18
|
+
La API del BCRP es pública: **no se necesita API key ni registro**.
|
|
19
|
+
|
|
20
|
+
## Instalación rápida
|
|
21
|
+
|
|
22
|
+
Se requiere Python 3.11 o posterior.
|
|
23
|
+
|
|
24
|
+
### Con `uvx` (recomendado para clientes MCP)
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
uvx bcrp-mcp
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Con `pip`
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
python -m pip install bcrp-mcp
|
|
34
|
+
bcrp-mcp
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
La instalación también proporciona el CLI `bcrp`:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
bcrp --help
|
|
41
|
+
bcrp catalog search "tipo de cambio"
|
|
42
|
+
bcrp series latest PD04637PD --n 5
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Desde el código fuente
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
git clone https://github.com/JOSETRA44/BCRP-mcp.git
|
|
49
|
+
cd BCRP-mcp
|
|
50
|
+
uv sync
|
|
51
|
+
uv run bcrp-mcp
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Configuración en clientes MCP
|
|
55
|
+
|
|
56
|
+
El servidor usa transporte stdio. Con `uvx`, la configuración es la misma en
|
|
57
|
+
Claude Desktop, Claude Code, Cursor y otros clientes compatibles:
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"mcpServers": {
|
|
62
|
+
"bcrp": {
|
|
63
|
+
"command": "uvx",
|
|
64
|
+
"args": ["bcrp-mcp"]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
En VS Code + GitHub Copilot (`.vscode/mcp.json`):
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"servers": {
|
|
75
|
+
"bcrp": {
|
|
76
|
+
"type": "stdio",
|
|
77
|
+
"command": "uvx",
|
|
78
|
+
"args": ["bcrp-mcp"]
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Herramientas MCP
|
|
85
|
+
|
|
86
|
+
| Herramienta | Uso |
|
|
87
|
+
|---|---|
|
|
88
|
+
| `bcrp_get_series` | Obtiene 1–10 series con un rango opcional; deben compartir frecuencia. |
|
|
89
|
+
| `bcrp_get_latest` | Obtiene los últimos valores de 1–10 series. |
|
|
90
|
+
| `bcrp_get_series_long` | Exporta hasta 50 series en una tabla larga, incluso con frecuencias mixtas. |
|
|
91
|
+
| `bcrp_describe_series` | Consulta nombre, frecuencia y rango disponible de una serie. |
|
|
92
|
+
| `bcrp_search_catalog` | Busca códigos en el catálogo curado de indicadores. |
|
|
93
|
+
| `bcrp_list_catalog_categories` | Lista las categorías disponibles. |
|
|
94
|
+
| `bcrp_get_macro_snapshot` | Devuelve un resumen de indicadores macroeconómicos clave. |
|
|
95
|
+
|
|
96
|
+
Ejemplos de preguntas:
|
|
97
|
+
|
|
98
|
+
```text
|
|
99
|
+
¿Cuál es el tipo de cambio actual en Perú?
|
|
100
|
+
Compara la tasa de referencia y las reservas internacionales desde 2020.
|
|
101
|
+
Obtén un snapshot de los principales indicadores de la economía peruana.
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## CLI
|
|
105
|
+
|
|
106
|
+
El comando `bcrp` usa la misma lógica que el servidor MCP y admite salida para
|
|
107
|
+
terminal o automatización:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
bcrp series describe PD04637PD
|
|
111
|
+
bcrp series latest PD04637PD PD12301MD --n 5
|
|
112
|
+
bcrp series get PN00196MM --start 2020-1 --end 2024-12
|
|
113
|
+
bcrp catalog categories
|
|
114
|
+
bcrp macro snapshot
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Opciones útiles:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
bcrp series latest PD04637PD --n 5 --json
|
|
121
|
+
bcrp series latest PD04637PD --n 5 --ascii --no-color
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Los formatos de período dependen de la frecuencia: diario
|
|
125
|
+
`DD-MM-YYYY`, mensual `YYYY-M`, trimestral `YYYY-Q` y anual `YYYY`.
|
|
126
|
+
Las series de una misma consulta deben tener la misma frecuencia, salvo
|
|
127
|
+
`bcrp_get_series_long`.
|
|
128
|
+
|
|
129
|
+
## Configuración opcional
|
|
130
|
+
|
|
131
|
+
Todos los valores tienen valores predeterminados razonables y pueden definirse
|
|
132
|
+
con variables de entorno o un archivo `.env`:
|
|
133
|
+
|
|
134
|
+
| Variable | Predeterminado | Descripción |
|
|
135
|
+
|---|---:|---|
|
|
136
|
+
| `BCRP_CACHE_TTL` | `300` | Duración de la caché en segundos; `0` la desactiva. |
|
|
137
|
+
| `BCRP_TIMEOUT` | `30` | Timeout HTTP en segundos. |
|
|
138
|
+
| `BCRP_MAX_RETRIES` | `3` | Reintentos ante errores transitorios. |
|
|
139
|
+
| `BCRP_LANGUAGE` | `esp` | Idioma de nombres: `esp` o `ing`. |
|
|
140
|
+
| `LOG_LEVEL` | `INFO` | Nivel de logging. |
|
|
141
|
+
|
|
142
|
+
No se configura ninguna credencial: BCRPData es de acceso abierto.
|
|
143
|
+
|
|
144
|
+
## Desarrollo
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
uv sync
|
|
148
|
+
uv run pytest -q
|
|
149
|
+
uv run python -m build
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
El proyecto usa `src/` layout, Hatchling para construir el paquete y publica
|
|
153
|
+
dos entry points: `bcrp-mcp` (servidor) y `bcrp` (CLI).
|
|
154
|
+
|
|
155
|
+
## Publicación
|
|
156
|
+
|
|
157
|
+
Las versiones se publican mediante GitHub Actions al crear un release de
|
|
158
|
+
GitHub. El workflow `.github/workflows/publish.yml` ejecuta las pruebas,
|
|
159
|
+
construye los artefactos y publica en PyPI usando Trusted Publishing (OIDC);
|
|
160
|
+
no requiere un token de PyPI almacenado en secretos.
|
|
161
|
+
|
|
162
|
+
## Datos y licencia
|
|
163
|
+
|
|
164
|
+
Los datos provienen de [BCRPData](https://estadisticas.bcrp.gob.pe/estadisticas/series/).
|
|
165
|
+
Consulte sus [condiciones de uso](https://estadisticas.bcrp.gob.pe/estadisticas/series/ayuda/condicionesUso).
|
|
166
|
+
|
|
167
|
+
MIT — consulte [LICENSE](LICENSE).
|
|
168
|
+
|
|
169
|
+
## Documentación del proyecto
|
|
170
|
+
|
|
171
|
+
- [CHANGELOG.md](CHANGELOG.md): historial de cambios.
|
|
172
|
+
- [CONTRIBUTING.md](CONTRIBUTING.md): guía para contribuir.
|
|
173
|
+
- [SECURITY.md](SECURITY.md): reporte de vulnerabilidades.
|
|
174
|
+
- [server.json](server.json): metadatos para el registro MCP.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Reporting a vulnerability
|
|
4
|
+
|
|
5
|
+
Please report security issues privately rather than in a public issue:
|
|
6
|
+
open a [security advisory](https://github.com/JOSETRA44/bcrp-mcp/security/advisories/new) on this repository.
|
|
7
|
+
|
|
8
|
+
Include what you did, what happened, and what you expected. You can expect an
|
|
9
|
+
acknowledgement within a few days.
|
|
10
|
+
|
|
11
|
+
## What this server sends, and where
|
|
12
|
+
|
|
13
|
+
Outbound requests go only to:
|
|
14
|
+
|
|
15
|
+
- `estadisticas.bcrp.gob.pe`
|
|
16
|
+
|
|
17
|
+
No telemetry, no analytics, and no data is sent anywhere else.
|
|
18
|
+
|
|
19
|
+
## Credentials
|
|
20
|
+
|
|
21
|
+
This server needs none. There is no API key to leak.
|
|
22
|
+
|
|
23
|
+
## Scope
|
|
24
|
+
|
|
25
|
+
This project is a client for a public data source. Vulnerabilities in the
|
|
26
|
+
upstream API itself are out of scope here — report those to its operator.
|