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 (IMFMCPClient, five tool methods,
MCPToolResult-shaped envelope) is stable across the migration. The
earlier companion module src/utils/imf-data.ts (SDMX-JSON parser,
indicator/country maps, HTML builders) was purged in the April-2026
aggregator-pipeline migration โ callers now consume the raw SDMX-JSON
envelope returned by IMFMCPClient.fetchData directly.
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
Stage-C editorial fingerprint and the workflow probe. Drift-guarded
by test/integration/mcp/imf-mcp.test.js.
The return envelope of every method is MCPToolResult
({ content: [{ type: "text", text: "<json>" }] }). The text payload
is the raw SDMX-JSON document returned by the IMF REST endpoint;
downstream code parses it with any standard SDMX-JSON reader.
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 (IMFMCPClient, five tool methods,MCPToolResult-shaped envelope) is stable across the migration. The earlier companion modulesrc/utils/imf-data.ts(SDMX-JSON parser, indicator/country maps, HTML builders) was purged in the April-2026 aggregator-pipeline migration โ callers now consume the raw SDMX-JSON envelope returned by IMFMCPClient.fetchData directly.Public API (unchanged from the MCP-backed iteration)
test/integration/mcp/imf-mcp.test.js.The return envelope of every method is MCPToolResult (
{ content: [{ type: "text", text: "<json>" }] }). Thetextpayload is the raw SDMX-JSON document returned by the IMF REST endpoint; downstream code parses it with any standard SDMX-JSON reader.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.