
Un Comtrade Mcp Server
Connects Claude to the UN Comtrade database for querying international merchandise and services trade statistics. Nine tools cover the full workflow: resolve country names to M49 codes, search HS commodity classifications by keyword, fetch bilateral trade flows with partner and commodity breakdowns, compute trade balances, rank top partners or commodities by value, and check data availability before expensive queries. Free tier allows 500 records per call and 500 requests per day, so you'll want to use the aggregation and filtering options carefully. Requires your own UN Comtrade subscription key. Reach for this when building trade analysis workflows, export/import dashboards, or policy research tools that need structured access to official trade statistics without scraping Excel files.
- GitHub stars
- 4
- tools
- 9
- transport
- STDIO, HTTP
- env vars
- 7
- last updated
- Nov 11, 2026
Install
From registry metadata$ npx add-mcp https://un-comtrade.caseyjhand.com/mcp --name un-comtradeRun in your terminal. add-mcp asks which agents to add it to (Claude Code, Codex, Cursor and more). Add -g to install it for every project.
Review the command, arguments and environment values before installing. MCP servers run with your local permissions.
Other ways
Claude Code
$ claude mcp add --transport http un-comtrade https://un-comtrade.caseyjhand.com/mcpRun in your terminal. Add --scope user to make it available in every project.
Tools
Verified live · 9 toolsVerified live against the running server on Nov 6, 2026.
comtrade_lookup_countriesResolve country and area names to Comtrade M49 numeric codes used in all data queries. Accepts a partial name, full name, or ISO alpha-2/alpha-3 code (e.g. "United States", "USA", "US"). Returns matching entries with their numeric code, ISO identifiers, a validAsReporter flag,...3 params
Resolve country and area names to Comtrade M49 numeric codes used in all data queries. Accepts a partial name, full name, or ISO alpha-2/alpha-3 code (e.g. "United States", "USA", "US"). Returns matching entries with their numeric code, ISO identifiers, a validAsReporter flag,...
include_groupsbooleanquery*stringrolestringreporter · partner · anydefault: anycomtrade_search_commoditiesFind HS or SITC commodity codes by keyword, partial description, or code prefix in the selected classification. Returns descriptions, native aggregation levels, parents, leaf status, and recommendedQueryCode for subsequent trade queries. HS uses levels 2 (chapter), 4 (heading)...5 params
Find HS or SITC commodity codes by keyword, partial description, or code prefix in the selected classification. Returns descriptions, native aggregation levels, parents, leaf status, and recommendedQueryCode for subsequent trade queries. HS uses levels 2 (chapter), 4 (heading)...
aggr_levelvalueclassificationstringlimitintegeroffsetintegerquery*stringcomtrade_list_service_categoriesList 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). Filte...4 params
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). Filte...
limitintegeroffsetintegerparent_codestringquerystringcomtrade_get_trade_flowsFetch 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;...7 params
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;...
classificationstringcmd_codearrayflow_code*stringfreqstringpartner_codeintegerperiod*arrayreporter_codevaluecomtrade_get_trade_balanceCompute the trade balance for a country over one or more periods — total exports minus total imports — with optional HS or SITC commodity filter. Keyless preview makes two requests per served period, at least 4 seconds apart; authenticated calls batch periods. Returns the sign...6 params
Compute the trade balance for a country over one or more periods — total exports minus total imports — with optional HS or SITC commodity filter. Keyless preview makes two requests per served period, at least 4 seconds apart; authenticated calls batch periods. Returns the sign...
classificationstringcmd_codearrayfreqstringpartner_codeintegerperiod*arrayreporter_code*integercomtrade_get_top_partnersRank 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 p...6 params
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 p...
classificationstringcmd_codestringflow_code*stringlimitintegerperiod*stringreporter_code*integercomtrade_get_top_commoditiesRank HS chapters (2-digit) or headings (4-digit) by trade value for one reporter, flow, and annual or monthly period. Retrieves matching TOTAL and the reporter’s HS edition, then queries explicit commodity codes in chunks; capped chunks are subdivided. Shares use matching TOTA...6 params
Rank HS chapters (2-digit) or headings (4-digit) by trade value for one reporter, flow, and annual or monthly period. Retrieves matching TOTAL and the reporter’s HS edition, then queries explicit commodity codes in chunks; capped chunks are subdivided. Shares use matching TOTA...
aggr_levelvalueflow_code*stringlimitintegerpartner_codeintegerperiod*stringreporter_code*integercomtrade_get_data_availabilityCheck which reporter/period/classification combinations have published data before constructing expensive trade queries. Returns dataset records with period, classification, record count, and first/latest release dates. Call this before querying recent periods — annual data is...7 params
Check which reporter/period/classification combinations have published data before constructing expensive trade queries. Returns dataset records with period, classification, record count, and first/latest release dates. Call this before querying recent periods — annual data is...
classificationstringfreqstringlimitintegeroffsetintegerperiodstringreporter_codeintegertype_codestringcomtrade_get_services_tradeFetch 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 classificatio...6 params
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 classificatio...
classificationstringEB · EB10 · EB02default: EBflow_code*stringpartner_codeintegerperiod*arrayreporter_code*integerservice_codestringSponsors
Configuration
COMTRADE_SUBSCRIPTION_KEYAzure API Management key from comtradedeveloper.un.org. Optional — without it, tools fall back to the public preview endpoint (500-record cap).
MCP_LOG_LEVELdefault: infoSets the minimum log level for output (e.g., 'debug', 'info', 'warn').
MCP_TRANSPORT_TYPEdefault: httpSelects the HTTP transport.
MCP_HTTP_HOSTdefault: 127.0.0.1The hostname for the HTTP server.
MCP_HTTP_PORTdefault: 3010The port to run the HTTP server on.
MCP_HTTP_ENDPOINT_PATHdefault: /mcpThe endpoint path for the MCP server.
MCP_AUTH_MODEdefault: noneAuthentication mode to use: 'none', 'jwt', or 'oauth'.
Readme
@cyanheads/un-comtrade-mcp-server
Access UN Comtrade international merchandise and services trade statistics — country lookups, HS commodity search, bilateral trade flows, balances, rankings, and data availability — via MCP. STDIO or Streamable HTTP.
Details
- Repository
- github.com/cyanheads/un-comtrade-mcp-server
- Package
@cyanheads/un-comtrade-mcp-server- Transport
- STDIO, HTTP
- Registry
- MCP registry, active
- Resources
- 5
- Tools verified
- Nov 6, 2026
More from cyanheads
- Aviation Weather Mcp Server3
- Devops Status Mcp Server3
- Earthquake Mcp Server3
- Eia Energy Mcp Server3
- Ensembl Mcp Server3
- Noaa Marine Mcp Server3
- Openstates Mcp Server3
- Treasury Fiscaldata Mcp Server3
- Usgs Water Mcp Server3
- Wikidata Mcp Server3
- Worldbank Mcp Server3
- Mcp Ts Core153
- Arxiv Mcp Server7
- Bluesky Mcp Server2
- Fbi Crime Mcp Server2
- Fema Mcp Server2
- Imf Mcp Server2
- Nonprofit Explorer Mcp Server2
- Onebusaway Mcp Server2
- Openfec Mcp Server2
- Openfoodfacts Mcp Server2
- Reliefweb Mcp Server2
- Smithsonian Mcp Server2
- Stackexchange Mcp Server2