boi-mcp
<div align="center">
<img src=".github/banner.svg" alt="boi-mcp" width="100%"/>
[](https://github.com/Shtibel1/boi-mcp/actions/workflows/ci.yml)
[](package.json)
[](LICENSE)

[](https://modelcontextprotocol.io)

**Official Bank of Israel exchange rates (שערים יציגים), interest rate, inflation expectations and yield curve for any MCP client.**
</div>
<p align="center"><a href="#quick-start">Quick start</a> · <a href="#tools">Tools</a> · <a href="#live-example">Live example</a> · <a href="#architecture">Architecture</a> · <a href="#roadmap">Roadmap</a></p>
A [Model Context Protocol](https://modelcontextprotocol.io) server that gives AI agents the **official representative exchange rates** published daily by the Bank of Israel, the rate on any past date (with automatic previous-business-day fallback), history and statistics over a range, ILS conversions and cross rates, the shekel's **nominal effective exchange rate** (trade-weighted index), the **Bank of Israel policy interest rate** with its change history, **inflation expectations** (ציפיות לאינפלציה) from the capital market, banks, CPI forwards and forecasters checked against the 1%–3% target, and the **zero-coupon government yield curve** (עקום אפס, nominal and CPI-linked) with break-even inflation per tenor.
It talks directly to the Bank of Israel's free, public [SDMX REST API](https://www.boi.org.il/en/economic-roles/statistics/) at `edge.boi.gov.il`: no API key, no scraping, no third-party FX feed.
Part of a small family of Israeli MCP servers: [hebrew-il-mcp](https://github.com/Shtibel1/hebrew-il-mcp) (local validators: ID, phone, VAT, IBAN, plates, holidays) and [il-opendata-mcp](https://github.com/Shtibel1/il-opendata-mcp) (data.gov.il datasets).
## Tools
| Tool | What it does |
| --- | --- |
| `list_currencies` | No network. The 14 currencies the BOI publishes a representative rate for (USD, EUR, GBP, JPY, CHF, CAD, AUD, DKK, NOK, SEK, ZAR, JOD, EGP, LBP), with English and Hebrew names and the quoting unit. |
| `get_latest_rates` | Latest published rate for all currencies (or a `currencies` subset) in **one** SDMX request (`lastNObservations=1`). Each entry has `rate` as published, `unit`, `ils_per_unit` and its own `date`. |
| `get_rate` | Rate for one `currency` on a `date` (default: today in Israel). Weekends and holidays fall back to the previous business day, flagged with `is_fallback` and `days_back`. Future dates are rejected. |
| `get_rate_history` | Daily rates between `start_date` and `end_date` (≤ ~10 years). Returns `count`, `first`/`last`, `min`/`max` with dates, `change` and `change_pct`, plus the observations (the most recent 400 if longer; stats always cover the whole range). |
| `convert_currency` | Convert `amount` between ILS (also `NIS`, `₪`, `שקל`) and any supported currency, or between two foreign currencies via ILS, on the latest or a historical `date`. Returns the result, the cross rate and the rate date used for each leg. |
| `compare_currencies` | Rank several `currencies` (default USD, EUR, GBP, JPY, CHF) by how they moved against the shekel between `start_date` and `end_date`, in **one** SDMX request. Per currency: first/last/min/max, `change_pct` and the inverse `ils_change_pct`, mean, daily and annualized volatility of log returns, the largest single-day move and the max drawdown; plus `strongest`, `weakest` and `ils_vs_basket_pct` (the shekel against the equal-weight basket). |
| `get_effective_exchange_rate` | The shekel's **nominal effective exchange rate** (שער החליפין הנומינלי האפקטיבי, series `NER_ILS_BSK_IDX`): the BOI's daily trade-weighted index against the basket of Israel's main trading partners, 2015-01-01 = 100, quoted as shekels per basket (a **rise = weaker shekel**). Between `start_date` (default one year back) and `end_date`: first/last/min/max, `change_pct`, the shekel's own move `ils_change_pct` with `shekel_direction`, `ils_vs_base_pct` since 2015, mean, daily/annualized volatility, largest daily move, max drawdown and the daily values. |
| `get_inflation_expectations` | Inflation expectations (ציפיות לאינפלציה) from the BOI `ZCM` dataflow for the latest month on or before `month` (YYYY-MM): 1-year expectations from four independent sources (capital-market break-even, banks' internal rates, CPI forward contracts, forecasters), 5- and 10-year capital-market expectations, and forwards for year 2, year 3, years 3–5 and years 5–10. Each with `vs_target` (below/within/above the 1%–3% target), `gap_from_midpoint_pp`, `change_pp` over the window and monthly `history` (`months_back`, default 12). Plus the target range, the 1-year `mean`/`min`/`max` and `anchored` (all long-run measures inside the target). |
| `get_yield_curve` | Nominal (1–15y) and real CPI-linked (1–20y) zero-coupon government yields (עקום אפס) for the latest month on or before `month`, with `breakeven_inflation` per tenor, the change in basis points versus `compare_months_back` months earlier (default 12), the 10y−1y and 10y−2y spreads and the curve `shape` (normal / flat / inverted). |
| `get_interest_rate` | The BOI policy rate (ריבית בנק ישראל) on a `date`, `effective_since` and every change in the look-back window (default 2 years, or `since`) with the previous rate and the change in basis points. |
### Resources
| URI | Content |
| --- | --- |
| `boi://currencies` | The supported currencies (same as `list_currencies`), no network |
| `boi://rates/latest` | Snapshot of the latest representative rates for all 14 currencies |
| `boi://interest-rate` | The current policy rate with its changes over the last two years |
| `boi://inflation-expectations` | Latest inflation expectations versus the target, with 12 months of history |
| `boi://yield-curve` | Latest nominal and real zero-coupon curves with break-evens and 12-month changes |
Clients that support MCP resources (e.g. attaching context in Claude Desktop) can pull these without a tool call.
Every tool returns both human-readable JSON text and `structuredContent`. Bad input (unknown currency, malformed or future date, empty range) produces an MCP `isError` result with a clear message instead of crashing the session.
Currency inputs are forgiving: `usd`, `$`, `€`, `£`, `¥`, `דולר`, `יורו` all work.
### Details that are easy to get wrong
- **Quoting units.** The BOI quotes JPY per **100** yen and LBP per **10** pounds (`UNIT_MULT` in SDMX). `rate` is kept exactly as published and `ils_per_unit` is normalized, so conversions are always right.
- **"Today" is Israeli time.** Dates default to `Asia/Jerusalem`, not UTC, so a request at 01:00 in Tel Aviv asks for the right day.
- **Caching.** Responses are cached in memory per request URL: 5 minutes for anything that can still change (latest rates, ranges ending today) and 6 hours for ranges that end before today. Concurrent identical calls share one request, errors are never cached, and the stateless HTTP mode shares one cache across all requests. Tune with `--cache-ttl <seconds>` / `BOI_CACHE_TTL` (`0` disables).
- **Monthly data lags a month.** Inflation expectations and the yield curve are monthly averages published after the month ends, so asking for the current month returns the latest published one (`as_of`), and a slower source shows its own `month`. The curve's break-evens use the exact Fisher form `(1+n)/(1+r)−1` and reproduce the BOI's own 1/5/10-year capital-market expectation series to four decimals.
- **No data ≠ error.** The API answers HTML `404` when a query matches nothing (e.g. a Saturday). The client maps that to "no observations" and the tools fall back or explain.
## Quick start
### Claude Desktop / Cursor / any MCP client
```json
{
"mcpServers": {
"boi": {
"command": "npx",
"args": ["-y", "github:Shtibel1/boi-mcp"]
}
}
}
```
Claude Desktop: put this in `claude_desktop_config.json`. Cursor: `~/.cursor/mcp.json` (or `.cursor/mcp.json` in a project).
Or from a local clone:
```bash
npm install && npm run build
node dist/cli.js # speaks MCP over stdio
```
Then ask your agent things like:
- "What is the dollar's representative rate today, and how did it move this month?"
- "Convert 2,500 EUR to shekels at the rate of 2026-10-04."
- "מה ריבית בנק ישראל ומתי היא השתנתה לאחרונה?"
- "Are Israeli inflation expectations anchored inside the target? How did the yield curve change over the last year?"
### Hosted: Streamable HTTP
```bash
npx -y github:Shtibel1/boi-mcp --http --port 3000
# → boi-mcp listening on http://127.0.0.1:3000/mcp
curl http://127.0.0.1:3000/healthz # {"status":"ok","name":"boi-mcp","version":"0.4.0"}
```
```json
{ "mcpServers": { "boi": { "url": "http://127.0.0.1:3000/mcp" } } }
```
| Flag | Env | Default | Notes |
| --- | --- | --- | --- |
| `--http` | | off | Serve [Streamable HTTP](https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#streamable-http) instead of stdio |
| `--port` | `PORT` | `3000` | |
| `--host` | `HOST` | `127.0.0.1` | Binds to loopback by default; use `0.0.0.0` inside a container |
| `--allowed-origin` | `ALLOWED_ORIGINS` | none | Repeatable flag, or a comma-separated env var. Browser requests from any other `Origin` get `403` (DNS-rebinding protection); non-browser clients without `Origin` are always allowed |
| `--cache-ttl` | `BOI_CACHE_TTL` | `300` | Seconds to cache live responses; past ranges are kept 6 hours. `0` disables caching (works in stdio mode too) |
| `--version` | | | Print the version and exit |
The HTTP mode is **stateless**: every `POST /mcp` gets a fresh server and transport, there are no session ids, and `GET`/`DELETE /mcp` return `405`, so instances can sit behind any load balancer. Bodies over 1 MB get `413`, malformed JSON gets `400`.
### Docker
The image runs the HTTP mode as the unprivileged `node` user on `0.0.0.0:3000` with a `HEALTHCHECK` against `/healthz`:
```bash
docker build -t boi-mcp .
docker run --rm -p 3000:3000 -e ALLOWED_ORIGINS=https://app.example boi-mcp
```
CI builds the image on every push and smoke-tests it: health check, a real `tools/list` call, the origin guard and the non-root user.
### As a library
```ts
import { BoiClient } from "boi-mcp";
const boi = new BoiClient();
const { rates } = await boi.getLatestRates(["USD", "EUR"]);
const onSunday = await boi.getRate("USD", "2026-10-04"); // → Friday 2026-10-02, is_fallback: true
const history = await boi.getRateHistory("EUR", "2026-10-01", "2026-11-14");
const { result } = await boi.convert({ amount: 100, from: "EUR", to: "JPY" });
const policy = await boi.getInterestRate();
const year = await boi.compareCurrencies({ currencies: ["USD", "EUR", "GBP"], start_date: "2025-11-16" });
// year.strongest, year.ils_vs_basket_pct, year.currencies[0].annualized_volatility_pct …
const expectations = await boi.getInflationExpectations({ months_back: 24 }); // .anchored, .one_year, .measures
const curve = await boi.getYieldCurve({ month: "2008-12", compare_months_back: 6 }); // .points[].breakeven_inflation, .shape
// Cache options (defaults shown); cacheTtlMs: 0 disables caching
new BoiClient({ cacheTtlMs: 300_000, historicalCacheTtlMs: 21_600_000, cacheMaxEntries: 256 });
```
## Live example
Real output from the built server against the live Bank of Israel API, run on **2026-11-15** (Sunday, Asia/Jerusalem — the latest rates are Friday's):
| Call | Result |
| --- | --- |
| `get_latest_rates` | as of **2026-11-13**: USD **3.199**, EUR **3.5394**, GBP **4.2365**, JPY **2.0009** per 100 (0.020009 per yen) |
| `get_rate { currency: "usd", date: "2026-11-14" }` | 3.199 from **2026-11-13**, `is_fallback: true`, `days_back: 1` (Saturday) |
| `get_rate_history { EUR, 2026-10-01 → 2026-11-14 }` | 31 business days, 3.4826 → 3.5394 (**+1.63%**), min 3.4291 on 2026-10-09, max 3.5724 on 2026-11-06 |
| `convert_currency { 1000 USD → ILS }` | **3,199 ILS** |
| `convert_currency { 100 EUR → JPY }` | **17,689.0399 JPY** (cross rate 176.8904 via ILS) |
| `get_effective_exchange_rate {}` (run 2026-11-19) | 244 business days 2025-11-19 → 2026-11-18: index 67.41 → 66.10 (**−1.94%**, shekel **+1.98%** vs the trade-weighted basket, `strengthened`), low 58.42 on 2026-05-29, max drawdown −13.73%, annualized vol 8.34%; the shekel is **+51.28%** stronger than at the 2015 base |
| `get_inflation_expectations {}` (run 2026-11-24) | as of **2026-10**, all ten measures inside the 1%–3% target, `anchored: true`: 1-year capital market **1.74%**, banks 1.84%, CPI forwards 1.83%, forecasters 2.08% (mean 1.87%); 5-year 1.92%, 10-year 1.95%; 5–10y forward 1.99% (−0.42 pp in 12 months) |
| `get_yield_curve {}` (run 2026-11-24) | **2026-10** vs 2025-10: nominal 1y **3.11%** (−80 bp), 10y **4.24%** (+27 bp), 10y−1y **+113 bp** (`normal`, steepened as rates were cut); real 10y 2.24% (+47 bp); 10-year break-even 1.95% |
| `get_interest_rate` | **3.25%** since 2026-09-03; five −25 bp cuts since 4.5% (2025-11-27, 2026-01-08, 2026-05-28, 2026-07-09, 2026-09-03) |
`compare_currencies { USD, EUR, GBP, JPY, CHF, CAD, start_date: 2025-11-16 }`, run on **2026-11-16** — one request, 243 business days per currency, the shekel up **+3.74%** against the equal-weight basket:
| Rank | Currency | 2025-11-16 → 2026-11-16 | Change vs ILS | Shekel vs it | Annualized vol | Max drawdown | Largest day |
| --- | --- | --- | --- | --- | --- | --- | --- |
| 1 | GBP | 4.2722 → 4.2365 | −0.84% | +0.84% | 8.61% | −12.95% | −2.18% on 2026-03-02 |
| 2 | USD | 3.241 → 3.199 | −1.30% | +1.31% | 9.34% | −14.35% | −1.75% on 2026-04-09 |
| 3 | CAD | 2.3102 → 2.2439 | −2.87% | +2.95% | 9.26% | −13.02% | +2.12% on 2026-03-09 |
| 4 | JPY (per 100) | 2.0932 → 2.0009 | −4.41% | +4.61% | 11.11% | −16.21% | +3.09% on 2026-01-26 |
| 5 | EUR | 3.7594 → 3.5394 | −5.85% | +6.22% | 8.41% | −13.82% | −2.25% on 2026-03-02 |
| 6 | CHF | 4.0747 → 3.8246 | −6.14% | +6.54% | 9.10% | −12.67% | −1.89% on 2026-03-02 |
The first call took ~2.8 s; the identical second call was served from the cache in ~2 ms.
<details>
<summary>Raw <code>get_rate</code> response</summary>
```json
{
"currency": "USD",
"name": "US Dollar",
"name_he": "דולר ארה\"ב",
"rate": 3.199,
"unit": 1,
"ils_per_unit": 3.199,
"date": "2026-11-13",
"requested_date": "2026-11-14",
"is_fallback": true,
"days_back": 1,
"source": "Bank of Israel SDMX API (edge.boi.gov.il)"
}
```
</details>
## Architecture
```mermaid
flowchart LR
C["MCP client<br/>(Claude Desktop, Cursor, agents)"] -- stdio --> CLI[cli.ts]
R["Remote agents"] -- "POST /mcp" --> H["http.ts<br/>stateless Streamable HTTP<br/>origin check · /healthz"]
CLI --> S["server.ts<br/>zod schemas · isError results"]
CLI -- "--http" --> H
H -- "new server per request<br/>shared BoiClient" --> S
S --> BOI
subgraph L["src/lib — no MCP imports"]
BOI["boi.ts<br/>injectable fetch · SDMX client<br/>fallback · conversion · comparison"]
CACHE["cache.ts<br/>TTL · in-flight dedupe"]
STATS["stats.ts<br/>volatility · drawdown"]
EFF["effective.ts<br/>NEER index stats"]
ZCM["zcm.ts<br/>expectations · yield curve"]
BOI --> ZCM
BOI --> CACHE
BOI --> STATS
BOI --> EFF
EFF --> STATS
CSV["csv.ts<br/>RFC 4180 parser"]
CUR["currencies.ts<br/>14 currencies · units · aliases"]
DT["dates.ts<br/>Asia/Jerusalem today"]
BOI --> CSV
BOI --> CUR
BOI --> DT
end
BOI -- "HTTPS · format=csv" --> API["edge.boi.gov.il<br/>SDMX v2: EXR · BR · ZCM"]
APP["Your TS app"] -- import --> L
```
### How the data is fetched
| Need | SDMX query (dataflow `BOI.STATISTICS`) |
| --- | --- |
| Latest rates | `EXR/1.0/RER_USD_ILS+RER_EUR_ILS+…?lastNObservations=1` |
| Rate on a date (with fallback) | `EXR/1.0/RER_USD_ILS?endperiod=2026-10-04&lastNObservations=1` |
| History | `EXR/1.0/RER_EUR_ILS?startperiod=…&endperiod=…` |
| Currency comparison | `EXR/1.0/RER_USD_ILS+RER_EUR_ILS+…?startperiod=…&endperiod=…` |
| Effective exchange rate | `EXR/1.0/NER_ILS_BSK_IDX?startperiod=…&endperiod=…` |
| Policy interest rate | `BR/1.0/MNT_RIB_BOI_D?startperiod=…&endperiod=…` |
| Inflation expectations | `ZCM/1.0/EXP_EXP_01Y_BI_MA+…+EXP_EXB_FRW_ZD_05Y_10Y_MA?startperiod=2025-11&endperiod=2026-11` and `ZCM/1.0/INF_MIN_TRGT_D+INF_MAX_TRGT_D?endperiod=…&lastNObservations=1` (in parallel) |
| Yield curve | `ZCM/1.0/ZC_TSB_ZND_01Y_MA+…+ZC_TSB_ZRD_20Y_MA?startperiod=…&endperiod=…` (17 series, one request) |
All with `format=csv`. The fallback is done by the API itself (`endperiod` + `lastNObservations=1`), so a holiday week never needs a retry loop.
### Layout
```
src/
lib/boi.ts injectable-fetch SDMX client: rates, fallback, history stats, conversion, policy rate
lib/effective.ts nominal effective exchange rate (NER_ILS_BSK_IDX) metadata and index statistics
lib/zcm.ts ZCM dataflow: inflation-expectation measures, target check, zero-coupon curves and break-evens
lib/stats.ts mean, sample stdev, log-return volatility (annualized ×√252), largest move, max drawdown
lib/cache.ts promise-based TTL cache with in-flight de-duplication and LRU-style eviction
lib/csv.ts small RFC 4180 CSV parser (quoted Hebrew comments, doubled quotes, CRLF, BOM)
lib/currencies.ts supported currencies, quoting units, Hebrew names and aliases
lib/dates.ts Asia/Jerusalem "today", strict YYYY-MM-DD validation
server.ts MCP tool and resource wiring (zod schemas)
http.ts stateless Streamable HTTP transport (node:http, no framework)
cli.ts entry: stdio by default, --http for hosted mode
test/
fixtures/ real BOI API responses captured on 2026-11-15/16/19/24 (see fixtures/README.md)
*.test.ts 104 vitest tests; fetch is mocked with the fixtures, so CI never hits the network
```
## Development
```bash
npm test # vitest, replaying recorded BOI responses (no network)
npm run typecheck
npm run build
```
## Attribution
This is an unofficial client. Exchange rates and interest rates come from the [Bank of Israel](https://www.boi.org.il) and are subject to its terms of use. Representative rates are reference rates, not dealing quotes. This project has no affiliation with the Bank of Israel.
## Roadmap
- [ ] Publish to npm so `npx boi-mcp` works without the GitHub shorthand
- [x] Nominal effective exchange rate of the shekel (v0.3.0)
- [ ] USD/ILS implied and actual volatility (`WEB_STD_IMPVOL_*`, `EXR_STD_ACTUAL_USDILS`) from the same EXR dataflow
- [ ] Real effective exchange rate (not published in the BOI SDMX API as of 2026-11)
- [x] Inflation expectations and the zero-coupon yield curve (v0.4.0)
- [ ] CPI index series (`PRI` dataflow); see also [cbs-mcp](https://github.com/Shtibel1/cbs-mcp) for the official CBS price indices
- [x] In-memory response cache shared across stateless HTTP requests (v0.2.0)
- [x] Multi-currency comparison with volatility and drawdown (v0.2.0)
- [ ] Render / Fly one-click deploy
## Contributing
Issues and PRs are welcome. Keep API logic in `src/lib` with unit tests and add an end-to-end case in `test/server.test.ts` for new tools. New fixtures must be real captured responses — never hand-written API data.
## License
[MIT](LICENSE) © Nadav Shtibel
TDQS
Scored across 10 tools
Most tools target clearly distinct resource+action pairs (policy rate, single rate, latest rates, history, conversion, comparison, NEER, inflation expectations, yield curve). The main overlap is between get_rate, get_latest_rates and get_rate_history, all of which return exchange rates, though their descriptions (single-date-with-fallback vs all-currencies-latest vs range-with-stats) make the boundaries reasonably clear. compare_currencies and get_rate_history also overlap in returning volatility/drawdown stats, but differ in single- vs multi-currency scope.
Every tool follows a consistent snake_case verb_noun pattern (get_, list_, convert_, compare_). The get_* family is uniform and predictable, with descriptive noun suffixes that clearly signal the resource. No mixing of conventions or vague verbs.
Ten tools is well within the ideal 3-15 range and every tool maps to a distinct BOI data product. There are no filler or redundant tools; the set is tightly scoped to the domain.
The surface covers the major BOI series (policy rate, FX rates, conversion, NEER, inflation expectations, yield curve) with good historical and stats support. Minor gaps exist—e.g., no actual CPI/inflation prints (only expectations), no GDP or monetary aggregates, and no announcement/calendar data—but these are workaroundable and don't block core workflows.