Native TypeScript IMF Data client โ calls the IMF SDMX 3.0
REST API at https://dataservices.imf.org/REST/SDMX_3.0/ directly
via fetch(), with no external MCP server process.
Historical note: the first Wave-1 iteration delegated to the Python
c-cf/imf-data-mcp MCP server. That dependency blocked Wave 0 rollout
because the upstream project is a Python git-URL package (not npm) and
could not be pinned to an integrity hash per the ISMS Secure Development
Policy ยง7. This module replaces the Python transport with a direct,
typed HTTP client โ the public API is preserved so callers
(src/utils/imf-data.ts, validator fingerprints, workflow probes) are
untouched.
Public API (unchanged from the MCP-backed iteration)
IMFMCPClient โ class with semantic wrappers for five "tools".
IMF_MCP_TOOLS โ stable virtual tool-name list used by the
content-validator fingerprint and the workflow probe.
The return envelope of every method is MCPToolResult
({ content: [{ type: "text", text: "<json>" }] }) so downstream code
that already calls parseSDMXJSON(response.content[0]?.text) continues
to work unmodified.
Transport
Uses the native Node 25 fetch() โ no extra runtime dependency.
Every call has an independent AbortController with a configurable
timeout (IMF_API_TIMEOUT_MS, default 30 s).
Errors (HTTP 4xx/5xx, network faults, JSON parse failures, abort) are
caught and converted to the IMF_FALLBACK envelope. Callers
upstream can therefore treat "no IMF" as "empty data" without
defensive try/catch, matching the WorldBankMCPClient pattern.
Environment variables:
IMF_API_BASE_URL โ override base URL (default
https://dataservices.imf.org/REST/SDMX_3.0).
Legacy env vars (IMF_MCP_GATEWAY_URL, IMF_MCP_GATEWAY_API_KEY,
IMF_MCP_SERVER_PATH) are no longer consulted โ no gateway is needed
because the IMF SDMX 3.0 API is an unauthenticated public endpoint.
Description
Native TypeScript IMF Data client โ calls the IMF SDMX 3.0 REST API at https://dataservices.imf.org/REST/SDMX_3.0/ directly via
fetch(), with no external MCP server process.Historical note: the first Wave-1 iteration delegated to the Python
c-cf/imf-data-mcpMCP server. That dependency blocked Wave 0 rollout because the upstream project is a Python git-URL package (not npm) and could not be pinned to an integrity hash per the ISMS Secure Development Policy ยง7. This module replaces the Python transport with a direct, typed HTTP client โ the public API is preserved so callers (src/utils/imf-data.ts, validator fingerprints, workflow probes) are untouched.Public API (unchanged from the MCP-backed iteration)
The return envelope of every method is MCPToolResult (
{ content: [{ type: "text", text: "<json>" }] }) so downstream code that already callsparseSDMXJSON(response.content[0]?.text)continues to work unmodified.Transport
fetch()โ no extra runtime dependency.AbortControllerwith a configurable timeout (IMF_API_TIMEOUT_MS, default 30 s).WorldBankMCPClientpattern.Environment variables:
IMF_API_BASE_URLโ override base URL (defaulthttps://dataservices.imf.org/REST/SDMX_3.0).IMF_API_TIMEOUT_MSโ per-request timeout (default30000).Legacy env vars (
IMF_MCP_GATEWAY_URL,IMF_MCP_GATEWAY_API_KEY,IMF_MCP_SERVER_PATH) are no longer consulted โ no gateway is needed because the IMF SDMX 3.0 API is an unauthenticated public endpoint.