Repository avatar
Monitoring
v3.0.0
active

oecd-mcp

io.github.isakskogstad/oecd-mcp

OECD economic and statistical data via SDMX API. Access 5,000+ datasets across 17 categories.

Documentation

OECD MCP Server banner

OECD MCP Server

npm version CI License

Give your AI assistant direct access to OECD statistics. This Model Context Protocol (MCP) server lets Claude Code, Codex and other MCP clients search all ~1,500 OECD datasets and fetch the numbers (GDP, inflation, unemployment, health spending, education, tax revenue, trade, environment and more) straight from the official OECD SDMX API.

  • No account and no API key: the OECD API is public.
  • Runs locally on your machine with one command.
  • Read-only: the server can only look up statistics.

🇸🇪 Svenska: En MCP-server som ger AI-assistenter som Claude Code och Codex tillgång till OECD:s cirka 1 500 statistikdatabaser. Ingen API-nyckel behövs. Följ Kom igång nedan: ett kommando räcker.


Contents


Get started

You need: Node.js 20 or later. Check with:

node --version

That is the only requirement. You do not have to download or install the server yourself: npx fetches it the first time your client starts it.

Claude Code

Step 1. Add the server. Run this in your terminal (not inside a Claude Code session):

claude mcp add --scope user oecd -- npx -y oecd-mcp

What the parts mean:

PartMeaning
--scope userMakes the server available in all your projects. Leave it out to add it to the current project only.
oecdThe name you give the server. You will see it in tool names and commands.
--Everything after this is the command Claude Code runs to start the server.
npx -y oecd-mcpDownloads (first time) and starts the server.

Step 2. Check that it is connected.

claude mcp list

You should see oecd with a ✓. Inside a Claude Code session you can also type /mcp to see the server, its status and its tools.

Step 3. Ask something. Start claude and try:

Use OECD data to compare unemployment in Sweden, Norway and Denmark since 2020.

Claude Code asks for permission the first time it uses a tool from the server. All tools are read-only, so it is safe to allow them.

Share the server with your team (project scope)

Run the command with --scope project, or create a .mcp.json file in the project root and commit it:

{
  "mcpServers": {
    "oecd": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "oecd-mcp"]
    }
  }
}

Everyone who opens the project in Claude Code is asked to approve the server once.

Useful Claude Code commands
CommandWhat it does
claude mcp listList servers and their connection status
claude mcp get oecdShow how the server is configured
claude mcp remove oecdRemove the server
/mcp (in a session)Status, tools and reconnect
/mcp__oecd__compare_countries (in a session)Run one of the server's prompt templates
@oecd:oecd://filter-guide (in a session)Attach one of the server's resources to your message

Pass settings with --env, before the server name:

claude mcp add --scope user --env OECD_MCP_LOG_LEVEL=info oecd -- npx -y oecd-mcp

Codex

The Codex CLI, the Codex IDE extension and the ChatGPT desktop app share one configuration, so you only need to do this once.

Step 1. Add the server.

codex mcp add oecd -- npx -y oecd-mcp

Step 2. Check that it is connected.

codex mcp list

Inside the Codex terminal UI you can type /mcp to see active servers.

Step 3. Ask something. Start codex and try:

Use the OECD tools to show how inflation has developed in the G7 countries over the last two years.
Alternative: edit config.toml yourself

Codex stores MCP servers in ~/.codex/config.toml (or .codex/config.toml inside a trusted project). Add:

[mcp_servers.oecd]
command = "npx"
args = ["-y", "oecd-mcp"]
# Optional, but recommended:
startup_timeout_sec = 30   # default 10; the first npx download can take longer
tool_timeout_sec = 120     # default 60; large OECD queries can be slow

Note that the table is called mcp_servers (with an underscore).

To pass settings to the server, add an env table:

[mcp_servers.oecd.env]
OECD_MCP_LOG_LEVEL = "info"
Alternative: use the settings window

