Economics
Data source: UN Comtrade
MCP Protocol
Endpoint
https://context.gnist.ai/mcp/un-comtrade/
claude_desktop_config.json
{
"mcpServers": {
"gnist-un-comtrade": {
"url": "https://context.gnist.ai/mcp/un-comtrade/",
"headers": {
"Gnist-API-Key": "YOUR_API_KEY"
}
}
}
}
Shell
curl -X POST "https://context.gnist.ai/mcp/un-comtrade/" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_trade_flow", "arguments": {"reporter": "example", "partner": "example", "commodity_code": "example"}}}'
REST API
API Root
https://context.gnist.ai/rest/un-comtrade/
6 endpoints available:
GET /rest/un-comtrade/get_trade_flowGET /rest/un-comtrade/top_partnersGET /rest/un-comtrade/top_commoditiesGET /rest/un-comtrade/search_commoditiesGET /rest/un-comtrade/trade_balanceGET /rest/un-comtrade/report_feedback
Shell
curl "https://context.gnist.ai/rest/un-comtrade/get_trade_flow?reporter=example&partner=example&commodity_code=example" \ -H "Gnist-API-Key: YOUR_API_KEY"
Python
import httpx
resp = httpx.get(
"https://context.gnist.ai/rest/un-comtrade/get_trade_flow",
headers={"Gnist-API-Key": "YOUR_API_KEY"},
params={
"reporter": "example",
"partner": "example",
"commodity_code": "example"
},
)
print(resp.json())
Command Line
Command
gc un-comtrade
CLI documentation will be available when the GnistAI SDK is published.
Install
pip install gnistai
Available Tools (6)
get_trade_flowFetch bilateral trade flows between two countries for a commodity.
| Parameter | Type | Required | Description |
|---|---|---|---|
reporter | string | required | Reporting country name or ISO numeric code (e.g., "Germany", "276"). |
partner | string | required | Partner country name or ISO numeric code (e.g., "China", "156"). Use "World" or "0" for global aggregates. |
commodity_code | string | required | HS commodity code (e.g., "8471" for computers, "27" for fuels, "TOTAL" for all commodities). Use search_commodities to find codes. |
year_from | any | optional | Start year (e.g., 2018). If omitted, returns most recent year. |
year_to | any | optional | End year (e.g., 2022). If omitted, same as year_from. |
flow | string | optional | Trade direction — "M" (imports), "X" (exports), "MX" (both, default). (default: "MX") |
top_partnersRank a country's top trading partners for a given commodity.
| Parameter | Type | Required | Description |
|---|---|---|---|
reporter | string | required | Reporting country name or ISO numeric code (e.g., "Germany", "276"). |
commodity_code | string | required | HS commodity code (e.g., "87" for vehicles). Use "TOTAL" for all trade. |
year | integer | required | Year (e.g., 2022). |
flow | string | optional | "X" for exports (default) or "M" for imports. (default: "X") |
limit | integer | optional | Number of top partners to return (1–50, default 10). (default: 10) |
top_commoditiesRank the top commodities traded between two countries.
| Parameter | Type | Required | Description |
|---|---|---|---|
reporter | string | required | Reporting country name or ISO numeric code (e.g., "Germany", "276"). |
partner | string | required | Partner country name or ISO numeric code (e.g., "China", "156"). |
year | integer | required | Year (e.g., 2022). |
flow | string | optional | "X" for exports (default) or "M" for imports. (default: "X") |
limit | integer | optional | Number of top commodities to return (1–50, default 10). (default: 10) |
search_commoditiesSearch for HS commodity codes by keyword.
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | required | Keyword to search (e.g., "steel", "petroleum", "machinery", "vehicles"). |
trade_balanceCalculate bilateral trade balance between two countries.
| Parameter | Type | Required | Description |
|---|---|---|---|
reporter | string | required | Reporting country name or ISO numeric code (e.g., "Germany", "276"). |
partner | string | required | Partner country name or ISO numeric code (e.g., "China", "156"). |
year | integer | required | Year (e.g., 2022). |
report_feedbackReport a bug, feature request, or general feedback for this data source.
| Parameter | Type | Required | Description |
|---|---|---|---|
feedback | string | required | |
feedback_type | string | optional | (default: "general") |