
Imf Mcp Server
io.github.cyanheadsv0.4.2更新于 Sep 29, 2026
Query IMF SDMX 3.0 macroeconomic dataflows — WEO, BOP, CPI, exchange rates, 190 countries.
安装
在 SourceWeft 中
- 打开 控制台中的 Imf Mcp Server,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。
其他 MCP 客户端
把它添加到你客户端的 mcpServers 配置中。
{
"mcpServers": {
"imf-mcp-server": {
"type": "http",
"url": "https://imf.caseyjhand.com/mcp"
}
}
}README
@cyanheads/imf-mcp-server
Query IMF SDMX 3.0 macroeconomic data — hundreds of dataflows across 190 countries, WEO projections, BOP, CPI, exchange rates, and national accounts via MCP. STDIO or Streamable HTTP.
Public Hosted Server: https://imf.caseyjhand.com/mcp
Overview
IMF SDMX 3.0 macroeconomic data — hundreds of dataflows spanning WEO projections, balance of payments, CPI, exchange rates, and national accounts across 190 countries. Browse the dataflow catalog, resolve dimension codes, and query time series from any MCP client, with large multi-country results staged to DataCanvas for SQL analysis. Runs as a stdio process, a local Streamable HTTP server, or the public hosted endpoint above.
Tools
Resources
Continuation beyond the resource's bounded codelist preview runs through imf_get_database.
Capability reference
imf_list_databases tool
- Case-insensitive substring filter across ID, name, and description, matched against the full text — not the shortened preview this tool returns
- Vintage (historical snapshot) dataflows such as
WEO_2025_OCT_VINTAGEare excluded by default; setinclude_vintages=trueto include them - Paged:
limit(default 50, max 200) andoffset;total_countreports total matches,returned_countthe page size, and a notice names the nextoffsetwhile matches remain - Descriptions are cut to 200 characters here —
imf_get_databaseand theimf://database/{dataflow_id}resource return the full text
imf_get_database tool
- Resolves human-readable terms to SDMX dimension codes (e.g. "United States" →
USA) and returns each dimension's DSD concept-scheme label - Country codes are ISO 3-letter (
USA,GBR,DEU), not ISO 2-letter (US,GB,DE) key_formatnames the exact dot-separated dimension orderimf_query_datasetrequires- Codelist previews are capped at 50 entries by default; set
dimension_idto page one dimension withlimit/offset(max 200), andcodelist_filterapplies before paging - Set
available_only=trueto page codes the dataflow actually publishes, with series count and time coverage, instead of the full codelist - A
codelist_filterthat matches nothing is reported distinctly from a codelist that could not be resolved — the two need opposite next steps
imf_query_dataset tool
- Dot-separated key in DSD keyPosition order;
+combines codes at one position,*matches every code there — every position needs a code or*, a blank segment is rejected start_period/end_periodacceptYYYY,YYYY-SN,YYYY-QN,YYYY-MM, or a calendar-validYYYY-MM-DD; each bound covers its whole period (end_period: 2023includes2023-M12)- Returns
time_period,value,status, and series attributes (unit,scale,decimals); a key resolving to multiple series carries oneseries_metadataentry per series, since attributes can differ between them unit/scaleare upstream codes (PT,USD,XDC,IX,NUM); anullunit means the dataflow publishes none, and scale"0"means no multiplier- Large multi-country or long-range results automatically spill to DataCanvas (
output_mode: "canvas"forces staging);stagedreports storage,truncatedreports only whetherobservationsis an incomplete preview — a staged result can still be untruncated no_dataerrors carry availability context naming codes that do have coverage; a key with data entirely outside the requested range fails asno_data_in_rangeand reports the range that does
imf_dataframe_describe tool
- Lists every table staged on a canvas, with row count and column schema (name + DuckDB type)
- Requires
canvas_idfrom a priorimf_query_datasetcall that returnedstaged: true - Call before
imf_dataframe_queryto confirm table and column names
imf_dataframe_query tool
- One read-only SQL
SELECTper call; a leadingWITH … SELECTcommon table expression is accepted, DML and DDL are rejected - Results are capped first by the canvas row limit (default 10,000), then by a 100,000-character serialized response budget —
row_countalways equals the returned rows, andtruncated: truemeans either cap trimmed the result - Page past a cap with a stable
ORDER BYplusLIMIT/OFFSET;response_too_largemeans even one row didn't fit and asks for fewer columns or aggregation - Requires
CANVAS_PROVIDER_TYPE=duckdb
imf_dataframe_drop tool
- Removes one named table or view from a canvas without affecting the others; requires the exact name from
imf_dataframe_describe - Idempotent — a repeated or absent drop returns
dropped: falserather than an error - Disabled by default; set
IMF_ENABLE_DATAFRAME_DROP=trueto register it intools/list
imf://database/{dataflow_id} resource
- Bounded discovery metadata for one dataflow — every dimension with up to 50 codelist entries, counts,
key_format, name, description dataflow_idcomes fromimf_list_databases- Carries
continuationmetadata pointing toimf_get_database(withdimension_id/limit/offset) for a codelist 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 — no API key required; the IMF SDMX 3.0 portal is fully public
- Type-safe SDMX 3.0 compact JSON client with dimension/codelist parsing and DSD validation
- Key dimension count validated against the DSD before each query to catch format mismatches early
- Dataflow catalog and full availability constraints cached in-session to minimize round trips on multi-step workflows
- DuckDB-backed DataCanvas spill for large multi-country or long time-range observations
Agent-friendly output:
- Codelist entries carry both the machine code and human-readable label — agents can present meaningful names without a follow-up lookup
key_formatfield in every dataflow response explicitly states the dimension order, removing guesswork for key construction- Observations include
statusflags (e.g.Efor estimate) so agents can communicate data quality caveats - Canvas placement is explicit —
stageddistinguishes storage fromtruncatedpreview completeness, 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:
Self-Hosted / Local
No API key required. Add the following to your MCP client configuration file.
Or with npx (no Bun required):
Or with Docker:
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:
Prerequisites
- Bun v1.4.0 or higher (or Node.js v24+).
- No API key required.
Installation
- Clone the repository:
- Navigate into the directory:
- Install dependencies:
- Configure environment:
Configuration
See .env.example for the full list of optional overrides.
Running the server
Local development
-
Build and run:
-
Run checks and tests:
Docker
The 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
Development guide
See CLAUDE.md/AGENTS.md for development guidelines and architectural rules. The short version:
- Handlers throw, framework catches — no
try/catchin tool logic - Use
ctx.logfor request-scoped logging,ctx.statefor tenant-scoped storage - Register new tools and resources via the barrels in
src/mcp-server/*/definitions/index.ts - Wrap 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:
License
Apache-2.0 — see LICENSE for details.
来源:README.md,提交 823d15d
工具
0版本历史
2- v0.4.2最新Sep 20, 2026
- v0.4.1Sep 16, 2026