Back to connectors
US Foreign Trade logo

US Foreign Trade

Live

US Census Bureau imports and exports time series, by HS commodity, NAICS, US port, US state, and trading-partner country, with built-in CTY_CODE-to-ISO and HS chapter lookups.

Available tools

8 tools
ToolDescription
searchExportsUS exports by HS or NAICS code, country, month. Auto-routes to /exports/hs vs /exports/naics. Default COMM_LVL=HS4.
searchImportsUS imports by HS or NAICS code, country, month. Auto-routes to /imports/hs vs /imports/naics. Default COMM_LVL=HS4.
searchTradeByPortHS commodity × US port × country (porths). Filter by 4-digit port code (5301=Houston, 4601=NY/NJ).
searchTradeByStateHS commodity × US state × country (statehs). Filter by 2-letter state postal (TX, CA, LA).
getTradeBalanceFetches both directions in parallel, returns {exportsValue, importsValue, balance} for an HS code + time slice.
getCountryCodesBuilt-in CTY_CODE↔ISO lookup. Top 30 US trading partners + USMCA / OECD / NATO / APEC rollups. No upstream call.
lookupHsCodeBuilt-in HS chapter index for petroleum (27), petrochem (28/29/39), iron/steel (72/73), machinery (84/85), ores (26).
getServiceInfoEndpoints, common variables, country-code system, asymmetric value-field warning, and time-format options.

Setup

A few steps to connect your AI agents to US Foreign Trade.

Get started
  1. 1

    Toggle Connector On

    Open /mcp and enable US Foreign Trade with the toggle, no credentials needed.

  2. 2

    Start Querying

    Call searchImports with hsCode: '2709' (crude petroleum) and time: '2024-01' to surface the top US suppliers and dollar values for the month. getTradeBalance with hsCode: '2710' and countryCode: '2010' (Mexico) returns net trade for the year. searchTradeByState with state: 'TX' and hsCode: '2711' surfaces LNG exports out of Texas.

  3. 3

    Optional: Raise Tier Limits

    Register at https://api.census.gov/data/key_signup.html for a free access key and set CENSUS_API_KEY in your Vercel environment to raise the rate limit from 500 calls/day per IP.

Connect to your AI assistant

Pick the tool your team uses for the exact setup steps.

  1. 1

    Open Claude settings

    Launch Claude, click the profile button (bottom left), and go to Settings.

  2. 2

    Access connectors

    Open the Connectors tab, scroll to the bottom, and click “Add custom connector”.

  3. 3

    Name your connector

    Enter any name you’d like for this connector.

  4. 4

    Get the connector URL

    Log in to PatchOps, open the /mcp page, and copy the connector URL you want to use.

  5. 5

    Add the connector

    Paste the URL into the “Remote MCP server URL” box and click Add.

  6. 6

    Start using

    Your US Foreign Trade connector is ready to use in Claude.