
oecd-mcp-server
io.github.cyanheads/oecd-mcp-server
Search and query 1,500+ OECD statistical datasets via SDMX. Keyless.
Documentation
@cyanheads/oecd-mcp-server
Search, explore, and query 1,500+ OECD statistical datasets (national accounts, employment, trade, education, health) from the OECD SDMX API via MCP. STDIO or Streamable HTTP.
Public Hosted Server: https://oecd.caseyjhand.com/mcp
Overview
OECD statistics across 1,500+ datasets on national accounts, employment, trade, education, and health. Search datasets, inspect their dimensions, query observations, and run SQL over large multi-country time series. No API key required.
Tools
Five discovery and data tools plus three DataCanvas tools for large query results:
| Tool | Description |
|---|---|
oecd_list_agencies | List OECD SDMX agencies with their directorate and the number of dataflows each publishes |
oecd_search_datasets | Search 1,500+ OECD dataflows by keyword or theme, or list an agency's or the catalog's dataflows |
oecd_get_dataset_info | Fetch a dataflow's name, full description, linked resources, dimensions, key order, and codelist references |
oecd_get_dimension_values | Fetch valid codes, labels, and hierarchy parents for one dimension (countries, measures, regions) |
oecd_query_dataset | Fetch observations filtered by dimension key, time range, or latest N per series; spills large results to DataCanvas |
oecd_dataframe_describe | List DataCanvas tables and columns staged by a prior oecd_query_dataset spill |
oecd_dataframe_query | Run a read-only SQL SELECT against DataCanvas tables |
oecd_dataframe_drop | Drop a staged DataCanvas table or view once the analysis is done — opt-in via OECD_DATAFRAME_DROP_ENABLED=true |
Resources
| Resource | Description |
|---|---|
oecd://dataflow/{agency_id}/{flow_id} | Metadata for the latest edition of a single OECD dataflow |
All resource data is also reachable via tools. Use oecd_get_dataset_info for the same content.
Skill
| Skill | Description |
|---|---|
oecd-guide | Building SDMX keys, confirming which series a dataflow carries, and reading results without mixing breakdowns, units, or country aggregates. Served over MCP at skill://oecd-guide/SKILL.md |
Capability reference
oecd_list_agencies tool
- No inputs; returns every agency ID (e.g.
OECD.SDD.NAD) with its directorate name and dataflow count, sorted by count - Publishers outside OECD that ship dataflows through the same catalog (
ESTAT,IAEG-SDGs) carry no directorate - If an OECD directorate lookup fails,
directorate_lookup_failed_fornames the affected agency IDs. Agency counts remain available.
oecd_search_datasets tool
- Optional
queryand optionalagency_id. Omitquery(or leave it blank) to list every dataflow in catalog order — withinagency_idwhen set (e.g.{ "agency_id": "OECD.ELS.HD" }) - When
queryis set, each token must start a word in a dataflow's name or description: matching is a case-insensitive prefix, and a word starts after any character that is not a letter or digit, or at a lowercase-to-uppercase step (markersmatchesRioMarkers). A token that opens on such a character, like&or-oecd, matches anywhere it occurs, so&findsR&D.tivafinds(TiVA)but notactivation, andemploymentdoes not reach a flow that only mentions unemployment - Search results rank in three tiers: name matches first, then tokens split across name and description, then description-only, in catalog order within each tier
limitdefaults to 20 and takes any value up to 2,000; a larger one is served at 2,000 with anotice.offsetpages the result list, and every response carriestotal_matches- Each result carries its
flow_ref— the identifier every other tool takes — plusmatched_in(name,description, orboth) when a query ran (omitted when listing without a query)
oecd_get_dataset_info tool
- Takes a
flow_ref. Returns the dataflow'sname, fulldescriptionwith paragraphs, lists, tables, and methodology links,EXT_RESOURCEresources({ label, url }[]), dimensions in key order, and akey_exampleforoecd_query_dataset. - If a concept scheme lookup fails,
concept_lookup_failed_fornames the affected dimension IDs. Use the returned IDs and positions to build the key. - Set
versionto select a published edition, for example"1.1". Omit it for the latest edition. The result identifies the resolvedversionwhen OECD provides it and listspublished_versionswhen discovery succeeds. - Fails
invalid_flow_reffor a string that is not a flow reference anddataflow_not_foundfor one OECD does not publish
oecd_get_dimension_values tool
- Takes a
flow_refanddimension_id; returnscodes({ id, name, parent? }) where hierarchical codelists carry each code'sparentID (rendered as aParentcolumn when any code on the page has one) - Optional
parentfilters to codes whoseparentequals that code (exact match, e.g.parent: "FRA"for France's TL2 regions), applied afteravailable_only/keyand before substringquery,offset, andlimit - A shared codelist can include codes a flow has no data for. Set
available_only: true, pass akey, or supplystart_periodorend_periodto read OECD availability before filtering and paging. The result gives OECD'stime_rangeandobservation_count; a requested window is echoed separately asquery_start_periodandquery_end_periodwhen applied. A failed read falls back to the whole codelist withavailable_only: falseand a notice. - Key and period validation follows
oecd_query_dataset. - Optional
versionselects the edition used for the dimension, its codelist reference, and availability. If OECD no longer serves the referenced codelist revision, an explicit edition returnscodelist_not_found. - Availability costs one structure request, sent alongside the codelist read, and no data download. A delegated dataflow's availability is read on the root its data lives on, the one its catalog entry points to. A cold call sends 3 requests without the flag (dataflow reference, concept scheme, codelist) and 4 with it, or 5 for a delegated dataflow whose datastructure
/public/restalso holds, which adds the datastructure route; a repeat call is served from the structure cache with no request limit(default 50) andoffsetpage the matches, with the full match count when more remain; alimitabove 10,000 is served at 10,000 with anotice
oecd_query_dataset tool
flow_refplus a dot-delimitedkey(+for multiple values, empty segments as wildcards), optionalstart_period/end_period, and optionallast_n_observationsfor the latest N observations per series. OECD applies N before the period bounds. A value above 100,000 uses 100,000 and reports it inquery_last_n_observationsand the notice.- Key length is checked before the download. Extra trailing empty segments are trimmed. A key containing codes fails
invalid_keyif it has too few segments or extra non-empty segments. A dots-only key selects all series and reports a mismatch between its segment count and the dataflow's dimension count. - Blank period bounds are omitted. An impossible calendar date or a start after the end fails
invalid_periodbefore any upstream request. - Optional
versionselects a dataflow edition. Use the same value when inspecting its metadata, checking availability, and querying observations. A missing edition failsdataflow_not_foundand names alternatives when OECD's edition catalog is available. - One row per observation, sorted by dimension code in key order and then by
TIME_PERIOD. A row carriesvalue(pre-multiplied byvalue_scale) and each component that varies across the result; a coded component appears twice, as its label and as<ID>_code - Components holding one value across the whole result come back once, in
constant_columns({ code, label }per component;{}when nothing is constant), and leave the rows. Attributes are read at dataset, dimension-group, and observation level, andUNIT_MULTscales the value from whichever level carries it - A query that matches nothing fails
no_results, naming the pinned code that has no data, a code matching only by letter case, a period outside the key's range, orlast_n_observationsapplied beforeend_period. Producing that costs one availability request once the dataflow's datastructure and concept scheme are cached, and no data download; if the read fails or takes longer than 10 seconds, the plain message stands - A successful result's notice names requested dimension codes missing from the full result, including when only the first rows are shown. Known delegated data roots from key validation are used for the download.
download_limitcan mean the hourly download quota or an oversized request. Wait for the quota to clear or narrow an oversized key or period. If OECD sendsRetry-After, the error carries its value asretryAfter.- Large results (>100,000 characters inline) spill to DataCanvas with
truncated: true,canvas_id,table_name, and a short preview head of at most 25 rows; with DataCanvas off (CANVAS_PROVIDER_TYPE=none), every observation comes back in bothstructuredContent.rowsandcontent[] - A spill includes a
noticenaming the canvas and table: inspect columns withoecd_dataframe_describe, then useoecd_dataframe_queryfor SQL over the full result. The staged table holds every column, constants and_codecolumns included, so SQL can filter on codes. Fitting results allocate no new canvas; an explicitcanvas_idis checked before the download, so a stale one fails ascanvas_not_foundwithout spending an OECD request. - Observation and SQL text output use a JSON block when empty strings appear alongside nulls or absent values.
oecd_dataframe_describe tool
- Takes the
canvas_idoecd_query_datasetreturned; lists each staged table and view with its row count and column names and types
oecd_dataframe_query tool
canvas_idplus one read-only SQLSELECT; writes, DDL, and system-catalog access are rejectedlimit(default 100) returns up to 1,000 rows per call; a largerlimitis served at 1,000 with a noticetruncated: truemarks a result with more rows than it returned, and itsnoticenames how to reach the rest;row_countcounts the rows returned- A query still running after 30 seconds is stopped with
query_timeout
oecd_dataframe_drop tool
canvas_idplus atable_nameasoecd_dataframe_describelists it; returns the dropped object'skindand theremaining_tables- Opt-in: listed but not callable unless
OECD_DATAFRAME_DROP_ENABLED=true
oecd://dataflow/{agency_id}/{flow_id} resource
- Latest dataflow metadata as
application/json, including the resolvedversionwhen known, full description, source links, dimensions, and any failed concept lookup IDs {flow_id}is{dsd_id}@{df_id}with@encoded as%40(e.g.oecd://dataflow/OECD.SDD.NAD/DSD_NAAG%40DF_NAAG_I), or the bare{df_id}
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.
OECD-specific:
- Keyless access — no API key required; OECD SDMX 2.1 REST API is fully public
- Covers 1,500+ dataflows across 20+ OECD statistical departments (national accounts, employment, inflation, trade, education, health, environment, taxation, inequality)
- Delegated dataflows and codelist revisions resolved end to end — a dataflow OECD catalogues on one service root but defines on another follows the catalog's own link for structure, codes, and observations, and codes come from the revision the datastructure names rather than the endpoint's current latest
- Structure responses (the dataflow catalog, datastructures, codelists, concept schemes, availability) are cached in process for the lifetime OECD grants each, bounded at 64 MiB, so repeating a lookup inside that window sends no OECD request. The bound and lifetime are not configurable; observations are never cached
AllDimensionsobservation mode — one-pass SDMX-JSON decoding into flat row objects, no nested series key reconstructionoecd_query_datasetmaterializes large observation sets (multi-country time-series) on a DuckDB DataCanvas for in-conversation SQL analytics; theoecd_dataframe_*tools work on it; DataCanvas is on by default andCANVAS_PROVIDER_TYPE=nonedisables it
Agent-friendly output:
- Workflow-aware tool surface —
flow_reffrom search flows directly into info, values, and query tools without reconstruction - Spill signaling —
truncated: true+canvas_idtells the agent to switch to SQL instead of parsing a truncated inline list - Full SDMX decoding server-side — agents see
{ REF_AREA: "United States", REF_AREA_code: "USA", MEASURE: "Gross domestic product", MEASURE_code: "B1GQ", value: 26054614000000, value_scale: 1000000000 }, with components that never vary hoisted intoconstant_columns, not raw index arrays
Getting started
Connect to the hosted instance, no install:
claude mcp add --transport http oecd-mcp-server https://oecd.caseyjhand.com/mcp
Or run it locally:
claude mcp add oecd-mcp-server -- npx -y @cyanheads/oecd-mcp-server
For other clients, add this to the MCP config file:
{
"mcpServers": {
"oecd-mcp-server": {
"command": "npx",
"args": ["-y", "@cyanheads/oecd-mcp-server"]
}
}
}
No API key is needed — OECD SDMX is a free, public API. DataCanvas SQL analytics over large query results is on by default; set CANVAS_PROVIDER_TYPE=none to return every observation inline instead. For Docker or a source build, see Running the server.
Configuration
All configuration is validated at startup via Zod schemas in src/config/server-config.ts. Key environment variables:
| Variable | Description | Default |
|---|---|---|
OECD_BASE_URL | OECD SDMX REST API base URL. Must be an https origin that answers directly — no redirect is followed, so a plaintext http:// origin fails instead of being upgraded to https. | https://sdmx.oecd.org/public/rest |
OECD_TIMEOUT_MS | Per-request timeout in milliseconds. Each tool or resource call also spends one upstream budget of max(50 s, this value) across all its requests and retries, so a value past 50 s needs a client that waits that long for a result. | 30000 |
OECD_CLAMP_LIMITS | Serve count inputs at their cap and report the reduction. Caps are 2,000 search results, 10,000 dimension codes, 1,000 SQL rows, and 100,000 latest observations per series. false rejects larger inputs and advertises the cap as the schema maximum. | true |
CANVAS_PROVIDER_TYPE | Canvas engine. With duckdb, a large oecd_query_dataset result spills to a queryable table with a short preview head (≤25 rows); with none, every row comes back inline in both structuredContent and content[]. | duckdb |
OECD_DATAFRAME_DROP_ENABLED | Set to true to register oecd_dataframe_drop. Off, the tool is listed as disabled and clients cannot call it. | false |
MCP_TRANSPORT_TYPE | Transport: stdio or http. | stdio |
MCP_HTTP_PORT | Port for HTTP server. | 3010 |
MCP_SESSION_MODE | HTTP session posture: stateful, stateless, or auto. The server declares stateless in source — it keeps no per-session state, and a DataCanvas handle is keyed by canvas_id — so set this only to override that. | stateless |
MCP_AUTH_MODE | Auth mode: none, jwt, or oauth. | none |
MCP_LOG_LEVEL | Log level (RFC 5424). | info |
LOGS_DIR | Directory for log files (Node.js only). | <project-root>/logs |
LOG_TOOL_FAILURE_PAYLOADS | Log each failed tool call's arguments and result, redacted by key name and capped at LOG_TOOL_FAILURE_PAYLOAD_MAX_BYTES (default 16384). A secret inside a free-form value is not redacted. | false |
OTEL_ENABLED | Enable OpenTelemetry instrumentation. | false |
See .env.example for the full list of optional overrides.
Running the server
Local development
Requires Bun v1.4.4 or higher (or Node.js v24+).
-
Clone and install:
git clone https://github.com/cyanheads/oecd-mcp-server.git cd oecd-mcp-server && bun install cp .env.example .env # optional — every variable has a default -
Build and run:
# One-time build bun run rebuild # Run the built server bun run start:stdio # or bun run start:http -
Run 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 run --rm -p 3010:3010 ghcr.io/cyanheads/oecd-mcp-server:latest
The image defaults to HTTP transport, stateless session mode, and logs to /var/log/oecd-mcp-server. To run it over stdio from an MCP client, use "command": "docker" with "args": ["run", "-i", "--rm", "-e", "MCP_TRANSPORT_TYPE=stdio", "ghcr.io/cyanheads/oecd-mcp-server:latest"]. To build locally, docker build -t oecd-mcp-server .; OpenTelemetry peer dependencies are installed by default — build with --build-arg OTEL_ENABLED=false to omit them.
Project structure
| Directory | Purpose |
|---|---|
src/index.ts | createApp() entry point — registers tools/resources and initializes services. |
src/config/ | Server-specific environment variable parsing and validation with Zod. |
src/mcp-server/tools/definitions/ | Tool definitions (*.tool.ts) — eight tools for OECD data discovery, retrieval, and DataCanvas analysis. |
src/mcp-server/resources/definitions/ | Resource definitions (*.resource.ts) — the oecd://dataflow resource. |
src/services/oecd-http/ | Shared OECD fetch boundary — timeout and retry-classification corrections used by both services below, the response-body reader both share, the per-call upstream budget, the origin check every delegated service root passes before it is addressed, the refusal of any redirect off the configured host, and the classification that gives an upstream refusal the same declared reason on every tool and resource. |
src/services/oecd-structure/ | OECD SDMX structure service — dataflows, data structures, codelists, availability — and the in-process cache in front of its reads. |
src/services/oecd-data/ | OECD SDMX data service — observations and SDMX-JSON decoding. |
src/services/canvas-accessor/ | DataCanvas accessor — registers and exposes the framework canvas instance to tools. |
src/utils/ | Shared helpers — table formatting, limit clamping, word-start text matching. |
skills/ | Published agent skill (oecd-guide), served over MCP and shipped in the npm package and Docker image. |
tests/ | Unit and integration tests mirroring src/. |
Development guide
See CLAUDE.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/*/index.ts - Wrap external API calls: validate raw SDMX-JSON → normalize to domain type → return output schema; never fabricate missing fields
Contributing
Issues are welcome — see CONTRIBUTING.md for what makes one actionable, and CODE_OF_CONDUCT.md for how we work together. Run checks and tests before submitting:
bun run devcheck
bun run test
License
Apache-2.0 — see LICENSE for details.
@cyanheads/oecd-mcp-servernpm install @cyanheads/oecd-mcp-server@cyanheads/oecd-mcp-servernpm install @cyanheads/oecd-mcp-serverRemote
Related Servers
io.github.cyanheads/anime-mcp-server
Search anime/manga, franchise relations, schedule, characters, rankings, studio filmography.
io.github.cyanheads/art-institute-chicago-mcp-server
Search the Art Institute of Chicago collection: artworks, artists, exhibitions, and audio guides.
io.github.cyanheads/arxiv-mcp-server
Search arXiv, fetch paper metadata, and read full-text content.