Skip to main content
Glama

MCP del BCRP

Proyecto independiente de la sesión 04: un servidor MCP con FastMCP para buscar, consultar y analizar series oficiales del Banco Central de Reserva del Perú.

Contenido

Archivo

Propósito

server.py

Búsqueda de series, observaciones, resúmenes, comparación de series, recurso y prompt

test_server.py

Ocho pruebas de contrato con datos reales del BCRP; no modificar

preguntas.csv

Diez preguntas con respuestas y tolerancias oficiales

evaluar.py

Compara respuestas de Claude sin MCP y con el MCP

.mcp.json

Configura los servidores BCRP y Fetch para Claude Code

pyproject.toml, uv.lock

Dependencias y versiones reproducibles del entorno

Related MCP server: FRED Economic MCP Server

Requisitos y pruebas

Se necesita Python 3.11 o superior, uv, Claude Code con sesión iniciada e internet. El entorno local .venv/ se crea automáticamente con uv; el catálogo descargado y el entorno se excluyen de Git.

Desde esta carpeta:

uv run pytest -q

La meta es 8 passed. La primera ejecución descarga el catálogo oficial del BCRP. Para iniciar el servidor en terminal, ejecuta uv run server.py.

La dependencia cryptography<49 está acotada para permitir la instalación en macOS Intel sin compilar OpenSSL; el proyecto no la usa directamente.

Conectar con Claude Code

Abre Claude Code desde esta carpeta y aprueba los servidores configurados en .mcp.json cuando lo solicite. Usa /mcp para comprobar la conexión. El servidor bcrp ofrece:

  • Herramientas: buscar_series, serie, resumen y comparar_series.

  • Recurso: bcrp://serie/{codigo}; por ejemplo @bcrp:bcrp://serie/PN01273PM.

  • Prompt: informe(tema), disponible como /mcp__bcrp__informe.

Las fechas de serie y resumen son YYYY-MM para series mensuales, YYYY-T1 para trimestrales, YYYY-MM-DD para diarias y YYYY para anuales. Las respuestas incluyen el código y el enlace oficial de la fuente.

Evaluación

preguntas.csv contiene diez preguntas, con las dos cifras adicionales verificadas manualmente en el sitio oficial del BCRP. Ejecuta uv run evaluar.py para comparar los modos memoria y mcp; Claude Code debe estar disponible en PATH. El resultado se guarda en resultados.csv. Para incluir búsqueda web, ejecuta uv run evaluar.py --modos memoria web mcp.

La ejecución documentada en informe.md obtuvo 0/10 aciertos en modo memoria (10 respuestas «no sabe») y 10/10 con el MCP. La figura correspondiente está en grafico.png. datos/ no se incluye: el catálogo se descarga automáticamente cuando se necesita.

Conserva test_server.py sin cambios. Los archivos de entrega son server.py, .mcp.json, preguntas.csv, resultados.csv, informe.md y grafico.png.

La rúbrica del curso suma 20 puntos: pruebas (6), herramienta propia (3), recurso y prompt (2), .mcp.json (2), evaluación (4) e informe (3).

Available Tools

4 tools
buscar_seriesBuscar SeriesA
Read-only

Busca series del BCRP por palabras: todas deben aparecer en la categoría, el grupo o el nombre.

Ejemplos: "ipc 12 meses", "tipo de cambio interbancario venta", "reservas internacionales netas", "tasa de referencia", "cobre precio". frecuencia: "Diaria", "Mensual", "Trimestral" o "Anual". Devuelve el código, el nombre completo, la frecuencia y desde cuándo hay datos. Si no hay resultados, prueben con menos palabras.

NameRequiredDescriptionDefault
textoYes
limiteNo
frecuenciaNo

Output Schema

NameRequiredDescription
resultYes

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint and openWorldHint, and the description adds genuinely non-obvious behavior: the AND-matching semantics across category/group/name and the fallback when the result set is empty. It repeats the return fields that the output schema already documents, which is redundant rather than harmful.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core matching rule, then examples, then the failure-recovery tip — a sensible order an agent can scan. The five-example list is slightly longer than needed and the sentence restating returned fields duplicates the output schema.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read-only search over a large catalog, the description covers query construction, filtering, and empty-result handling, and an output schema exists so return shape need not be spelled out. The only real omissions are the undocumented `limite` parameter and any hint that the returned code should be fed to the sibling `serie`.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description has to carry the load and largely does: it explains `texto` as an all-words-must-match search and enumerates valid `frecuencia` values that the schema itself declares only as a bare string. The third parameter, `limite` (default 10), is never mentioned, leaving that gap to the schema's default value alone.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Names a specific verb and resource ("Busca series del BCRP") and even specifies the matching rule — all words must appear in category, group, or name — which is far more precise than the title alone. It never distinguishes itself from the sibling `serie` (singular), so an agent gets no explicit routing signal about which of the two to pick.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives five concrete query examples and the accepted frequency values, plus an explicit recovery strategy ("Si no hay resultados, prueben con menos palabras"), which tells the agent how to retry rather than guess. It stops short of stating when NOT to use this tool or naming `serie` / `resumen` as the alternative once a code is known.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

comparar_seriesComparar SeriesB
Read-only

Compara dos series por periodos coincidentes y calcula su correlación, sin inferir causalidad.

NameRequiredDescriptionDefault
desdeYes
hastaYes
codigo_aYes
codigo_bYes

Output Schema

NameRequiredDescription

No output parameters

TDQS

