Skip to main content
Glama

mcp_bcrp

BCRP data tools for Python/MCP and native Stata workflows.

PyPI Python Tests Downloads License: MIT

Overview

This repository provides two independent interfaces to the public statistical source of the Banco Central de Reserva del Perú (BCRP):

  • mcp-bcrp — Python client, metadata search and optional FastMCP server;

  • usebcrp — native Stata package for data retrieval, search and transformations.

Both interfaces query the same BCRP source, but they have separate runtimes, tests, documentation and release processes. Installing one does not install the other.

Related MCP server: BCRP MCP Server

Python implementation

The Python package provides asynchronous data access and catalog search. The FastMCP server is an optional interface for MCP-compatible AI applications.

Install or update from PyPI:

pip install --upgrade mcp-bcrp

Help: Python guide · examples and notebooks

Replication: Python test suite

From a checkout, run the tests from the repository root:

python -m pytest python/tests -q

Stata implementation

The native Stata package preserves the usebcrp command syntax and adds catalog search, caching, transformations and metadata output.

Install or update from GitHub:

net install usebcrp, ///
    from("https://raw.githubusercontent.com/MaykolMedrano/mcp_bcrp/main/stata") replace

Requirements: Stata 16 or later and HTTPS access. The package uses the public BCRP API and does not require Python, FastMCP or an LLM provider.

Help: user guide · Stata help file · distribution guide

Replication: Stata test suite

From a checkout, run the deterministic suite with the configured StataNow executable:

powershell -ExecutionPolicy Bypass -File stata/scripts/run-tests.ps1

Repository structure

mcp_bcrp/
├── python/
│   ├── mcp_bcrp/       Python client, search and MCP server
│   ├── tests/          Python tests
│   ├── examples/       Python examples and notebooks
│   └── README.md       Python documentation
├── stata/
│   ├── *.ado, *.sthlp  Native Stata runtime
│   ├── tests/          Stata tests and fixtures
│   ├── docs/           Stata documentation
│   ├── scripts/        Test and release scripts
│   ├── catalog/        Catalog provenance and build scripts
│   └── README.md       Stata documentation
├── docs/               Shared architecture documentation
├── pyproject.toml      Python/PyPI build configuration
└── README.md           Project overview

The stata/ directory is also the exact net install site: stata.toc and usebcrp.pkg remain directly inside it.

Data source and references

Author

Maykol Medrano Pontificia Universidad Católica de Chile Email: mmedrano2@uc.cl GitHub: MaykolMedrano

License and disclaimer

This project is released under the MIT License. It is an independent open-source project and is not an official product of the Banco Central de Reserva del Perú. Data availability and accuracy depend on the upstream BCRP service.

Available Tools

4 tools
get_dataA

Fetch time series data for specific BCRP series codes.

Args: series_codes: List of BCRP series codes (e.g., ["PN01652XM", "PD04638PD"]) period: Date range in format 'YYYY-MM/YYYY-MM' or single 'YYYY-MM'. If None, returns all available data.

Returns: JSON string with array of records containing 'time' and values.

Inputs: series_codes (required), period. Returns: result

get_tableB

Get a formatted table with custom column names.

Args: series_codes: List of BCRP series codes to retrieve names: Optional custom names for columns (must match series_codes length) period: Date range in format 'YYYY-MM/YYYY-MM' or 'YYYY'

Returns: JSON string with formatted table data.

Inputs: series_codes (required), names, period. Returns: result

plot_chartA

Generate a professional chart for BCRP series data. Returns the path to the saved PNG file.

Args: series_codes: List of BCRP series codes to plot period: Date range in format 'YYYY-MM/YYYY-MM' (optional) title: Custom chart title (optional, uses series name if not provided) names: Custom names for each series in legend (optional) output_path: Custom output path for the chart (optional)

Inputs: series_codes (required), period, title, names, +1 more. Returns: result

search_seriesA

Search for BCRP economic indicators by keyword.

Uses deterministic search with fuzzy matching. Returns the best match or an ambiguity error if multiple matches are equally scored.

Args: query: Search term (e.g., "tipo de cambio", "inflacion", "PBI")

Returns: JSON string with match result containing codigo_serie and confidence, or error details if ambiguous or not found.

Inputs: query (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: get_data retrieves raw time series data, get_table provides formatted tabular data, plot_chart generates visual charts, and search_series helps find series codes. There is no functional overlap between these tools, making selection straightforward for an agent.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern with snake_case: get_data, get_table, plot_chart, and search_series. The naming convention is predictable and readable throughout the toolset.

    Tool Count5/5

    With 4 tools, this server is well-scoped for working with BCRP economic data. Each tool serves a distinct purpose in the data workflow (search, retrieve raw data, format tables, visualize), and none feel extraneous or missing for the domain.

    Completeness4/5

    The toolset covers the essential workflow for BCRP data analysis: searching for series, retrieving data in different formats, and visualizing results. A minor gap exists in lacking update/delete operations, but these are likely unnecessary for read-only economic data access, and agents can work effectively with the provided tools.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      A
      quality
      D
      maintenance
      Model Context Protocol server that provides access to economic and financial time series data from Peru's Central Reserve Bank, enabling AI agents to search, explore, and analyze Peru's economic indicators through a standardized interface.
      3
      4
      -
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to access economic statistics from the Central Reserve Bank of Peru, including exchange rates, interest rates, and GDP, without requiring an API key.
      7
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      MCP server that provides real-time access to Peruvian economic indicators from the BCRP API, with persistent memory, knowledge graph, document RAG, and statistical analysis tools.
      -
    • A
      license
      A
      quality
      F
      maintenance
      Enables AI agents to discover, retrieve, compare, and analyze trusted macroeconomic statistics from central banks and international organizations, resolving concepts to official series with provenance and validation.
      6
      MIT