In the ChatGPT desktop app, open Settings → MCP servers → Add server. In the IDE extension, open the gear menu → MCP servers → Add server. Then:

  1. Name: oecd
  2. Type: STDIO
  3. Command: npx -y oecd-mcp
  4. Save and restart when asked.

Other clients

Most MCP clients use the same JSON block. Add it to the client's MCP configuration file and restart the client.

{
  "mcpServers": {
    "oecd": {
      "command": "npx",
      "args": ["-y", "oecd-mcp"]
    }
  }
}
ClientWhere the block goes
Claude DesktopSettings → Developer → Edit Config (claude_desktop_config.json)
Cursor~/.cursor/mcp.json or .cursor/mcp.json in a project
VS Code.vscode/mcp.json, with the top-level key servers instead of mcpServers

Clients that only accept a URL (for example web-based assistants) need the server to run as an HTTP server.


Using the server

Just ask in plain language and mention OECD. The assistant picks the tools itself. Some questions to try:

  • "What is the latest OECD composite leading indicator for the US and Germany?"
  • "Compare health spending as a share of GDP in the Nordic countries, 2010–2023. Use OECD data."
  • "Which OECD datasets cover house prices?"
  • "Show Sweden's quarterly GDP growth for the last three years and link to the source."
  • "How does tax revenue as % of GDP differ between France, the UK and the US?"

Tips for good answers:

  • Name countries and years. "Sweden and Norway, 2015–2024" gives a precise query; "some countries recently" makes the assistant guess.
  • Ask for the source. Every result contains a link to the same selection in OECD Data Explorer, where you can view, chart and download the data.
  • One broad question beats many small ones. See the rate limit.

What the server offers

Tools

ToolWhat it does
search_dataflowsSearch all OECD datasets by keyword, ranked by relevance
list_dataflowsBrowse datasets, optionally by category
get_categoriesOECD's topic categories and subcategories with dataset counts
get_popular_datasetsA short curated list with easy aliases (QNA, CLI, CPI, EO, …)
get_data_structureDescribe a dataset: dimensions, values that have data, time coverage, last update
get_dimension_valuesList or search the codes of one dimension (countries, measures, …)
query_dataFetch observations as a compact, labelled table
get_dataflow_urlLink to the selection in OECD Data Explorer

All tools are read-only.

Prompt templates

Ready-made starting points. In Claude Code they appear as slash commands, for example /mcp__oecd__nordic_comparison.

PromptPurpose
analyze_economic_trendHow an indicator has developed over time
compare_countriesCompare countries on an indicator
get_latest_statisticsThe most recent figures on a topic
explore_datasetGuided tour of one dataset
find_data_for_questionFind the right dataset for a question
build_filterHelp building the filters for a query
nordic_comparisonCompare Denmark, Finland, Iceland, Norway and Sweden

Resources

ResourceContent
oecd://categoriesCategories and subcategories
oecd://dataflows/popularPopular datasets and their aliases
oecd://countriesCountry codes, aggregates and country groups
oecd://filter-guideHow to select series and periods
oecd://glossaryCommon dimensions, attributes and codes
oecd://llm-instructionsUsage instructions for the assistant
oecd://api/infoThe OECD API, its rate limit and the server's current usage

Popular datasets

AliasDataset
QNAQuarterly National Accounts (GDP and components)
NAAGNational Accounts at a Glance (annual GDP, GDP per capita)
CLIComposite leading indicators, business and consumer confidence
CPIConsumer price indices (inflation)
EOOECD Economic Outlook (history and projections)
UNE_MMonthly unemployment rates
WAGESAverage annual wages
HPIHouse price indices
SHAHealth expenditure and financing
LELife expectancy
IDDIncome distribution (Gini, poverty)
SOCX_AGGSocial expenditure
REVTax revenues
MSTIScience and technology indicators (R&D)
GREEN_GROWTHGreen growth indicators
DAC1Official development assistance

These are shortcuts. Every other OECD dataset is reachable through search_dataflows.


How a query works

You normally never see this, but it helps to know what the assistant does:

