Skip to main content
Glama

World Trade MCP

A provider-agnostic MCP server for querying official international trade, tariff, and macroeconomic datasets from one interface.

The project starts with four official data providers:

Provider

Coverage

Access

UN Comtrade

Global merchandise and services trade by reporter, partner, product, and period

Anonymous preview (up to 500 rows); registered free API key unlocks the standard data API

WTO Timeseries

Merchandise trade, services, tariffs, market-access and related indicators

Free API key

World Bank Indicators

Trade, GDP, development and macro indicators

No API key

Eurostat

EU trade and other European statistics

No API key

ITC Trade Map is tracked as a future integration. ITC says its secure API is made available only in specific circumstances; this project will not scrape the Trade Map website or bypass its access controls. A user's Trade Map account does not automatically provide a general-purpose developer API.

What this server exposes

  • list_data_sources — provider coverage, credential status, and access notes.

  • get_un_comtrade_trade_data — annual or monthly trade records. Uses the public preview automatically when no key is configured.

  • get_un_comtrade_releases — latest Comtrade release information.

  • get_wto_timeseries — WTO indicator time series.

  • get_world_bank_indicator — World Bank country/indicator time series.

  • get_eurostat_dataset — query a public Eurostat dataset using its dataset code and dimension filters.

Provider responses retain their source fields and include provenance metadata. Values from different providers are not silently merged because definitions, reporting bases, currencies, and revisions can differ.

Related MCP server: mcp-comtrade

Quick start

Requirements: Python 3.11+

git clone https://github.com/trehsan1-creator/world-trade-mcp.git
cd world-trade-mcp
python -m venv .venv

# Windows PowerShell
.venv\Scripts\Activate.ps1

# macOS / Linux
source .venv/bin/activate

pip install -e ".[dev]"
cp .env.example .env

Add API keys to .env only if you have them. The World Bank and Eurostat tools work without credentials; Comtrade starts in public-preview mode.

Run the MCP server over stdio:

python -m world_trade_mcp.server

For local MCP clients, configure the server command as python with argument -m world_trade_mcp.server, using the project directory as the working directory.

Environment variables

Variable

Required

Purpose

UN_COMTRADE_API_KEY

No

Enables the registered Comtrade data API instead of anonymous preview

WTO_API_KEY

No

Enables WTO Timeseries queries

HTTP_TIMEOUT_SECONDS

No

HTTP timeout (default: 30)

MCP_LOG_LEVEL

No

Logging level (default: INFO)

Never commit .env, API keys, cookies, or personal account credentials.

Example tool calls

UN Comtrade exports from China to the world, HS total, 2024:

  • reporter_code=156

  • partner_code=0 (world)

  • period=2024

  • flow_code=X

  • cmd_code=TOTAL

UN Comtrade imports into the United States from China for HS code 0901 in 2023:

  • reporter_code=842

  • partner_code=156

  • period=2023

  • flow_code=M

  • cmd_code=0901

World Bank example indicator: NE.EXP.GNFS.CD (exports of goods and services, current US$).

Data quality and interpretation

  • Always retain provider, dataset/indicator, reporter, partner, product classification, period, unit, and source notes with a result.

  • Do not interpret mirror statistics as reporter-submitted statistics.

  • Do not compare values from different sources until units, coverage, valuation basis, and definitions have been checked.

  • Product codes are classification- and year-dependent (for example HS revisions); this server does not silently translate between HS editions.

  • A successful API response is not a guarantee that a country/product/period has reported data.

Development

pytest
ruff check .

Official documentation

Roadmap

  1. Add WITS / UNCTAD TRAINS adapter after endpoint and access behavior are validated.

  2. Add national statistical APIs (starting with US Census and selected major trading economies).

  3. Add HS nomenclature and country-code metadata helpers.

  4. Add normalized cross-provider comparison with explicit unit and methodology checks.

  5. Add optional REST/OpenAPI gateway and hosted deployment after the stdio MCP interface is tested.

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides access to UN Comtrade international bilateral trade data via an MCP server, enabling AI agents to query trade statistics through natural language.
      88 npm
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables querying Brazilian foreign trade data through MCP tools for trade flows, freight costs, code resolution, and dataset caveats, with known data defects corrected in responses.
      4
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables querying international macro statistics, company identity data via LEI, and FX rates from dozens of free keyless providers through unified tools.
      12
      MIT