B3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The annotations already establish that this is a read-only, open-world operation, so the description does not need to repeat safety details. It adds useful context by stating that only coincident periods are used and that correlation does not imply causality, but it does not disclose error behavior or handling of non-overlapping ranges.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single front-loaded sentence with no filler. Every clause contributes either the core operation, the period constraint, or the no-causality caveat.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool takes four required parameters, has no schema descriptions, and performs a comparison whose correctness depends on overlapping date ranges and valid series codes. The description names the core operation and caveat, but it leaves parameter formats and edge-case behavior unspecified, which is a significant gap for an agent to call it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate for four undocumented required parameters. It conveys the high-level meaning of two series and a period, but never specifies what 'codigo_a'/'codigo_b' look like or what date format 'desde'/'hasta' require.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific operation: it compares two series over coincident periods and calculates their correlation. It implicitly distinguishes itself from the single-series sibling 'serie' by requiring two series, but it does not explicitly name or route against 'buscar_series' or 'resumen'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no explicit guidance on when to use this tool versus the sibling tools, nor any when-not conditions. The phrase 'por periodos coincidentes' implies a constraint, but the description does not say what to do if periods do not overlap or when 'serie' would be more appropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

resumenResumenB
Read-only

Calcula estadísticas exactas de una serie: extremos, cambio, variación y promedio del periodo.

NameRequiredDescriptionDefault
desdeYes
hastaYes
codigoYes

Output Schema

NameRequiredDescription

No output parameters

TDQS

B3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true and openWorldHint=true, so the safety profile is covered. The description adds that the statistics are 'exactas' and lists the metrics computed, but it does not describe behavior around missing data, invalid codes, date range constraints, or other runtime characteristics.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single front-loaded sentence with no filler. Every phrase contributes to stating the computation and its scope.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return values do not need description coverage. However, with three required parameters at 0% schema coverage, no explicit usage routing, and an openWorldHint, the description leaves too much unexplained for an agent to reliably select and invoke the tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% for three required parameters, so the description must carry parameter meaning. It only loosely implies a series identifier ('de una serie') and a date range ('del periodo'); it never names codigo, desde, or hasta, nor explains their formats or constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: 'Calcula estadísticas exactas de una serie', and enumerates the statistics (extremos, cambio, variación, promedio) plus the period scope. It is clear what the tool does, but it does not explicitly differentiate itself from siblings such as serie or comparar_series.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no explicit when-to-use guidance, no when-not-to-use guidance, and no mention of alternatives. The agent can infer that this is for summary statistics over a period, but the description does not route it against buscar_series, serie, or comparar_series.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

serieSerieA
Read-only

Descarga observaciones oficiales de una serie del BCRP entre dos fechas, ambas incluidas.

Usa YYYY-MM para series mensuales, YYYY-T1 para trimestrales, YYYY-MM-DD para diarias y YYYY para anuales. Devuelve los datos, la ficha de la serie y el enlace reproducible a la fuente oficial.

NameRequiredDescriptionDefault
desdeYes
hastaYes
codigoYes

Output Schema

NameRequiredDescription

No output parameters

TDQS

A3.9/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true and openWorldHint=true. The description adds useful behavioral context beyond annotations: both dates are inclusive, data is official BCRP data, and the result includes data, series metadata, and a reproducible source link. It does not cover error behavior or rate limits, but the main behavioral profile is clear.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three compact sentences, front-loaded with the core action and followed by essential date-format guidance and return contents. Every sentence adds useful information without repetition or filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple and has an output schema plus annotations, so the description need not explain return structure. Still, for a 3-required-parameter tool with 0% schema coverage, the missing explanation of the codigo parameter's format is a clear gap for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must carry parameter meaning. It does explain the date formats for desde and hasta depending on series frequency (YYYY-MM, YYYY-T1, YYYY-MM-DD, YYYY), which is valuable. However, it never specifies the format or expected form of the required codigo parameter, leaving a key parameter only partially documented.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: downloads official BCRP series observations for one series over a date range. This inherently distinguishes it from sibling tools like buscar_series, resumen, and comparar_series, which search, summarize, or compare rather than download a single series.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by specifying a single series code and an inclusive date range, and gives date formats by frequency. However, it does not explicitly say when to use this tool instead of buscar_series or comparar_series, nor does it state prerequisites such as needing a valid series code.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 4 tool updatesv0.1.0
    • First observedbuscar_series
    • First observedcomparar_series
    • First observedresumen
    • First observedserie

TDQS

A3.7/5.0

Scored across 4 tools

Disambiguation5/5

Each tool has a clearly distinct role in the workflow: search series, fetch observations, compute summary statistics, and compare two series. The boundary between `serie` and `resumen` is clear because one returns raw observations while the other returns aggregate statistics.

Naming Consistency3/5

The names mix conventions: `buscar_series` and `comparar_series` use a verb_noun pattern, while `serie` and `resumen` are bare nouns. The names are still readable and understandable, but the set lacks a consistent naming pattern.

Tool Count5/5

Four tools is well-scoped for a central-bank statistics server: discovery, retrieval, summary, and comparison. Each tool earns its place and there are no redundant or trivial additions.

Completeness5/5

The tool set covers the full read-only lifecycle for BCRP series: search for a series, download its observations, compute descriptive statistics, and compare two series. No obvious dead ends are present for the stated purpose.

Maintenance

ActivityMaintained
ResponsivenessNo issues

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
    Not graded
    quality
    D
    maintenance
    Provides access to 800,000+ Federal Reserve Economic Data (FRED) time series, enabling users to search, retrieve, and analyze economic indicators like GDP, unemployment, inflation, and interest rates through natural language queries.
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    Enables users to search, retrieve, and explore economic data series from the Federal Reserve Economic Data (FRED) API using natural language.
    11
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables natural language access to 800,000+ economic time series from FRED, including GDP, inflation, unemployment, and interest rates, with built-in transforms and frequency aggregation.
    49 npm
    MIT