un-comtrade-mcp-server
Server Details
UN Comtrade international trade statistics via MCP. Country/HS lookups, flows, balances, rankings.
- Status
- Healthy
- Uptime
- 100.0% over the last 24 hours
- Last Tested
- Transport
- Streamable HTTP · MCP 2025-11-25
- URL
- Repository
- cyanheads/un-comtrade-mcp-server
- GitHub Stars
- 5
- Server Listing
- @cyanheads/un-comtrade-mcp-server
- ChatGPT
- –
- Claude
- –
TDQS
Scored across 11 tools
Each tool occupies a distinct slot: raw retrieval (get_trade_flows / get_services_trade), rankings along three different axes (top_commodities, top_partners, top_reporters, plus a services counterpart), a computed metric (trade_balance), and three reference/lookup tools. The ranking tools explicitly cross-reference each other ("Counterpart to comtrade_get_top_partners", "Use comtrade_get_top_partners to rank the partners of one reporter"), so an agent can route correctly. Goods-vs-services variants are consistently named and described.
Every tool uses the same `comtrade_` prefix followed by a verb_noun pattern: get_*, list_*, lookup_*, search_*. The noun phrases are descriptive and follow the same word-ordering rules within each family (get_top_X, get_*_trade). No camelCase/snake_case mixing or rogue verbs.
11 tools is squarely in the well-scoped range for a trade-data API, with each tool earning its place across retrieval, ranking, computation, and code resolution. Nothing feels redundant or padded.
The surface covers the core lifecycle: discover codes (countries, commodities, service categories), check data availability, retrieve goods and services flows, rank by value across commodities/partners/reporters, and derive trade balance. Minor gaps remain — no direct tool to enumerate classifications/reporter lists or fetch dataset-level metadata outside the availability index, though the availability and search tools provide workarounds.
Available Tools
11 toolscomtrade_get_data_availabilityCheck Data AvailabilityARead-onlyInspect
Check which reporter/period/classification combinations have published data before querying trade. Returns datasets ordered by reporter code, newest period first within each reporter, with classification, record count and release dates where available. Annual data is typically published 3–12 months after the reference year and some reporters skip years. Omit filters to browse the index, 50 rows by default. Continue with nextOffset using the same filters and limit.
Inputs: freq, limit, offset, period, +3 more. Returns: error, shown, notice, offset, +4 more
comtrade_get_services_tradeGet Services Trade DataARead-onlyInspect
Fetch annual international trade-in-services data. Classification EB (default) serves each reporter-period as reported, in its own scheme (EB10, EB10S or EB02 codes); EB10 or EB02 selects UN Comtrade's conversion of other schemes into that one. Each row names its classification and whether it is original or converted. Same bilateral structure as goods trade: returns flow value in USD, period, and reporter/partner/category metadata for each row. Follow nextOffset for remaining records; each page repeats the upstream period requests. Use comtrade_list_service_categories to find a service code and its scheme before querying. Keyless preview makes one request per served period, at least 4 seconds apart, capped at 500 records per request. Services coverage is more limited than goods trade.
Inputs: period (required), flow_code (required), reporter_code (required), limit, +4 more. Returns: error, shown, notice, offset, +8 more
comtrade_get_top_commoditiesGet Top Trade CommoditiesARead-onlyInspect
Rank HS chapters (2-digit) or headings (4-digit) by trade value for one reporter, flow, and annual or monthly period. Set parent_code and a deeper aggr_level to rank headings or subheadings within one chapter or heading. The tool uses matching TOTAL to identify the HS edition and queries explicit commodity codes in chunks, subdividing capped chunks. Shares use matching TOTAL or the reported parent value for a drill-down. Incomplete coverage returns available categories without ranks or shares and identifies unresolved codes. Defaults to World; optionally select one bilateral partner. Counterpart to comtrade_get_top_partners.
Inputs: period (required), flow_code (required), reporter_code (required), limit, +3 more. Returns: error, notice, period, flowCode, +13 more
comtrade_get_top_partnersGet Top Trading PartnersARead-onlyInspect
Rank trading partners for a reporter by trade value for a given commodity and flow direction. Returns the top N partners sorted by descending value — answers "who does country X mainly export product Y to?" or "where does country X mainly import product Z from?" for a single period. Fetches a disaggregated breakdown across all partners then sorts locally. Takes an HS or SITC code in the selected classification; omit cmd_code to rank partners for total trade.
Inputs: period (required), flow_code (required), reporter_code (required), limit, +2 more. Returns: error, notice, period, cmdCode, +9 more
comtrade_get_top_reportersGet Top Goods ReportersARead-onlyInspect
Rank retrieved reporting areas by reported import or export value for one goods code and period. Partner 0 (World) ranks reporters by their trade with all partners. Use a bilateral partner to rank reporters by their trade with that area. Shares use the retrieved reporting areas before the display limit. Use comtrade_get_top_partners to rank the partners of one reporter.
Inputs: period (required), flow_code (required), limit, cmd_code, +2 more. Returns: error, period, cmdCode, flowCode, +8 more
comtrade_get_top_services_partnersGet Top Services Trading PartnersARead-onlyInspect
Rank partners of one reporter by trade value for a single annual EBOPS series. Omit service_code for total services, or use comtrade_list_service_categories to find one category. EB serves original reports, while EB10 and EB02 serve converted series. Shares divide by the sum of eligible retrieved partners before the display limit. Read coverageNotice before interpreting the ranking.
Inputs: period (required), flow_code (required), reporter_code (required), limit, +2 more. Returns: error, notice, period, flowCode, +12 more
comtrade_get_trade_balanceGet Trade BalanceARead-onlyInspect
Compute the trade balance for a country over one or more periods — total exports minus total imports — with an optional HS or SITC commodity filter whose codes must not overlap. Keyless preview makes two requests per served period, at least 4 seconds apart; authenticated calls batch periods. Returns the export and import values per period and, when both flows have data, the signed balance (USD) and coverage ratio (exports / imports). Note: mirror asymmetry is common — balance reflects values as reported by this country; the same flow may be recorded differently by the partner. Uses comtrade_lookup_countries to resolve reporter codes.
Inputs: period (required), reporter_code (required), freq, cmd_code, +2 more. Returns: error, notice, periods, cmdCodes, +9 more
comtrade_get_trade_flowsGet Trade Flow RecordsARead-onlyInspect
Fetch bilateral trade flow records — the primary data retrieval tool. Returns trade value in USD (primaryValue — FOB for exports, CIF for imports), quantity, net weight, and period/commodity/partner metadata for each row. Accepts multiple periods and commodity codes per call; pass partner_code 0 to get totals aggregated across all partners. Omit cmd_code or pass "TOTAL" to aggregate all commodities. Follow nextOffset for remaining records; each page repeats the upstream period requests. Keyless preview makes one request per served period, at least 4 seconds apart, with a 500-record cap per request. Use comtrade_lookup_countries to resolve reporter/partner codes and comtrade_search_commodities to resolve HS codes. For SITC, supply codes from the selected SITC revision.
Inputs: period (required), flow_code (required), freq, limit, +5 more. Returns: error, shown, notice, offset, +12 more
comtrade_list_service_categoriesList Service Trade Categories (EB)ARead-onlyInspect
List service trade categories from the combined EB catalog, including numeric EBOPS and SDMX codes. Returns category codes, descriptions, parent codes, and the EBOPS scheme catalogs that list each code: EB10 (EBOPS 2010), EB10S (EBOPS 2010 SDMX codes), EB02 (EBOPS 2002). Search by keyword or by several terms in any order, or browse direct children of a parent code; "200" lists the EB10 and EB02 top levels. Use the returned id as service_code in comtrade_get_services_trade. Code 3 is transport; SA is manufacturing services. Each page holds up to limit categories; continue with nextOffset using the same query and parent_code.
Inputs: limit, query, offset, parent_code. Returns: error, shown, notice, offset, +4 more
comtrade_lookup_countriesLookup Countries / AreasARead-onlyInspect
Resolve country and area names to Comtrade M49 numeric codes used in all data queries. Accepts a partial or full name, an official name (e.g. "Republic of Korea"), a common name (e.g. "UK", "Turkey"), or an ISO alpha-2/alpha-3 code (e.g. "USA", "US"), ignoring case and accents; exact matches are listed before partial ones. Returns matching entries with their numeric code, ISO identifiers, a validAsReporter flag, and validity dates; within the exact and partial groups, historical entities such as Fed. Rep. of Germany (...1990) are listed after current ones. World (code 0) is a valid partner but not a valid reporter, while some groupings, such as the European Union (97), do report — check validAsReporter. Use this before any trade data tool that requires reporter_code or partner_code. To aggregate across all partners, use partner code 0 (World) — no lookup needed.
Inputs: query (required), role, include_groups. Returns: error, notice, matches, totalMatches
comtrade_search_commoditiesSearch Commodity CodesARead-onlyInspect
Find HS or SITC commodity codes by keyword, description, or code prefix. A code written with dots, spaces, or hyphens ("0901.11") matches 090111. Exact codes, code prefixes and contiguous description matches rank first, followed by descriptions containing every query term in any order. Default HS searches include historical codes and report which edition catalogs list each code. Use a trade row’s classificationCode or comtrade_get_data_availability to identify the edition, then search that edition for its descriptions. Keyless goods queries use HS for as-reported data. Continue with nextOffset using the same query, classification, and aggr_level.
Inputs: query (required), limit, offset, aggr_level, +1 more. Returns: error, shown, notice, offset, +6 more
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
Related MCP Connectors
Comtrade MCP — UN Comtrade API for international bilateral trade data
Trade Intel MCP — Compound tools that chain Comtrade, Census, Treasury,
Brazil Comex Stat MCP — Brazilian foreign trade statistics from MDIC (Ministério do…
Japan export and import customs statistics (Ministry of Finance) by code. No API key required.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceProvides access to UN Comtrade international bilateral trade data via an MCP server, enabling AI agents to query trade statistics through natural language.66 npmMIT
- AlicenseAqualityDmaintenanceAn MCP server for the U.S. Census Bureau's International Trade Data API, enabling queries of monthly export and import statistics by HS, NAICS, end-use, and other classifications, with tools for trade balance, top partners, and country code lookup.7Creative Commons Zero v1.0 Universal
- AlicenseNot gradedqualityBmaintenanceRead-only MCP tools for querying USDA FAS Global Agricultural Trade System census export and import records by partner country, year, month and HS10 code prefix, plus the release-date lists for each flow. Results are capped with notes on omitted rows, and responses carry release vintages and retrieval metadata.32 PyPIApache 2.0
- AlicenseAqualityBmaintenanceEnables 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.4MIT
Glama MCP Gateway
Add one secure layer between your agents and this server.