Skip to main content
Glama
atomno-mcp

mcp-cbr-rates

by atomno-mcp

mcp-cbr-rates

一个模型上下文协议 (MCP) 服务器,向 AI 代理公开俄罗斯中央银行 (Центральный банк РФ, CBR) 的数据 — 包括货币报价、基准利率、通胀率以及简要的宏观快照。

License: MIT GitHub release Tests Coverage Python MCP

mcp-cbr-ratesatomno 系列 MCP 服务器的一部分,专注于俄罗斯金融科技生态系统。它完全开源,无需 API 密钥,并基于官方公开的 CBR 端点构建。


功能特性

  • 五个高质量的 MCP 工具,每个都具有严格的 Pydantic 模式: get_ratehistory_rateskey_rateinflationstatistics

  • 内置 TTL (生存时间) 缓存:每日报价缓存 1 小时,历史序列缓存 24 小时,以减轻对源服务器的压力。

  • 异步 httpx 传输,在遇到 5xx 错误时自动重试。

  • 通过 defusedxml 进行安全的 XML 解析。

  • 50 多个单元测试,使用 respx 模拟 HTTP,覆盖率 ≥80%。

  • 无秘密信息,无遥测,无第三方追踪器。


Related MCP server: ozon-mcp

快速入门

从源码安装

git clone https://github.com/atomno-labs/mcp-cbr-rates.git
cd mcp-cbr-rates
pip install -e .
mcp-cbr-rates  # starts the MCP server over stdio

在 Cursor 中使用

将以下内容添加到 .cursor/mcp.json(或您的全局 ~/.cursor/mcp.json):

{
  "mcpServers": {
    "cbr-rates": {
      "command": "mcp-cbr-rates"
    }
  }
}

在 Claude Desktop 中使用

添加到 claude_desktop_config.json

{
  "mcpServers": {
    "cbr-rates": {
      "command": "mcp-cbr-rates"
    }
  }
}

在 Windows 上,配置文件位于 %APPDATA%\Claude\claude_desktop_config.json;在 macOS 上,位于 ~/Library/Application Support/Claude/claude_desktop_config.json

在 Claude Code 中使用

claude mcp add cbr-rates -- mcp-cbr-rates

工具

名称

输入

返回值

get_rate

char_code: str, on_date?: date

CurrencyRate — 指定日期(或最新日期)的单笔报价

history_rates

char_code: str, date_from: date, date_to: date

HistoryRates — 每日报价序列

key_rate

date_from?: date, date_to?: date

KeyRateHistory — CBR 基准利率序列

inflation

year_from?: int, year_to?: int

InflationData — 每月同比 CPI(百分比)

statistics

(无)

MacroSnapshot — 综合仪表板:基准利率 + 美元/欧元/人民币汇率 + 通胀率

简单英语示例:

“2024 年 4 月 25 日的官方欧元汇率是多少?” 工具:get_rate(char_code="EUR", on_date="2024-04-25")

“绘制过去 90 天的美元兑卢布日汇率图表。” 工具:history_rates(char_code="USD", date_from=..., date_to=...)

“一次性获取最新的基准利率、美元/欧元/人民币汇率和通胀率。” 工具:statistics()

history_rates 的时间窗口限制为 366 天;如需更长周期,请多次调用该工具。


配置

所有设置均为可选,并从环境变量中读取:

变量

默认值

描述

CBR_HTTP_TIMEOUT

15

CBR 调用 HTTP 超时时间(秒)。

CBR_CACHE_DAILY_TTL

3600

每日报价的缓存 TTL(秒)。

CBR_CACHE_HISTORY_TTL

86400

历史序列和 SOAP 响应的缓存 TTL(秒)。

CBR_LOG_LEVEL

INFO

标准 Python 日志级别。

无需配置 API 密钥 — 此处使用的所有 CBR 端点均为公开的。


开发

git clone https://github.com/atomno-labs/mcp-cbr-rates.git
cd mcp-cbr-rates
python -m venv .venv && source .venv/bin/activate  # or .\.venv\Scripts\activate on Windows
pip install -e ".[dev]"
pytest --cov=src/mcp_cbr_rates

布局:

apps/mcp-cbr-rates/
├── src/mcp_cbr_rates/
│   ├── server.py        # FastMCP entry point, tool registration
│   ├── tools.py         # high-level async tools with caching
│   ├── client.py        # httpx wrapper around CBR XML / SOAP / HTML endpoints
│   ├── schemas.py       # Pydantic v2 models for inputs & outputs
│   ├── cache.py         # async TTL cache
│   ├── currency_codes.py # static ISO → CBR id map (with dynamic fallback)
│   └── errors.py        # typed exception hierarchy
└── tests/               # respx-mocked unit tests + fixtures

数据源

  • https://www.cbr.ru/scripts/XML_daily.asp — 每日货币报价。

  • https://www.cbr.ru/scripts/XML_dynamic.asp — 历史货币序列。

  • https://www.cbr.ru/scripts/XML_valFull.asp — 货币代码查询。

  • https://www.cbr.ru/DailyInfoWebServ/DailyInfo.asmx — 用于 CBR 基准利率的 SOAP 服务。

  • https://www.cbr.ru/hd_base/infl/ — 每月同比通胀表。

所有端点均为只读且免费。


免责声明

本项目与俄罗斯中央银行没有任何关联。它是一个非官方的、尽力而为的公开数据封装工具。使用风险自负;作者不对通过此服务器提供的数据的新鲜度、准确性或适用性承担任何责任。

如果 CBR 的 HTML 或 XML 模式发生变化,个别工具可能会停止工作,直到此包更新。如果您发现回归问题,请提交 issue。


许可

MIT — 详见 LICENSE

Install Server
A
license - permissive license
A
quality
A
maintenance

Maintenance

Maintainers
Response time
1wRelease cycle
9Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    ozon-mcp is a knowledge-rich MCP server that turns the entire Ozon seller toolkit into 15 high-leverage tools. AI agents (Claude, Cursor, Cline, Continue, Goose, Zed, …) can search the API in Russian or English, drill into any of 466 methods with a fully-resolved JSON Schema, and execute calls with built-in safety guards. Subscription- aware, automatic pagination over all 4 cursor styles, retry/ba
    15
    16
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    MCP server for verifying Russian counterparties (legal entities and individual entrepreneurs) via public Federal Tax Service data: EGRUL/EGRIP, bankruptcy registry (EFRSB), Transparent Business, bailiff service (FSSP), and arbitration courts (KAD).
    8
    15
    MIT
  • F
    license
    Not graded
    quality
    B
    maintenance
    Russian-market marketing & ops MCP toolkit. 7 unified servers for Yandex.Direct, Yandex.Webmaster, Google Search Console (RU), YouTube Data API, VK Wall, Telegram publishing, and Click.ru (Telegram Ads + VK Ads + Yandex.Direct unified). The only complete RU-platform bundle for AI agents.
    1

View all related MCP servers

Related MCP Connectors

  • Live & historical FX rates for AI agents, from European Central Bank data. No API keys.

  • Live & historical FX rates and currency conversion for AI agents. No API keys.

  • Package intelligence MCP for AI agents — 22 tools, 19 ecosystems, AGPL SDK, free.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/atomno-mcp/mcp-cbr-rates'

If you have feedback or need assistance with the MCP directory API, please join our Discord server