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., "@mcp-bcrpshow me a chart of Peru's inflation rate for the last year"
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.
mcp-bcrp
MCP Server and Python library for the Banco Central de Reserva del Perú (BCRP) Statistical API. Access over 5,000 macroeconomic indicators directly from your AI agent or Python environment.
Table of Contents
Overview
The mcp-bcrp package provides a standardized interface to the BCRP statistical database through the Model Context Protocol (MCP). It supports both direct Python usage and integration with AI assistants such as Claude, Gemini, and other MCP-compatible agents.
The library implements:
Asynchronous HTTP client for efficient data retrieval
Deterministic search engine with fuzzy matching capabilities
Spanish language processing for query canonicalization
Automatic frequency detection (daily, monthly, quarterly, annual)
Features
Feature | Description |
Smart Search | Deterministic search engine with fuzzy matching, attribute extraction, and ambiguity detection |
Async Native | Built on |
Dual Interface | Use as MCP server for AI agents or as standalone Python library |
Chart Generation | Generate publication-ready charts with automatic Spanish date parsing |
Full Coverage | Access to 5,000+ BCRP economic indicators across all categories |
Metadata Cache | Local caching of 17MB metadata file for fast offline searches |
Requirements
Python 3.10 or higher
Internet connection for API requests
Dependencies:
httpx,pandas,fastmcp,rapidfuzz,matplotlib
Installation
From PyPI (when published)
From Source
With Optional Dependencies
Configuration
MCP Server Configuration
Add the following to your MCP configuration file (e.g., mcp_config.json):
If you have installed the package via pip, you can also use["-m", "mcp_bcrp"] as the arguments.
Environment Variables
Variable | Description | Default |
| Directory for metadata cache | User cache dir |
| HTTP request timeout in seconds | 120 |
Usage
As MCP Server
Once configured, the server can be invoked by MCP-compatible AI assistants:
As Python Library
Available Tools (MCP)
Tool | Parameters | Description |
|
| Search BCRP indicators by keyword. Returns deterministic match or ambiguity error. |
|
| Fetch raw time series data. Period format: |
|
| Get formatted table with optional custom column names. |
|
| Generate professional PNG chart with automatic date parsing. |
Available Prompts
Prompt | Description |
| System prompt to analyze data as a BCRP Senior Economist with rigorous methodology |
Key Indicators
The following are commonly used indicator codes:
Category | Code | Description | Frequency |
Monetary Policy |
| Reference Interest Rate | Monthly |
Exchange Rate |
| Interbank Exchange Rate (Sell) | Daily |
Inflation |
| CPI Lima Metropolitan | Monthly |
Copper Price |
| International Copper Price (c/lb) | Monthly |
GDP Growth |
| Agricultural GDP (Var. %) | Annual |
Business Expectations |
| GDP Expectations 12 months | Monthly |
International Reserves |
| Net International Reserves | Monthly |
Series codes follow the BCRP naming convention. Usesearch_series to find the appropriate code for your query.
Search Engine
The search engine implements a deterministic pipeline designed for high precision:
Architecture
Limitations and Warnings
API Rate Limits: The BCRP API does not publish official rate limits. Implement appropriate delays between requests in production applications to avoid IP blocking.
Data Freshness: Metadata cache (bcrp_metadata.json) may become stale. Delete the file periodically to force a refresh of available indicators.
Unofficial Package: This is an independent implementation and is not officially endorsed by the Banco Central de Reserva del Peru. Data accuracy depends on the upstream API.
Known Limitations
Date Format: The BCRP API returns dates in Spanish format (e.g., "Ene.2024"). The library handles this automatically, but custom date parsing may be required for edge cases.
Series Availability: Not all series are available for all time periods. The API returns empty responses for unavailable date ranges.
Metadata Size: The complete metadata file is approximately 17MB. Initial load may take several seconds on slow connections.
Frequency Detection: The library attempts to auto-detect series frequency, but some series may require explicit specification.
Contributing
Contributions are welcome. Please follow these guidelines:
Fork the repository
Create a feature branch (
git checkout -b feature/improvement)Commit changes with descriptive messages
Ensure all tests pass (
pytest)Submit a pull request
See CONTRIBUTING.md for detailed guidelines.
License
This project is licensed under the MIT License. See LICENSE for the full text.
Acknowledgments
Banco Central de Reserva del Peru for providing the public statistical API
FastMCP for the Model Context Protocol framework
RapidFuzz for fuzzy string matching
usebcrp for inspiration on BCRP API integration
See Also
Project | Description |
Enterprise-grade MCP Client for World Bank Data API. Provides access to World Development Indicators, global rankings, country comparisons, and professional FT-style visualizations. |
Both libraries can be used together to build comprehensive macroeconomic analysis pipelines combining Peru-specific BCRP data with global World Bank indicators.
Disclaimer: This software is provided "as is" without warranty of any kind. The authors are not responsible for any errors in the data or any decisions made based on the information provided by this library.