1. search_dataflows  {"query": "leading indicators"}
      → DSD_STES@DF_CLI  "Composite leading indicators"  (alias CLI)

2. get_data_structure  {"dataflow_id": "CLI"}
      → dimensions REF_AREA, FREQ, MEASURE, ADJUSTMENT, …
        with the codes that have data, e.g. MEASURE: LI, BCICP, CCICP

3. query_data  {
     "dataflow_id": "CLI",
     "filters": {"REF_AREA": ["USA", "DEU"], "FREQ": "M", "MEASURE": "LI", "ADJUSTMENT": "AA"},
     "start_period": "2025-01"
   }

The result is a compact table:

{
  "dataflow": { "id": "DSD_STES@DF_CLI", "name": "Composite leading indicators" },
  "total_observations": 20,
  "constants": { "FREQ": "M (Monthly)", "MEASURE": "LI (Composite leading indicator (CLI))", "UNIT_MEASURE": "IX (Index)" },
  "columns": ["REF_AREA", "TIME_PERIOD", "OBS_VALUE"],
  "rows": [["DEU", "2025-01", 100.3], ["DEU", "2025-02", 100.4], ["USA", "2025-01", 100.1]],
  "labels": { "REF_AREA": { "DEU": "Germany", "USA": "United States" } },
  "notes": [],
  "explorer_url": "https://data-explorer.oecd.org/vis?df[ds]=dsDisseminateFinalDMZ&df[id]=DSD_STES%40DF_CLI&…"
}

(The values above are illustrative.)

  • filters is keyed by dimension ID. Dimensions you leave out stay open. Unknown dimensions or values are rejected with suggestions before OECD is called.
  • constants holds everything that is identical on every row, such as the unit, so it is not repeated.
  • Time is selected with start_period / end_period (2023, 2023-Q4, 2023-12) or last_n_observations (latest N per series). Without a time range you get the latest 10 observations per series.
  • At most limit rows are returned (default 200, max 2,000). If a result is cut, the most recent rows are kept and notes says so.
  • The raw SDMX key ("filter": "USA+DEU.M.LI......") is accepted as well.

Good to know: OECD's rate limit

