
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
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
- Using the server
- What the server offers
- How a query works
- Good to know: OECD's rate limit
- Configuration
- Run as an HTTP server
- Troubleshooting
- Development
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:
| Part | Meaning |
|---|---|
--scope user | Makes the server available in all your projects. Leave it out to add it to the current project only. |
oecd | The 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-mcp | Downloads (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
| Command | What it does |
|---|---|
claude mcp list | List servers and their connection status |
claude mcp get oecd | Show how the server is configured |
claude mcp remove oecd | Remove 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:
- Name:
oecd - Type: STDIO
- Command:
npx -y oecd-mcp - 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"]
}
}
}
| Client | Where the block goes |
|---|---|
| Claude Desktop | Settings → 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
| Tool | What it does |
|---|---|
search_dataflows | Search all OECD datasets by keyword, ranked by relevance |
list_dataflows | Browse datasets, optionally by category |
get_categories | OECD's topic categories and subcategories with dataset counts |
get_popular_datasets | A short curated list with easy aliases (QNA, CLI, CPI, EO, …) |
get_data_structure | Describe a dataset: dimensions, values that have data, time coverage, last update |
get_dimension_values | List or search the codes of one dimension (countries, measures, …) |
query_data | Fetch observations as a compact, labelled table |
get_dataflow_url | Link 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.
| Prompt | Purpose |
|---|---|
analyze_economic_trend | How an indicator has developed over time |
compare_countries | Compare countries on an indicator |
get_latest_statistics | The most recent figures on a topic |
explore_dataset | Guided tour of one dataset |
find_data_for_question | Find the right dataset for a question |
build_filter | Help building the filters for a query |
nordic_comparison | Compare Denmark, Finland, Iceland, Norway and Sweden |
Resources
| Resource | Content |
|---|---|
oecd://categories | Categories and subcategories |
oecd://dataflows/popular | Popular datasets and their aliases |
oecd://countries | Country codes, aggregates and country groups |
oecd://filter-guide | How to select series and periods |
oecd://glossary | Common dimensions, attributes and codes |
oecd://llm-instructions | Usage instructions for the assistant |
oecd://api/info | The OECD API, its rate limit and the server's current usage |
Popular datasets
| Alias | Dataset |
|---|---|
QNA | Quarterly National Accounts (GDP and components) |
NAAG | National Accounts at a Glance (annual GDP, GDP per capita) |
CLI | Composite leading indicators, business and consumer confidence |
CPI | Consumer price indices (inflation) |
EO | OECD Economic Outlook (history and projections) |
UNE_M | Monthly unemployment rates |
WAGES | Average annual wages |
HPI | House price indices |
SHA | Health expenditure and financing |
LE | Life expectancy |
IDD | Income distribution (Gini, poverty) |
SOCX_AGG | Social expenditure |
REV | Tax revenues |
MSTI | Science and technology indicators (R&D) |
GREEN_GROWTH | Green growth indicators |
DAC1 | Official 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.)
filtersis keyed by dimension ID. Dimensions you leave out stay open. Unknown dimensions or values are rejected with suggestions before OECD is called.constantsholds 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) orlast_n_observations(latest N per series). Without a time range you get the latest 10 observations per series. - At most
limitrows are returned (default 200, max 2,000). If a result is cut, the most recent rows are kept andnotessays 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).
| Variable | Default | Meaning |
|---|---|---|
OECD_MCP_CACHE_DIR | ~/.cache/oecd-mcp | Cache directory. Set to off to cache in memory only |
OECD_MCP_LOG_LEVEL | warn | debug, info, warn or error (logs go to stderr) |
OECD_MCP_TIMEOUT_MS | 45000 | Timeout for one request to OECD |
OECD_MCP_MAX_RETRIES | 1 | Retries after network or server errors |
OECD_MCP_MAX_RESPONSE_MB | 25 | Largest OECD response the server will download |
OECD_MCP_DATA_TTL_MINUTES | 60 | How long query results are cached |
OECD_MCP_STRUCTURE_TTL_HOURS | 24 | How long dataset structures are cached |
OECD_MCP_CATALOG_TTL_HOURS | 24 | How long the dataset catalogue is cached |
OECD_MCP_MIN_INTERVAL_MS | 500 | Minimum time between two requests to OECD |
PORT, HOST | 3000, 127.0.0.1 | HTTP 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:
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:
| Client | Where |
|---|---|
| Claude (claude.ai, desktop and mobile apps) | Settings → Connectors → Add custom connector |
| ChatGPT | See OpenAI's guide: Connect an existing MCP server |
| Claude Code | claude mcp add --transport http oecd https://<your-service>.onrender.com/mcp |
| Codex | url = "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
| Problem | What to do |
|---|---|
| The server does not show up or fails to connect | Run npx -y oecd-mcp --version in a terminal. If that fails, check node --version (20 or later) and your network. |
| Slow or timed-out start | The 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 errors | You have used OECD's hourly quota. Wait and try again; cached results still work. |
| "bot-verification page" or connection errors | OECD 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 observations | Every value exists, but not in that combination. Ask the assistant to leave more dimensions open. |
Windows: npx is not found by the client | Use cmd as the command with the arguments /c, npx, -y, oecd-mcp. |
| Want to see what happens | Set 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:
| File | Responsibility |
|---|---|
src/index.ts | Entry point (stdio, --http) |
src/server.ts | MCP tools, resources and instructions |
src/prompts.ts, src/guides.ts | Prompt templates and static guidance |
src/oecd.ts | Queries: builds requests, shapes results |
src/catalog.ts | Dataset catalogue, search and ID resolution |
src/structure.ts | Dataset structures and filter-to-key conversion |
src/http-client.ts, src/cache.ts | OECD HTTP access, rate limit, cache |
src/aliases.ts | Short aliases for popular datasets |
src/http-server.ts | Streamable 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.
No installation packages available.
Remote
Related Servers
io.github.isakskogstad/kolada-mcp
Swedish municipality statistics from Kolada API. 6000+ KPIs for all 290 municipalities.
io.github.isakskogstad/riksdag-regering-mcp
Öppna data från Sveriges riksdag och regering: dokument, ledamöter, voteringar, anföranden.
io.github.isakskogstad/scb-mcp
MCP server for Statistics Sweden (SCB) - 1200+ tables with population, economy, environment data