Comtrade

liveTradeEconomics

UN Comtrade API for international bilateral trade data.

4tools
0msauth
free tier50 calls/day

Tools

comtrade_trade_data

Trade values and quantities between two countries, from UN Comtrade customs statistics.

No parameters required.

Try it
comtrade_top_partners

Find a country's top trading partners ranked by trade volume. Returns partner countries and total trade values. Defaults to ANNUAL; pass frequency="monthly" for a single month's ranking instead of the

No parameters required.

Try it
comtrade_top_commodities

Rank the products two countries actually trade, largest value first — "what does the US import most from China". Returns HS categories with trade value and net weight. Defaults to HS 2-digit chapters

No parameters required.

Try it
comtrade_country_codes

Look up UN Comtrade reporter/partner codes for trade queries (e.g., "842" = US, "156" = China). Note Comtrade uses 842 for the US, not the ISO 840. Returns code and country name pairs.

No parameters required.

Try it

Test with curl

The gateway speaks JSON-RPC 2.0 over HTTP POST. You can test any pack directly from the terminal.

List available tools
bash
curl -X POST https://gateway.pipeworx.io/comtrade/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
Call a tool
bash
curl -X POST https://gateway.pipeworx.io/comtrade/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"comtrade_trade_data","arguments":{}}}'

Use with the SDK

Install @pipeworx/sdk to call tools from any TypeScript/Node project.

TypeScript
import { Pipeworx } from '@pipeworx/sdk';
const px = new Pipeworx();
const result = await px.call("comtrade_trade_data", {});
ask_pipeworx
// Or ask in plain English:
const answer = await px.ask("un comtrade api for international bilateral trade data");

Related compound tools

These combine Comtrade with other data sources in a single call:

Compound trade-intelligence tools chaining Comtrade, Census, and Treasury — bilateral analysis, country profiles, and US macro trade dashboard in one call.

3 tools — trade_bilateral_analysis, trade_country_profile, trade_macro_dashboard

Related packs

Other Pipeworx packs in the same categories (Trade, Economics):