Add it to Claude Code
claude mcp add mcp-bcrp -- python -m mcp_bcrpMake your agent remember this setup
mcp-bcrp's config, env vars, and the gotchas you hit — recalled in every future Claude Code, Cursor, and Codex session.
npx conare@latestFree · one command · indexes the sessions already on disk. Set up in the browser instead →
What it does
- Access to over 5,000 macroeconomic indicators from the BCRP database
- Deterministic search engine with fuzzy matching capabilities
- Automatic frequency detection for daily, monthly, quarterly, and annual data
- Asynchronous HTTP client for efficient data retrieval
- Local metadata caching for fast offline searches
Tools 1
search_seriesSearch BCRP indicators by keyword to find relevant series codes.Environment Variables
BCRP_CACHE_DIRDirectory for metadata cacheBCRP_TIMEOUTHTTP request timeout in secondsTry it
Original README from MaykolMedrano/mcp_bcrp
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.
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 httpx for non-blocking HTTP requests with connection pooling |
| 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)
pip install mcp-bcrp
From Source
git clone https://github.com/YOUR_USERNAME/mcp-bcrp.git
cd mcp-bcrp
pip install -e .
With Optional Dependencies
pip install "mcp-bcrp[charts]" # Include matplotlib for chart generation
pip install "mcp-bcrp[dev]" # Include development dependencies
Configuration
MCP Server Configuration
Add the following to your MCP configuration file (e.g., mcp_config.json):
{
"mcpServers": {
"bcrp-api": {
"command": "python",
"args": ["C:/absolute/path/to/mcp_bcrp/run.py"]
}
}
}
[!TIP] If you have installed the package via pip, you can also use
["-m", "mcp_bcrp"]as the arguments.
Environment Variables
| Variable | Description | Default |
|---|---|---|
BCRP_CACHE_DIR |
Directory for metadata cache | User cache dir |
BCRP_TIMEOUT |
HTTP request timeout in seconds | 120 |
Usage
As MCP Server
Once configured, the server can be invoked by MCP-compatible AI assistants:
User: What is the current policy interest rate in Peru?
Agent: [calls search_series("tasa politica monetaria")]
Agent: [calls get_data(["PD04722MM"], "2024-01/2025-01")]
As Python Library
import asyncio
from mcp_bcrp.client import AsyncBCRPClient, BCRPMetadata
async def main():
# Initialize metadata client
metadata = BCRPMetadata()
await metadata.load()
# Search for an indicator (deterministic)
result = metadata.solve("tasa politica monetaria")
print(result)
# Output: {'codigo_serie': 'PD04722MM', 'confidence': 1.0, ...}
# Fetch time series data
client = AsyncBCRPClient()
df = await client.get_series(
series_codes=["PD04722MM"],
start_date="2024-01",
end_date="2025-01"
)
print(df.head())
asyncio.run(main())
Available Tools (MCP)
| Tool | Parameters | Description |
|---|---|---|
search_series |
query: str |
Search BCRP indicators by keyword. Returns determinis |