OECD allows 60 downloads per hour per IP address, blocks requests from VPNs and anonymised networks, and may answer with errors when you are close to the limit (OECD's API best practices).

The server is built around this:

  • The dataset catalogue and dataset structures are cached for 24 hours and query results for 1 hour, in memory and on disk (~/.cache/oecd-mcp), so restarts and repeated questions cost nothing.
  • Searching and browsing datasets works from the cached catalogue.
  • When the limit is hit, the assistant gets a clear message with the current usage instead of a cryptic failure.

In practice the limit can kick in earlier when many requests arrive in a short burst. If you hit it, wait a while (typically some minutes) and continue. Asking for several countries and years in one question uses one download; asking country by country uses many.


Configuration

Everything is optional. Set these as environment variables for the server (see the --env and env examples above).

VariableDefaultMeaning
OECD_MCP_CACHE_DIR~/.cache/oecd-mcpCache directory. Set to off to cache in memory only
OECD_MCP_LOG_LEVELwarndebug, info, warn or error (logs go to stderr)
OECD_MCP_TIMEOUT_MS45000Timeout for one request to OECD
OECD_MCP_MAX_RETRIES1Retries after network or server errors
OECD_MCP_MAX_RESPONSE_MB25Largest OECD response the server will download
OECD_MCP_DATA_TTL_MINUTES60How long query results are cached
OECD_MCP_STRUCTURE_TTL_HOURS24How long dataset structures are cached
OECD_MCP_CATALOG_TTL_HOURS24How long the dataset catalogue is cached
OECD_MCP_MIN_INTERVAL_MS500Minimum time between two requests to OECD
PORT, HOST3000, 127.0.0.1HTTP mode only
OECD_MCP_ALLOWED_HOSTS–HTTP mode only: comma-separated Host headers to accept

Run as an HTTP server

For clients that connect to a URL, or to share one server (and one cache) between several users, run the server with the Streamable HTTP transport:

npx -y oecd-mcp --http        # listens on http://127.0.0.1:3000/mcp

Connect to it:

# Claude Code
claude mcp add --transport http oecd http://localhost:3000/mcp
# Codex: ~/.codex/config.toml
[mcp_servers.oecd]
url = "http://localhost:3000/mcp"

Endpoints: POST /mcp (MCP), GET /health (status and OECD usage).

Hosting it publicly. A Dockerfile is included:

docker build -t oecd-mcp .
docker run -p 3000:3000 -e OECD_MCP_ALLOWED_HOSTS=oecd.example.com oecd-mcp

One-click on Render (free plan). The repository contains a render.yaml blueprint:

Deploy to Render

When the deploy is ready, your MCP endpoint is https://<your-service>.onrender.com/mcp. Add that URL where your client asks for a remote MCP server:

ClientWhere
Claude (claude.ai, desktop and mobile apps)Settings → Connectors → Add custom connector
ChatGPTSee OpenAI's guide: Connect an existing MCP server
Claude Codeclaude mcp add --transport http oecd https://<your-service>.onrender.com/mcp
Codexurl = "https://<your-service>.onrender.com/mcp" under [mcp_servers.oecd]

A free Render service sleeps after 15 minutes without traffic, so the first request after a pause can take up to a minute, and its cache is emptied on every restart.

Keep two things in mind. All users of a hosted server share the host's IP address and therefore OECD's 60 downloads per hour. And the server has no authentication of its own, so put it behind your own gateway if it should not be open to everyone.


Troubleshooting

ProblemWhat to do
The server does not show up or fails to connectRun npx -y oecd-mcp --version in a terminal. If that fails, check node --version (20 or later) and your network.
Slow or timed-out startThe first npx run downloads the package. Install it once with npm install -g oecd-mcp and use oecd-mcp as the command instead of npx -y oecd-mcp. In Codex you can also raise startup_timeout_sec.
"The OECD API rate limit was reached" or repeated server errorsYou have used OECD's hourly quota. Wait and try again; cached results still work.
"bot-verification page" or connection errorsOECD blocks VPNs and anonymised networks. Disconnect the VPN.
"… is not an available value of dimension …"The code does not exist in that dataset. Ask the assistant to look it up with get_dimension_values.
No observationsEvery value exists, but not in that combination. Ask the assistant to leave more dimensions open.
Windows: npx is not found by the clientUse cmd as the command with the arguments /c, npx, -y, oecd-mcp.
Want to see what happensSet OECD_MCP_LOG_LEVEL=debug and look at the client's MCP logs, or run npm run inspect from a clone of this repository.

Development

git clone https://github.com/isakskogstad/OECD-MCP.git
cd OECD-MCP
npm install
npm run build
npm test              # unit tests, offline
npm run test:live     # contract tests against the real OECD API (uses ~8 requests)
npm run inspect       # open the MCP Inspector against the local build

To use a local build in a client, point it at the built file:

claude mcp add oecd -- node /absolute/path/to/OECD-MCP/dist/index.js
codex mcp add oecd -- node /absolute/path/to/OECD-MCP/dist/index.js

Project layout:

FileResponsibility
src/index.tsEntry point (stdio, --http)
src/server.tsMCP tools, resources and instructions
src/prompts.ts, src/guides.tsPrompt templates and static guidance
src/oecd.tsQueries: builds requests, shapes results
src/catalog.tsDataset catalogue, search and ID resolution
src/structure.tsDataset structures and filter-to-key conversion
src/http-client.ts, src/cache.tsOECD HTTP access, rate limit, cache
src/aliases.tsShort aliases for popular datasets
src/http-server.tsStreamable HTTP transport

Changes are listed in CHANGELOG.md. Issues and pull requests are welcome.


About

Created by Isak Skogstad · isak.skogstad@me.com

This project is independent and is not affiliated with or endorsed by the OECD. Data comes from the OECD's public SDMX API and is subject to the OECD Terms and Conditions.

Licensed under the MIT License.