Base URL currently in use (read-only — set at construction time).
The fully-qualified IMF SDMX base URL (no trailing slash).
Per-request timeout in milliseconds.
The timeout currently applied to every fetch() call.
Mark the client as ready. HTTP is stateless so there is no real
connection, but callers historically invoke connect() before use —
this is preserved for API compatibility and also exercises the
base URL to catch misconfiguration early.
A resolved promise; never throws for valid URLs.
Whether connect has been called successfully.
true after a successful connect; reset by disconnect.
Reset the connected flag. No real socket to close.
List every IMF database (dataflow) exposed by the SDMX 3.0 API.
Virtual tool: imf-list-databases.
MCP-shaped result whose content[0].text carries a JSON
array of { id, name, description } entries. Empty on error.
Search IMF databases by free-text keyword (case-insensitive substring match against id / name / description).
Virtual tool: imf-search-databases. Runs client-side over the
full dataflow list so a single SDMX round-trip serves every
keyword query in a workflow run.
Free-text keyword (e.g. "inflation", "trade").
Filtered list in MCP-shaped result; empty on error or when keyword is blank.
Fetch the dimension (parameter) definitions for a specific IMF dataflow. Essential before building an SDMX key for fetchData because each database has its own dimension set.
Virtual tool: imf-get-parameter-defs.
IMF dataflow identifier (e.g. "WEO", "IFS").
MCP-shaped result whose content[0].text carries the
ordered list of dimensions ([{ id, name }]). Empty on error.
List valid codes for a single dimension of an IMF dataflow, with an optional free-text filter to narrow the result.
Virtual tool: imf-get-parameter-codes. The underlying SDMX
/codelist/ endpoint is used, looked up from the datastructure so
the caller does not need to know the codelist identifier ahead of
time.
IMF dataflow identifier.
Dimension name (e.g. "country", "indicator").
Optionalsearch: stringOptional free-text search (case-insensitive substring).
MCP-shaped result with [{ id, name }] rows; empty on error.
Fetch a time-series slice from an IMF dataflow as SDMX-JSON.
Virtual tool: imf-fetch-data. The response is already in SDMX-JSON
format, so parseSDMXJSON (src/utils/imf-data.ts) can
consume response.content[0]?.text directly without reshaping.
Fetch parameters.
IMF dataflow ID ("WEO", "IFS", ...).
Inclusive start year (e.g. 2015).
Inclusive end year (e.g. 2030 for WEO forecasts).
Map of dimension → selected codes.
OptionaldimensionOrder?: readonly string[]Optional override of the dimension order used to build the SDMX key. Defaults to defaultDimensionOrder for the database.
MCP-shaped result whose content[0].text carries the raw
SDMX-JSON response. Empty on error or invalid inputs.
Private_InternalBuild a full URL and GET it as text, enforcing the client-wide timeout.
Path (already URL-encoded) to append to the base URL.
Response body (text/* or application/*) as a string.
Private_InternalGET a URL and parse the response body as JSON.
Narrow response type declared by the caller.
Path to append to the base URL.
Parsed JSON value.
Private Readonly_Private Readonly_Private Readonly_Optionalinit: RequestInitOptionalinit: RequestInitPrivate_
Native TypeScript client for the IMF SDMX 3.0 REST API.
Despite the historical class name, no MCP server process is involved — the class keeps the name
IMFMCPClientpurely to avoid breaking the existing import surface (src/index.ts, test suites, documentation). New code is welcome to import it asIMFClient(alias below).