Fetches FX rates from the Czech National Bank (ČNB) for a given currency and date by scraping the daily rates page. See the official page: Kurzy devizového trhu – ČNB.
Paste this into your MCP config (adjust the absolute path):
"cnb-fx": {
"command": "node",
"args": [
"/absolute/path/to/cnb-fx-mcp/dist/index.js"
],
"cwd": "/absolute/path/to/cnb-fx-mcp"
}- Node.js 18+ (Node 20+ recommended)
- pnpm 8+
pnpm installpnpm run build- Outputs
dist/index.jsand compiled test artifacts.
- Development (watch):
pnpm run dev- Production (built):
pnpm startThis server speaks MCP over stdio. Any MCP client that supports stdio can launch it with:
- Command:
node - Args:
dist/index.js - CWD: project root
- Tool name:
get_cnb_fx_rate - Description: Fetch CNB FX rate (CZK) for a currency on a date
- Args:
currency(string): three-letter code (e.g.,USD, case-insensitive)date(string):dd.mm.yyyyoryyyy-mm-dd
- Returns:
textcontent with the rate using dot decimal. Example:20.885. - Errors:
- HTTP failures (e.g.,
HTTP 4xx/5xx) - Missing table (
Rates table not found) - Missing currency for date (
Currency XXX not found for dd.mm.yyyy)
- HTTP failures (e.g.,
Notes:
- ČNB rates are valid for the working day and the following weekend/holidays. Weekend inputs will return the most recent published working-day rate.
- Output is normalized to dot decimal.
End-to-end tests use the MCP client SDK to spawn the server and call the tool for multiple currencies and dates (including a weekend):
pnpm run test:mcpSample output:
USD 13.08.2025 => 20.885
EUR 13.08.2025 => 24.470
GBP 13.08.2025 => 28.350
USD 10.08.2025 => 20.993
EUR 11.08.2025 => 24.485A lightweight HTML parsing check also exists (uses the provided sample HTML):
pnpm run test:fetch- Launch via stdio:
- command:
node - args:
dist/index.js - cwd: repository root
- command:
- After initialization, call:
tools/list→ verifyget_cnb_fx_ratetools/callwith{ name: "get_cnb_fx_rate", arguments: { currency: "USD", date: "13.08.2025" } }
- Expected result content:
[{ type: "text", text: "20.885" }]
If your client supports static server config, point it to the above command and args and it will connect over stdio automatically.
- Build:
pnpm run build - Distribute the built files from
dist/ - Run with:
node dist/index.js
No additional configuration is required. The server fetches the official CNB HTML page directly.
- If the server can’t find the table, verify the CNB page structure hasn’t changed.
- Network blocks can be mitigated by retrying; the server already sends common browser headers to avoid simple blocks.
- Weekend/holiday dates are expected to resolve to the nearest published working-day rate per CNB policy.
- build: TypeScript build →
dist/ - dev: watch mode for local development
- start: run built server over stdio
- test:mcp: end-to-end MCP tests via stdio client
- test:fetch: parse sample HTML (
sample-data/index.html)
See project terms or your repository license.