# Reported issues for un-comtrade-mcp-server

Pod holds 13 of 13 GitHub reports that passed its relevance review. This can include external user reports, maintainer-confirmed bugs, and concrete feature gaps. Treat them as evidence to inspect, not a count of distinct defects.

Back to [un-comtrade-mcp-server](/mcp/un-comtrade-mcp-server).

## Most discussed

### bug(comtrade_get_services_trade): cmdDesc enrichment uses HS lookup instead of EBOPS lookup

### Server version

0.1.2

### mcp-ts-core version

^0.9.9

### Runtime

Node.js

### Runtime version

Node 24.x

### Transport

HTTP (Streamable HTTP)

### Description

`comtrade_get_services_trade` returns wrong `cmdDesc` values for service categories. The description enrichment fallback in `ComtradeDataService.fetchTradeData` always calls `ref.getHsCode(row.cmdCode)` regardless of trade type. EBOPS service category codes (e.g. `"10"`, `"3"`, `"1"`) collide with HS chapter codes. When the…

[Read the thread](https://github.com/cyanheads/un-comtrade-mcp-server/issues/6) · 2026-05-26 · closed · 2 comments

### bug(comtrade_get_top_partners): same partner appears multiple times in results

### Server version

0.1.2

### mcp-ts-core version

^0.9.9

### Runtime

Node.js

### Runtime version

Node 24.x

### Transport

HTTP (Streamable HTTP)

### Description

`comtrade_get_top_partners` returns duplicate entries for the same partner country. Same root cause as #4: when querying without `partnerCode`, the API returns one row per distinct `(partnerCode, motCode, customsCode, partner2Code)` combination. For Germany 2022, Poland (`partnerCode=616`) appears at rank 2 as `motCode=0,…

[Read the thread](https://github.com/cyanheads/un-comtrade-mcp-server/issues/5) · 2026-05-26 · closed · 2 comments

### bug(comtrade_get_trade_balance): balance values inflated due to multi-HS-edition summation

### Server version

0.1.2

### mcp-ts-core version

^0.9.9

### Runtime

Node.js

### Runtime version

Node 24.x

### Transport

HTTP (Streamable HTTP)

### Description

`comtrade_get_trade_balance` produces grossly inflated trade values — approximately 8–9x the real figure for tested countries. Root cause: the Comtrade preview API returns one row per distinct `(motCode, customsCode, partner2Code)` combination for each reporter/flow/period/cmdCode. For example, Germany 2022 exports with…

[Read the thread](https://github.com/cyanheads/un-comtrade-mcp-server/issues/4) · 2026-05-26 · closed · 2 comments

### bug(setup): reference data load log silently dropped — logger not initialized during setup()

### Server version

0.1.0

### mcp-ts-core version

0.9.9

### Runtime

Node.js

### Runtime version

Node 25.9.0

### Transport

HTTP

### OS

macOS 25.1.0

### Description

The `setup()` callback in `src/index.ts` calls `core.logger.info('Comtrade reference data loaded...')` to confirm that reference data was loaded at startup. This log message is silently dropped and never appears in the server output.

Root cause: the mcp-ts-core framework initializes the logger (via `logger.initialize()`)…

[Read the thread](https://github.com/cyanheads/un-comtrade-mcp-server/issues/3) · 2026-05-26 · closed · 2 comments

### bug(comtrade_get_top_commodities): aggrLevel filter passes all records when API returns null for aggrLevel field

### Server version

0.1.0

### mcp-ts-core version

0.9.9

### Runtime

Node.js

### Runtime version

Node 25.9.0

### Transport

HTTP

### OS

macOS 25.1.0

### Description

`comtrade_get_top_commodities` returns 6-digit HS codes when called with `aggr_level: 2` (chapters). The Comtrade preview endpoint returns records with `aggrLevel: null` regardless of the `aggrLevel` query parameter — the API accepts the param but doesn't filter rows by it. The handler filter at line 143 is:

```ts
const…

[Read the thread](https://github.com/cyanheads/un-comtrade-mcp-server/issues/2) · 2026-05-26 · closed · 2 comments

### bug(comtrade-reference-service): server crashes at startup — reference endpoint response envelope not unwrapped

### Server version

0.1.0

### mcp-ts-core version

0.9.9

### Runtime

Node.js

### Runtime version

Node 25.9.0

### Transport

stdio

### OS

macOS 25.1.0

### Description

The server crashes immediately at startup with `TypeError: reporters is not iterable`. The `ComtradeReferenceService.fetchJson` method typed and cast each reference file response as a direct array (`T[]`), but every UN Comtrade reference endpoint wraps its data in a `{ "results": [...] }` envelope. Iterating over the…

[Read the thread](https://github.com/cyanheads/un-comtrade-mcp-server/issues/1) · 2026-05-26 · closed · 2 comments

### feat(config): default MCP_SESSION_MODE to stateless across env, Docker, and src

`Dockerfile` sets `ENV MCP_SESSION_MODE="stateless"`, but `.env.example` carries a commented `# MCP_SESSION_MODE=stateful`, whose comment documents the value set as `stateful | stateless (default: stateful)`. The container and the same code run via `bunx`, `npm start`, or from source therefore resolve to different session modes — stateless in Docker, stateful everywhere else, since the framework schema defaults to `auto` and `auto` resolves to `stateful`.

Related: cyanheads/mcp-ts-core#376

##…

[Read the thread](https://github.com/cyanheads/un-comtrade-mcp-server/issues/12) · 2026-08-22 · closed · 1 comment

### bug(comtrade_get_trade_flows): multi-period calls always fail without a subscription key — preview endpoint accepts one period

### Server version

0.1.6

### mcp-ts-core version

0.13.6

### Runtime

Bun

### Runtime version

Bun 1.4.0

### Transport

http

### Description

`comtrade_get_trade_flows`, `comtrade_get_trade_balance`, and `comtrade_get_services_trade` all declare `period` as 1–12 entries and describe passing several years in one call to build a time series. The [UN Comtrade](https://comtradeplus.un.org/) public preview endpoint accepts exactly one period, so on the keyless path — the default — every…

[Read the thread](https://github.com/cyanheads/un-comtrade-mcp-server/issues/13) · 2026-09-20 · open · 0 comments

## Most recent

### feat(comtrade_get_data_availability): default classification should follow type_code — services lookups need EB10, not HS

### Server version

0.1.5

### mcp-ts-core version

0.12.3

### Runtime

Bun 1.4.0

### Transport

stdio

### Description

`comtrade_get_data_availability` defaults `classification` to `"HS"`, but services availability lives under EB10. So `type_code: "S"` with defaults always returns empty, even for reporters with substantial services coverage — verified: USA with defaults → 0 datasets; USA with `classification: "EB10"` → 14 datasets (2021 alone: 10,640 records).

The recovery hint…

[Read the thread](https://github.com/cyanheads/un-comtrade-mcp-server/issues/11) · 2026-08-21 · open · 0 comments

### bug(comtrade_get_services_trade): 200 responses without a data field are silently normalized to empty results

### Server version

0.1.5

### mcp-ts-core version

0.12.3

### Runtime

Bun 1.4.0

### Transport

stdio

### Description

`comtrade-data-service.ts:92` normalizes every upstream response with `raw.data ?? []`. Any HTTP 200 body that lacks a `data` field — including API rate-limit/quota envelopes, which the Comtrade preview endpoint returns with a 200 in some paths — is silently converted to "0 records". A transient rate-limit response is therefore indistinguishable from genuine empty coverage,…

[Read the thread](https://github.com/cyanheads/un-comtrade-mcp-server/issues/10) · 2026-08-21 · open · 0 comments

### bug(comtrade-data-service): free-tier truncation flag can never fire — preview endpoint caps totalCount alongside rows

### Server version

0.1.5

### mcp-ts-core version

0.12.3

### Runtime

Bun 1.4.0

### Transport

stdio

### Description

The tools' `truncated` output field is documented as "True when results were capped at 500" (free-tier preview cap), but the condition computing it can never be true on the free tier, because the preview endpoint caps its `count` field at 500 alongside the rows. The disclosure is dead exactly when data is actually cut.

### Steps to reproduce

1. Keyless, call…

[Read the thread](https://github.com/cyanheads/un-comtrade-mcp-server/issues/9) · 2026-08-21 · open · 0 comments

### bug(comtrade_get_top_commodities): chapter-level rankings return wrong values — duplicate chapters, totals far below reporter total

### Server version

0.1.5

### mcp-ts-core version

0.12.3

### Runtime

Bun 1.4.0

### Transport

stdio

### Description

`comtrade_get_top_commodities` at chapter level (`aggr_level: 2`) returns impossible rankings and totals that are a small fraction of the reporter's real trade. Chapter `97` appears twice in a single top-5 ranking, and the summed total is ~3% of what the sibling tools report for the identical reporter/period/flow.

### Steps to reproduce

1. Call…

[Read the thread](https://github.com/cyanheads/un-comtrade-mcp-server/issues/8) · 2026-08-21 · open · 0 comments

### feat(comtrade_get_trade_flows): add SITC classification support

### Use case

The `classification` parameter on `comtrade_get_trade_flows` and `comtrade_get_trade_balance` is restricted to HS variants only (`HS | H0 | H1 | H2 | H3 | H4 | H5 | H6`). The [UN Comtrade API](https://comtradeplus.un.org/) also publishes commodity data under the Standard International Trade Classification (SITC) revisions 1–4 (`S1`–`S4`, plus the combined `SS`), but passing any of these codes is blocked at the Zod layer before the request is sent. Trade research workflows that…

[Read the thread](https://github.com/cyanheads/un-comtrade-mcp-server/issues/7) · 2026-06-03 · open · 0 comments

The remaining reports are on [the project's issue tracker](https://github.com/cyanheads/un-comtrade-mcp-server/issues).
