{"id":50993830,"url":"https://github.com/cyanheads/imf-mcp-server","last_synced_at":"2026-06-20T06:32:34.760Z","repository":{"id":362726133,"uuid":"1259945350","full_name":"cyanheads/imf-mcp-server","owner":"cyanheads","description":"Query IMF SDMX 3.0 macroeconomic data — 193 dataflows, 190 countries, WEO projections, BOP, CPI, exchange rates, and national accounts via MCP. STDIO or Streamable HTTP. ","archived":false,"fork":false,"pushed_at":"2026-06-13T03:45:41.000Z","size":660,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-13T05:22:26.995Z","etag":null,"topics":["ai-agents","ai-tools","cyanheads","economics","imf","mcp","mcp-server","model-context-protocol","sdmx","statistics","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@cyanheads/imf-mcp-server","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cyanheads.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-06-05T02:35:04.000Z","updated_at":"2026-06-13T03:45:39.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/cyanheads/imf-mcp-server","commit_stats":null,"previous_names":["cyanheads/imf-mcp-server"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/cyanheads/imf-mcp-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyanheads%2Fimf-mcp-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyanheads%2Fimf-mcp-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyanheads%2Fimf-mcp-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyanheads%2Fimf-mcp-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cyanheads","download_url":"https://codeload.github.com/cyanheads/imf-mcp-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyanheads%2Fimf-mcp-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34560265,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-20T02:00:06.407Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-agents","ai-tools","cyanheads","economics","imf","mcp","mcp-server","model-context-protocol","sdmx","statistics","typescript"],"created_at":"2026-06-20T06:32:34.058Z","updated_at":"2026-06-20T06:32:34.734Z","avatar_url":"https://github.com/cyanheads.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003e@cyanheads/imf-mcp-server\u003c/h1\u003e\n  \u003cp\u003e\u003cb\u003eQuery IMF SDMX 3.0 macroeconomic data — 193 dataflows, 190 countries, WEO projections, BOP, CPI, exchange rates, and national accounts via MCP. STDIO or Streamable HTTP.\u003c/b\u003e\n  \u003cdiv\u003e5 Tools • 1 Resource\u003c/div\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![Version](https://img.shields.io/badge/Version-0.2.1-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square\u0026logo=docker\u0026logoColor=white)](https://github.com/users/cyanheads/packages/container/package/imf-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^1.29.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/imf-mcp-server?style=flat-square\u0026logo=npm\u0026logoColor=white)](https://www.npmjs.com/package/@cyanheads/imf-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-^6.0.3-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.3.11-blueviolet.svg?style=flat-square)](https://bun.sh/)\n\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![Install in Claude Desktop](https://img.shields.io/badge/Install_in-Claude_Desktop-D97757?style=for-the-badge\u0026logo=anthropic\u0026logoColor=white)](https://github.com/cyanheads/imf-mcp-server/releases/latest/download/imf-mcp-server.mcpb) [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=imf-mcp-server\u0026config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBjeWFuaGVhZHMvaW1mLW1jcC1zZXJ2ZXIiXX0=) [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=for-the-badge\u0026logo=visualstudiocode\u0026logoColor=white)](https://vscode.dev/redirect?url=vscode:mcp/install?%7B%22name%22%3A%22imf-mcp-server%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40cyanheads%2Fimf-mcp-server%22%5D%7D)\n\n[![Framework](https://img.shields.io/badge/Built%20on-@cyanheads/mcp--ts--core-67E8F9?style=flat-square)](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)\n\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n**Public Hosted Server:** [https://imf.caseyjhand.com/mcp](https://imf.caseyjhand.com/mcp)\n\n\u003c/div\u003e\n\n---\n\n## Tools\n\nFive tools covering the full IMF SDMX 3.0 query workflow, plus a DuckDB-backed canvas layer for SQL analytics over large multi-country result sets:\n\n| Tool | Description |\n|:-----|:------------|\n| `imf_list_databases` | List all IMF SDMX dataflows available on the portal (193 total), with optional name/ID substring filtering |\n| `imf_get_database` | Fetch a dataflow's dimension list and complete codelist — resolves human terms to SDMX codes before querying |\n| `imf_query_dataset` | Query a dataflow by dimension key over a time range; large result sets spill to DataCanvas |\n| `imf_dataframe_describe` | List DataCanvas tables and columns staged by a prior `imf_query_dataset` call |\n| `imf_dataframe_query` | Run a read-only SQL SELECT across staged DataCanvas tables for multi-country comparisons and aggregations |\n\n### `imf_list_databases`\n\nEntry point for every IMF query workflow — browse and filter the full dataflow catalog.\n\n- 193 dataflows covering WEO projections, balance of payments, CPI, exchange rates, money/finance statistics, and national accounts\n- Vintage (historical snapshot) dataflows excluded by default; set `include_vintages=true` to include them\n- Case-insensitive substring filter across ID, name, and description\n\n---\n\n### `imf_get_database`\n\nResolve human-readable terms to SDMX dimension codes before querying.\n\n- Returns all dimension IDs, positions, and their complete codelists (e.g. `\"United States\"` → `USA`, `\"real GDP growth\"` → `NGDP_RPCH`)\n- Country codes are ISO 3-letter (USA, GBR, DEU — not US, GB, DE)\n- `key_format` field shows the exact dot-separated dimension order required by `imf_query_dataset`\n- Codelists truncated at 50 entries inline; use `codelist_filter` to search large codelists by substring (returns all matches, uncapped), or the `imf://database/{dataflow_id}` resource for the full list\n\n---\n\n### `imf_query_dataset`\n\nQuery an IMF SDMX dataflow by dimension key over a time range.\n\n- Dot-separated key in DSD keyPosition order (e.g. `USA.NGDP_RPCH.A` for WEO annual real GDP growth)\n- `+` syntax for multi-code positions (e.g. `USA+GBR+DEU.NGDP_RPCH.A`)\n- Returns observations with `time_period`, `value`, `status`, and series attributes (`unit`, `scale`, `decimals`)\n- Large multi-country or long time-range queries automatically spill to DataCanvas — `canvas_id` and `table_name` are returned for SQL follow-up\n- `no_data` errors include availability context from the upstream constraint endpoint: `series_count=0` means the code has no coverage in the dataflow; `series_count\u003e0` means the combination is wrong and `available_codes` lists what does have data\n\n---\n\n### `imf_dataframe_describe` / `imf_dataframe_query`\n\nIn-conversation SQL analytics over the observation tables that `imf_query_dataset` stages on a DuckDB-backed canvas.\n\nWhen `imf_query_dataset` returns `truncated: true`, the full dataset is registered as a named table on the canvas. The workflow:\n\n1. Call `imf_query_dataset` — if `truncated: true`, note the `canvas_id` and `table_name`\n2. Call `imf_dataframe_describe` with the `canvas_id` to discover table schema\n3. Call `imf_dataframe_query` with a SELECT statement for aggregations, cross-country comparisons, or time-series analysis\n\nOnly SELECT statements are accepted — DML and DDL are rejected. Requires `CANVAS_PROVIDER_TYPE=duckdb`.\n\n## Resource\n\n| Type | URI | Description |\n|:-----|:----|:------------|\n| Resource | `imf://database/{dataflow_id}` | Full metadata for a single IMF SDMX dataflow — all dimensions with complete codelists, `key_format`, name, and description. Stable URI-addressable reference for known dataflow IDs (WEO, BOP, CPI, etc.). |\n\nAll resource data is also reachable via `imf_get_database`. The resource URI provides the untruncated codelist for large dimensions that `imf_get_database` caps at 50 entries. The `codelist_filter` parameter on `imf_get_database` is a lighter alternative for targeted code lookup — it returns all substring matches without the cap.\n\n## Data source\n\nData is sourced from the [International Monetary Fund SDMX 3.0 portal](https://data.imf.org/) under the [IMF Copyright and Terms of Use](https://www.imf.org/en/about/copyright-and-terms). 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, \u003cdataflow name\u003e, https://data.imf.org/`.\n\n## Features\n\nBuilt on [`@cyanheads/mcp-ts-core`](https://www.npmjs.com/package/@cyanheads/mcp-ts-core):\n\n- Declarative tool, resource, and prompt definitions — single file per primitive, framework handles registration and validation\n- Unified error handling — handlers throw, framework catches, classifies, and formats\n- Pluggable auth: `none`, `jwt`, `oauth`\n- Swappable storage backends: `in-memory`, `filesystem`, `Supabase`, `Cloudflare KV/R2/D1`\n- Structured logging with optional OpenTelemetry tracing\n- STDIO and Streamable HTTP transports\n\nIMF SDMX-specific:\n\n- Keyless access — no API key required; the IMF SDMX 3.0 portal is fully public\n- Type-safe SDMX 3.0 compact JSON client with dimension/codelist parsing and DSD validation\n- Key dimension count validated against the DSD before each query to catch format mismatches early\n- Dataflow catalog cached in-session to minimize round trips on multi-step workflows\n- DuckDB-backed DataCanvas spill for large multi-country or long time-range observations\n\nAgent-friendly output:\n\n- Codelist entries carry both the machine code and human-readable label — agents can present meaningful names without a follow-up lookup\n- `key_format` field in every dataflow response explicitly states the dimension order, removing guesswork for key construction\n- Observations include `status` flags (e.g. `E` for estimate) so agents can communicate data quality caveats\n- Canvas spill is transparent — `truncated`, `canvas_id`, and `table_name` are always present in the output schema, letting callers branch on data rather than heuristics\n\n## Getting started\n\n### Public Hosted Instance\n\nA public instance is available at `https://imf.caseyjhand.com/mcp` — no installation required. Point any MCP client at it via Streamable HTTP:\n\n```json\n{\n  \"mcpServers\": {\n    \"imf-mcp-server\": {\n      \"type\": \"streamable-http\",\n      \"url\": \"https://imf.caseyjhand.com/mcp\"\n    }\n  }\n}\n```\n\n### Self-Hosted / Local\n\nNo API key required. Add the following to your MCP client configuration file.\n\n```json\n{\n  \"mcpServers\": {\n    \"imf-mcp-server\": {\n      \"type\": \"stdio\",\n      \"command\": \"bunx\",\n      \"args\": [\"@cyanheads/imf-mcp-server@latest\"],\n      \"env\": {\n        \"MCP_TRANSPORT_TYPE\": \"stdio\",\n        \"MCP_LOG_LEVEL\": \"info\"\n      }\n    }\n  }\n}\n```\n\nOr with npx (no Bun required):\n\n```json\n{\n  \"mcpServers\": {\n    \"imf-mcp-server\": {\n      \"type\": \"stdio\",\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@cyanheads/imf-mcp-server@latest\"],\n      \"env\": {\n        \"MCP_TRANSPORT_TYPE\": \"stdio\",\n        \"MCP_LOG_LEVEL\": \"info\"\n      }\n    }\n  }\n}\n```\n\nOr with Docker:\n\n```json\n{\n  \"mcpServers\": {\n    \"imf-mcp-server\": {\n      \"type\": \"stdio\",\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\", \"-i\", \"--rm\",\n        \"-e\", \"MCP_TRANSPORT_TYPE=stdio\",\n        \"ghcr.io/cyanheads/imf-mcp-server:latest\"\n      ]\n    }\n  }\n}\n```\n\nTo enable SQL analytics over large result sets, add `CANVAS_PROVIDER_TYPE=duckdb` to the `env` block.\n\nFor Streamable HTTP, set the transport and start the server:\n\n```sh\nMCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http\n# Server listens at http://localhost:3010/mcp\n```\n\n### Prerequisites\n\n- [Bun v1.3.0](https://bun.sh/) or higher (or Node.js v24+).\n- No API key required.\n\n### Installation\n\n1. **Clone the repository:**\n\n```sh\ngit clone https://github.com/cyanheads/imf-mcp-server.git\n```\n\n2. **Navigate into the directory:**\n\n```sh\ncd imf-mcp-server\n```\n\n3. **Install dependencies:**\n\n```sh\nbun install\n```\n\n4. **Configure environment:**\n\n```sh\ncp .env.example .env\n# edit .env as needed — no required vars for basic use\n```\n\n## Configuration\n\n| Variable | Description | Default |\n|:---------|:------------|:--------|\n| `CANVAS_PROVIDER_TYPE` | Set to `duckdb` to enable DataCanvas spill for large result sets. | — |\n| `IMF_BASE_URL` | IMF SDMX 3.0 base URL. Override for testing or proxied environments. | `https://api.imf.org/external/sdmx/3.0` |\n| `IMF_REQUEST_TIMEOUT_MS` | Per-request timeout in milliseconds. | `30000` |\n| `MCP_TRANSPORT_TYPE` | Transport: `stdio` or `http`. | `stdio` |\n| `MCP_HTTP_PORT` | Port for HTTP server. | `3010` |\n| `MCP_AUTH_MODE` | Auth mode: `none`, `jwt`, or `oauth`. | `none` |\n| `MCP_LOG_LEVEL` | Log level (RFC 5424). | `info` |\n| `OTEL_ENABLED` | Enable [OpenTelemetry instrumentation](https://github.com/cyanheads/mcp-ts-core/tree/main/docs/telemetry). | `false` |\n\nSee [`.env.example`](./.env.example) for the full list of optional overrides.\n\n## Running the server\n\n### Local development\n\n- **Build and run:**\n\n  ```sh\n  bun run rebuild\n\n  bun run start:stdio\n  # or\n  bun run start:http\n  ```\n\n- **Run checks and tests:**\n\n  ```sh\n  bun run devcheck   # Lint, format, typecheck, security\n  bun run test       # Vitest test suite\n  bun run lint:mcp   # Validate MCP definitions against spec\n  ```\n\n### Docker\n\n```sh\ndocker build -t imf-mcp-server .\ndocker run --rm -p 3010:3010 imf-mcp-server\n```\n\nThe 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.\n\n## Project structure\n\n| Path | Purpose |\n|:-----|:--------|\n| `src/index.ts` | `createApp()` entry point — registers tools/resources and inits services. |\n| `src/config/server-config.ts` | Server-specific env var parsing and validation with Zod. |\n| `src/mcp-server/tools/definitions/` | Tool definitions (`*.tool.ts`). |\n| `src/mcp-server/resources/definitions/` | Resource definitions (`*.resource.ts`). |\n| `src/services/canvas/` | DataCanvas accessor — wraps the framework canvas instance. |\n| `src/services/imf-sdmx/` | IMF SDMX 3.0 API client — dataflow catalog, DSD fetching, data queries. |\n| `tests/` | Unit and integration tests mirroring `src/`. |\n| `docs/` | Design notes and directory tree. |\n\n## Development guide\n\nSee [`CLAUDE.md`/`AGENTS.md`](./CLAUDE.md) for development guidelines and architectural rules. The short version:\n\n- Handlers throw, framework catches — no `try/catch` in tool logic\n- Use `ctx.log` for request-scoped logging, `ctx.state` for tenant-scoped storage\n- Register new tools and resources via the barrels in `src/mcp-server/*/definitions/index.ts`\n- Wrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields\n\n## Contributing\n\nIssues and pull requests are welcome. Run checks and tests before submitting:\n\n```sh\nbun run devcheck\nbun run test\n```\n\n## License\n\nApache-2.0 — see [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyanheads%2Fimf-mcp-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcyanheads%2Fimf-mcp-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyanheads%2Fimf-mcp-server/lists"}