imf-mcp-server
Provides optional DuckDB-backed DataCanvas integration for staging large IMF SDMX query results and running read-only SQL SELECT queries across them, enabling multi-country comparisons and aggregations.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@imf-mcp-serverget real GDP growth for USA from 2020 to 2024"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Public Hosted Server: https://imf.caseyjhand.com/mcp
Overview
IMF macroeconomic data across 190 countries: World Economic Outlook projections, balance of payments, CPI, exchange rates, national accounts, and hundreds more datasets. Browse the catalog, resolve dimension codes, query time series, and run SQL over large multi-country results. No API key required.
Tools
Tool | Description |
| List IMF SDMX dataflows, with an optional word filter |
| Fetch a dataflow's dimensions and codelists to resolve terms to SDMX codes |
| Query a dataflow by dimension key over a time range |
| List DataCanvas tables and columns staged by |
| Run a read-only SQL SELECT across staged DataCanvas tables |
| Remove one staged table or view; disabled by default |
Resources
Resource | Description |
| Discovery metadata for one dataflow: dimensions, codelist previews, and |
Related MCP server: IMF MCP
Capability reference
imf_list_databases tool
filterkeeps dataflows whose ID, name, or description contains every word (split on spaces and commas, case-insensitive); vintage snapshots such asWEO_2025_OCT_VINTAGEare excluded unlessinclude_vintages=truePaged with
limit(default 50) andoffset; a page holds at most 200, and a largerlimit(up to 1,000) echoesrequested_limit/applied_limit.total_countandreturned_countreport the match and page sizesDescriptions are cut to 200 characters;
imf_get_databasereturns the full text
imf_get_database tool
Resolves terms to SDMX dimension codes (countries are ISO 3-letter:
USA, notUS) and returnskey_format, the dot-separated dimension orderimf_query_datasetrequiresCodelist previews hold 50 entries; set
dimension_idto page one dimension withlimit/offset(at most 200 per page,next_offsetnames the rest), andcodelist_filterto keep codes whose ID or name contains every wordavailable_only=truepages only the codes the dataflow publishes, with series count and time coverage;agency_id/versionare auto-detected when omitted
imf_query_dataset tool
Dot-separated key in DSD order, where
+combines codes at a position and*matches all of them; codes anddataflow_idare case-insensitive.start_period/end_periodacceptYYYY,YYYY-SN,YYYY-QN,YYYY-MM, orYYYY-MM-DD, andlast_n_observations(1–1,000,000) keeps each series' last N observationsReturns
time_period,value,status, and series attributes (unit,scale,decimals,reference_periodwhere published), with oneseries_metadataentry per series. Responses are held to 100,000 characters: with DataCanvas, larger results spill to it (output_mode: "canvas"forces staging, andstagedreports storage); without it, the earliest observations return withtruncated: trueandretrieval_guidanceKey and range errors are
invalid_key_code(with the nearest valid codes),wildcard_in_code_list,key_too_long,response_too_large,no_data, andno_data_in_range; a+key that partly returns lists the rest inmissing_series. Upstream failures aredata_unavailableandrate_limited, both retryable within a 45-second call budget
imf_dataframe_describe tool
Lists every staged table with row count and column names and DuckDB types
Requires
canvas_idfrom animf_query_datasetcall that returnedstaged: true; call it beforeimf_dataframe_queryListed only with
CANVAS_PROVIDER_TYPE=duckdb, like the other dataframe tools
imf_dataframe_query tool
One read-only SQL
SELECTper call; a leadingWITH … SELECTis accepted, DML and DDL are rejectedResults are capped by the canvas row limit (default 10,000), then a 100,000-character response budget;
truncated: truemeans either cap trimmed the result. Page with a stableORDER BYplusLIMIT/OFFSETOversized cells are clipped in the text table while
structuredContentkeeps every value;response_too_largemeans a single row exceeds the budget even soListed only with
CANVAS_PROVIDER_TYPE=duckdb
imf_dataframe_drop tool
Removes one named table or view from a canvas; requires the exact name from
imf_dataframe_describeA repeated or absent drop returns
dropped: falserather than an errorDisabled by default; set
IMF_ENABLE_DATAFRAME_DROP=truealongsideCANVAS_PROVIDER_TYPE=duckdbto register it
imf://database/{dataflow_id} resource
Every dimension with up to 50 codelist entries, plus counts,
key_format, name, and descriptiondataflow_idcomes fromimf_list_databases;continuationmetadata points toimf_get_databasefor codelists beyond the preview
Features
Built on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.
IMF-specific:
Keyless access to the public IMF SDMX 3.0 portal
Typed SDMX 3.0 client that validates the key's dimension count against the DSD before each query
Dataflow catalog and availability constraints cached in-session
DuckDB-backed DataCanvas spill for large multi-country or long time-range results
Agent-friendly output:
Codelist entries carry both the machine code and the human-readable label
key_formatin every dataflow response states the dimension orderObservations carry each dataflow's
statusflags (e.g.T,C,NA) for data-quality caveatsstagedandtruncatedare reported separately, and staged results carrycanvas_id,table_name, and retrieval guidance
Getting started
Public Hosted Instance
A public instance is available at https://imf.caseyjhand.com/mcp — no installation required. Point any MCP client at it via Streamable HTTP:
{
"mcpServers": {
"imf-mcp-server": {
"type": "streamable-http",
"url": "https://imf.caseyjhand.com/mcp"
}
}
}Self-Hosted / Local
No API key required. Add the following to your MCP client configuration file.
{
"mcpServers": {
"imf-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["@cyanheads/imf-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info"
}
}
}
}Or with npx (no Bun required):
{
"mcpServers": {
"imf-mcp-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@cyanheads/imf-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info"
}
}
}
}Or with Docker:
{
"mcpServers": {
"imf-mcp-server": {
"type": "stdio",
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "MCP_TRANSPORT_TYPE=stdio",
"ghcr.io/cyanheads/imf-mcp-server:latest"
]
}
}
}To enable SQL analytics over large result sets, add CANVAS_PROVIDER_TYPE=duckdb to the env block. Add IMF_ENABLE_DATAFRAME_DROP=true only when agents should be able to remove staged tables.
For Streamable HTTP, set the transport and start the server:
MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http
# Server listens at http://localhost:3010/mcpPrerequisites
Bun v1.4.0 or higher (or Node.js v24+).
No API key required.
Installation
Clone the repository:
git clone https://github.com/cyanheads/imf-mcp-server.gitNavigate into the directory:
cd imf-mcp-serverInstall dependencies:
bun installConfigure environment:
cp .env.example .env
# edit .env as needed — no required vars for basic useConfiguration
Variable | Description | Default |
| Set to | — |
| Register |
|
| IMF SDMX 3.0 base URL. |
|
| Per-request timeout in milliseconds. |
|
| Transport: |
|
| Port for HTTP server. |
|
| HTTP session handling: |
|
| Auth mode: |
|
| Log level (RFC 5424). |
|
| Enable OpenTelemetry instrumentation. |
|
See .env.example for the full list of optional overrides.
Running the server
Local development
Build and run:
bun run rebuild bun run start:stdio # or bun run start:httpRun checks and tests:
bun run devcheck # Lint, format, typecheck, security bun run test # Vitest test suite bun run lint:mcp # Validate MCP definitions against spec
Docker
docker build -t imf-mcp-server .
docker run --rm -p 3010:3010 imf-mcp-serverThe Dockerfile defaults to HTTP transport, stateless session mode, and logs to /var/log/imf-mcp-server. OpenTelemetry peer dependencies are installed by default — build with --build-arg OTEL_ENABLED=false to omit them.
Project structure
Directory | Purpose |
|
|
| Server-specific env var parsing and validation with Zod. |
| Tool definitions ( |
| Resource definitions ( |
| DataCanvas accessor — wraps the framework canvas instance. |
| IMF SDMX 3.0 API client — dataflow catalog, DSD fetching, data queries. |
| Unit and integration tests mirroring |
| Design notes and directory tree. |
Development guide
See CLAUDE.md/AGENTS.md for development guidelines and architectural rules. The short version:
Handlers throw, framework catches — no
try/catchin tool logicUse
ctx.logfor request-scoped logging,ctx.statefor tenant-scoped storageRegister new tools and resources via the barrels in
src/mcp-server/*/definitions/index.tsWrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields
Data source
Data is sourced from the International Monetary Fund SDMX 3.0 portal under the IMF Copyright and Terms of Use. The IMF's terms permit redistribution of statistical data with attribution. Each data-returning tool response includes a source field with the required attribution: Source: International Monetary Fund, <dataflow name>, https://data.imf.org/.
Contributing
Issues are welcome. Run checks and tests before submitting:
bun run devcheck
bun run testLicense
Apache-2.0 — see LICENSE for details.
This server cannot be deployed
Maintenance
Related MCP Connectors
330+ indicators for 217 countries from the IMF, World Bank, WHO and national statistics offices.
SDMX Structure MCP — dataflow dimensions and code lists for any SDMX 2.1 registry: Eurostat, OECD…
World Bank Data360 MCP — the World Bank's modern unified data platform.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceEnables querying 29,500+ World Bank development indicators for 200+ countries across 60+ years via MCP, with 7 tools for browsing topics, sources, countries, and indicators.384 npm3Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to query cross-country macroeconomic and financial statistics, including GDP, inflation, fiscal balance, debt, exchange rates, trade, and balance-of-payments data for comparison and time-series analysis.9 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables browsing, searching, and retrieving over 800,000 Federal Reserve economic time series through MCP tools, with category/release/source navigation, keyword and tag filtering, date ranges, frequency aggregation, and data transformations.369 npmAGPL 3.0
- AlicenseNot gradedqualityAmaintenanceEnables users to browse, search, and retrieve over 800,000 economic time series, with transformations, date ranges, and filters, via MCP tools.369 npmAGPL 3.0