census_trade_trends
Pack: census-trade · Endpoint: https://gateway.pipeworx.io/census-trade/mcp
Monthly US trade trends with ONE trading partner — month-by-month imports and exports for a country, optionally narrowed to an HS commodity, to show seasonality and shifts. A country is required: an unfiltered monthly query spans every partner and the Census API cannot return it in time. For all-countries totals use census_imports / census_exports instead.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
hs_code | string | no | HS commodity code. Optional — omit for aggregate trade. |
country | string | no | Country name in plain English (e.g., “Mexico”). Preferred — resolved for you. REQUIRED unless you pass country_code. |
country_code | string | no | Census Schedule C country code (e.g. “5700” China, “2010” Mexico). NOT an ISO code. Prefer country. Satisfies the country requirement. |
start_year | string | no | Start year (e.g., “2022”). Optional — defaults to the same year as end_year, i.e. a single year. Maximum span 3 years. |
end_year | string | no | End year (e.g., “2024”). Optional — defaults to the last fully-published year (last calendar year; Census publishes on a lag). |
Example call
Arguments
{
"country": "China",
"start_year": "2024",
"end_year": "2024"
}
curl
curl -X POST https://gateway.pipeworx.io/census-trade/mcp \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"census_trade_trends","arguments":{"country":"China","start_year":"2024","end_year":"2024"}}}'
TypeScript (@pipeworx/sdk)
import { Pipeworx } from '@pipeworx/sdk';
const pipeworx = new Pipeworx();
const result = await pipeworx.call('census_trade_trends', {
"country": "China",
"start_year": "2024",
"end_year": "2024"
});
More examples
{
"country": "China",
"hs_code": "85",
"start_year": "2025",
"end_year": "2025"
}
Response shape
Always returns: start_year, end_year, hs_code, country, country_code, months, trends
| Field | Type | Description |
|---|---|---|
start_year | string | Start year of trend range |
end_year | string | End year of trend range |
hs_code | string | HS commodity code or ‘all’ for aggregate |
country | string | Resolved country name as Census reports it, or ‘all’ for all countries |
country_code | string | Census country code or ‘all’ for all countries |
months | number | Number of monthly data points |
trends | array |
Full JSON Schema
{
"type": "object",
"properties": {
"start_year": {
"type": "string",
"description": "Start year of trend range"
},
"end_year": {
"type": "string",
"description": "End year of trend range"
},
"hs_code": {
"type": "string",
"description": "HS commodity code or 'all' for aggregate"
},
"country": {
"type": "string",
"description": "Resolved country name as Census reports it, or 'all' for all countries"
},
"country_code": {
"type": "string",
"description": "Census country code or 'all' for all countries"
},
"months": {
"type": "number",
"description": "Number of monthly data points"
},
"trends": {
"type": "array",
"items": {
"type": "object",
"properties": {
"period": {
"type": "string",
"description": "Month-year period"
},
"imports_usd": {
"type": "number",
"description": "Import value in USD for period"
},
"exports_usd": {
"type": "number",
"description": "Export value in USD for period"
},
"balance_usd": {
"type": "number",
"description": "Trade balance in USD for period"
}
},
"required": [
"period",
"imports_usd",
"exports_usd",
"balance_usd"
]
}
}
},
"required": [
"start_year",
"end_year",
"hs_code",
"country",
"country_code",
"months",
"trends"
]
}
Connect
Add this to your MCP client config, or use one-click install buttons:
{
"mcpServers": {
"census-trade": {
"url": "https://gateway.pipeworx.io/census-trade/mcp"
}
}
}
See Getting Started for client-specific install steps.