census-trade-mcp-server
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| PORT | No | Port for the HTTP transport. Only used when TRANSPORT=http. | |
| TRANSPORT | No | Transport mode. Set to 'http' to run as a local streamable-HTTP server; defaults to 'stdio'. | stdio |
| CENSUS_API_KEY | Yes | Your Census API key. Required to access the U.S. Census Bureau International Trade Data API. |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| census_trade_list_datasetsA | List the 9 commodity classification / geography datasets available in the Census International Trade Data API, for both exports and imports. Use this first when you're not sure which dataset to query. Each dataset covers the same underlying monthly trade data (2010-present) but organizes it by a different commodity classification (HS, NAICS, End-Use, SITC, USDA, Advanced Technology) or geography (state, port instead of customs district). Args: none. Returns: For each dataset - its short code (used as the "dataset" parameter in census_trade_query_exports/imports), full name, description, level of detail available for exports vs. imports, and which commodity-code parameters it accepts. Examples:
|
| census_trade_get_dataset_variablesA | List every valid Census API variable (field) name for a specific dataset + trade direction, straight from the Census API's own metadata. Use this before calling census_trade_query_exports/imports when you're unsure which variable names are valid to put in the "get" or "filters" parameters - the Census API rejects unknown variable names with a 400 error, and valid variables differ by dataset (e.g. "SITC" is only valid on the sitc dataset, not hs). Args:
Returns: For each variable - its name, human-readable label, whether it's required, and its type (string/int/datetime). Examples:
|
| census_trade_query_exportsA | Query monthly U.S. export statistics (January 2010-present) from the Census International Trade Data API. This is the general-purpose tool for pulling export data by commodity (HS/NAICS/End-Use/SITC/USDA/Hi-Tech), country, customs district, state, or port, for any combination of value/quantity/weight measures. Args:
Best practices (per the Census API User Guide):
Returns: Rows as either a markdown table or JSON, each row containing the fields requested in "get" plus "time". Examples:
|
| census_trade_query_importsA | Query monthly U.S. import statistics (January 2010-present) from the Census International Trade Data API. This is the general-purpose tool for pulling import data by commodity (HS/NAICS/End-Use/SITC/USDA/Hi-Tech), country, customs district, state, or port, for any combination of value/quantity/weight measures. Import value fields typically start with GEN_ (general imports) or CON_ (imports for consumption) rather than ALL_ (which is export-only). Args:
Best practices (per the Census API User Guide):
Returns: Rows as either a markdown table or JSON, each row containing the fields requested in "get" plus "time". Examples:
|
| census_trade_get_trade_balanceA | Compute the U.S. trade balance (exports minus imports) with one or more countries or country groupings, for a given time period, in one call. This is a workflow tool that combines an exports/hs query and an imports/hs query (which census_trade_query_exports/imports would otherwise require two separate calls to do), sums values across the requested period, and computes the balance per country plus a combined total. Args:
Returns: Per-country exports, imports, and balance in USD, plus a combined total row. Positive balance = U.S. trade surplus with that country; negative = deficit. Examples:
|
| census_trade_get_top_partnersA | Return the top N countries ranked by U.S. export or import value for a given period and (optionally) a specific commodity - the Census API itself does not sort results, so this tool fetches the full country breakdown and sorts it for you. Args:
Returns: Ranked list with country, value in USD, and percentage share of total trade across all countries in the response, plus the grand total and count of countries with any trade. Examples:
|
| census_trade_lookup_country_codeA | Look up the Census Bureau Schedule C CTY_CODE (and country groupings like OPEC, NAFTA, European Union, or world regions) needed to filter census_trade_query_exports/imports by country. The Census API filters trade data by a numeric CTY_CODE, not by country name (CTY_NAME can only be requested as a descriptive field alongside CTY_CODE, not used as a filter by itself). Use this tool to translate a country name into the code you need. Args:
Returns: Matching entries with their CTY_CODE, name, and ISO alpha-2 code (for individual countries) or just code+name (for groupings). Note South Korea is listed as "South Korea (Republic of Korea)" and North Korea as "North Korea (Democratic People's Republic of Korea)". Examples:
|
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 7 tools
Each tool has a clearly distinct purpose: querying exports vs. imports, listing datasets, inspecting variables, computing trade balance, ranking partners, and looking up country codes. There is no functional overlap that would cause an agent to select the wrong tool.
All tool names follow the consistent verb_noun pattern with the census_trade_ prefix (query_exports, query_imports, list_datasets, get_dataset_variables, get_trade_balance, get_top_partners, lookup_country_code). This makes the API surface predictable and easy to navigate.
Seven tools is a well-scoped size for this domain. Each tool serves a distinct and necessary function for working with Census trade data, without being bloated or too minimal.
The set covers the full workflow: dataset discovery, variable inspection, raw data queries for exports/imports, derived analytics (trade balance, top partners), and supporting lookups (country codes). There are no obvious dead ends or missing operations for the stated purpose of accessing U.S. Census trade statistics.