Skip to main content
Glama
centralbank-data MCP Server

centralbank-data MCP Server

by benjamin-di
README.md
# centralbank-data

Unified **Python SDK**, **CLI**, **local metadata catalog & cache**, and **MCP server** for European and UK central bank data warehouses — starting with the **European Central Bank (ECB)**.

`centralbank-data` is built **library-first** with a **2-dependency pure-Python core** (`httpx` + `defusedxml`): downstream Python applications, risk/analytics pipelines, and notebooks can import the core package directly with zero MCP, pandas, pyarrow, or lxml overhead, while AI agents query the exact same normalized service through a compact, read-only MCP surface.

> **Status:** Architecture, warehouse reference, and phased roadmap verified against live endpoints (pre-`0.1.0`). Implementation begins with Phase 1 (core engine, SDMX 2.1 dialect engine, ECB Data Portal, `cbdata` CLI, and 5-tool FastMCP 4 server).

## Why this exists

European and UK central banks publish rich, free, authoritative macroeconomic and financial datasets — policy rates, yield curves, exchange rates, HICP inflation, money supply, bank lending surveys, credit aggregates, and balance sheets — but their data warehouses are fragmented across:

- **SDMX 2.1 / 3.0 REST APIs** (ECB, Deutsche Bundesbank, Norges Bank, National Bank of Belgium, BIS, Eurostat)
- **Custom REST / Cube & StatBank APIs** (Swiss National Bank, Sveriges Riksbank, Danmarks Nationalbank)
- **Legacy CSV endpoints** (Bank of England IADB)

Working directly against these warehouses has two recurring friction points:
1. **Cryptic series keys & heavy metadata**: querying ECB requires knowing keys like `FM.D.U2.EUR.4F.KR.DFR.LEV` across 215 SDMX dataflows; Bank of England IADB has no search API at all; Eurostat's dataflow catalog alone is 7.08 MB (8,167 datasets).
2. **Inconsistent wire formats & dialects**: CSV delimiters (`,` vs `;`, locale-dependent on Bundesbank), UTF-8 BOMs, missing-value tokens (`"."` on Bundesbank, blank cells on BoE), non-ISO dates (`02 Jan 2026`, `2026M11D26`), and historical revisions vary by bank.

`centralbank-data` solves both once:
- **Normalized data model**: exact-key `SeriesID` (`<provider>:<dataset>:<key>`), one `Observation` schema with full-series atomic replace caching, and canonical cross-bank indicator mappings.
- **Local SQLite FTS5 catalog & observation cache**: plain-English search (sanitized against FTS5 syntax errors) across dataflows, codelists, and curated series without dumping megabytes of SDMX XML into LLM context.
- **Multiple thin interfaces over one synchronous core**:
  - **Python SDK** (`pip install centralbank-data`) — 2 pure-Python deps (`httpx`, `defusedxml`), zero MCP/pandas/pyarrow/lxml bloat.
  - **CLI** (`cbdata`) — ad-hoc inspection, catalog sync, CSV/JSON output.
  - **MCP server** (`pip install "centralbank-data[mcp]"`) — compact, read-only 5-tool FastMCP 4 server over stdio or Streamable HTTP.

## Roadmap (10 High-Signal Providers)

| Phase | Central Banks / Hubs | Protocol Family |
|---|---|---|
| **Phase 1 (`v0.1.0`)** | **ECB** (215 dataflows on `data-api.ecb.europa.eu`) | SDMX 2.1 dialect engine (`defusedxml` + `csv`) |
| **Phase 2 (`v0.2.0`)** | **Bank of England (BoE IADB)** + **BIS**, **Bundesbank**, **Norges Bank**, **Eurostat**, **NBB** | BoE IADB CSV adapter + 5 SDMX profiles + `cb_compare_indicators` |
| **Phase 3 (`v0.3.0`)** | **SNB**, **Sveriges Riksbank** (SWEA + SWESTR), **Danmarks Nationalbank** | Non-Eurozone sovereign REST / Cube / StatBank adapters |

*(Narrow FX-only/SOAP adapters and redundant/WAF-blocked Eurozone NCBs are documented in [docs/CENTRAL_BANKS.md](docs/CENTRAL_BANKS.md) and intentionally parked — their headline FX and policy rates are already covered via ECB and BIS.)*

## Documentation

- [Architecture & Design](docs/DESIGN.md) — system layers, exact-key data model, full-replace SQLite WAL cache, SDMX dialect profiles, CLI/MCP contracts, verification bar, and prior-art record.
- [Central Bank Data Warehouses](docs/CENTRAL_BANKS.md) — live-verified technical reference of the 10 target institutions plus parked/blocked European central banks.
- [Provider Capability Matrix](docs/PROVIDERS.md) — per-provider scope, status, dialect quirks, and documented limits.
- [Permissions & Multi-User Model](docs/PERMISSIONS.md) — read-only public-data boundary and HTTP bearer contract.
- [Contributing](CONTRIBUTING.md) · [Security](SECURITY.md) · [Changelog](CHANGELOG.md)

## License

Apache-2.0 — see [LICENSE](LICENSE).