What is US Foreign Trade?
U.S. Census Bureau Foreign Trade Division international trade time series — eight endpoints span the full feed: hs / porths / statehs / naics × imports / exports. Filter by HS-2/HS-4/HS-6/HS-10 chapters, NAICS-4/NAICS-6, country (Census Schedule C/D codes), district, port, or US state, and slice by month / year / arbitrary date range (`time=2024-01`, `time=2024`, `time=from 2024-01 to 2024-12`). The connector ships a built-in CTY_CODE↔ISO mapping table for the top 30 US trading partners (Canada 1220, Mexico 2010, China 5700, Japan 5880, Germany 4280, UK 4120, Saudi Arabia 5170, …) plus USMCA / OECD / NATO / APEC trade-group rollups, and a built-in HS chapter index covering petroleum (27 — 2709 crude, 2710 refined, 2711 LNG/LPG, 2716 electrical energy), petrochem (28 / 29 / 39), iron and steel (72 / 73 — line pipe and OCTG), machinery (84 / 85), and ores (26). getTradeBalance is a convenience that fetches both directions and returns {exportsValue, importsValue, balance}. Asymmetric value/commodity columns: exports use ALL_VAL_MO + E_COMMODITY; imports use GEN_VAL_MO + I_COMMODITY — the search methods dispatch on direction so callers don't have to. Country codes are Census Schedule C (imports) / Schedule D (exports), NOT ISO. Optional CENSUS_API_KEY platform env var raises the rate limit from 500 calls/day per IP. Toggle on and use — no setup needed.
Available Tools
Requirements
- Toggle onToggle on and use — no setup needed.
Quick Setup Guide
Follow these steps to connect your AI agents to this connector
Open /mcp and enable US Foreign Trade with the toggle — no credentials needed.
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.
Register at https://api.census.gov/data/key_signup.html for a free API 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
Choose your AI assistant below for specific setup instructions
Follow these steps to connect US Foreign Trade to Claude:
Step 1: Open Claude Settings
Launch Claude → Click the profile button (bottom left) → Navigate to Settings
Step 2: Access Connectors
Scroll down to the Connectors tab → Navigate to the bottom → Click “Add Custom Connector”
Step 3: Name Your Connector
Enter any name you'd like for this connector
Step 4: Get the Connector URL
Log in to PatchOps → Navigate to the /mcp page → Copy the connector URL you want to use
Step 5: Add the Connector
Paste the URL in the “Remote MCP Server URL” text box → Click Add
Step 6: Start Using
Your connector is now ready to use in Claude
Follow these steps to connect US Foreign Trade to ChatGPT:
Step 1: Enable Developer Mode
Go to Settings → Connectors → Advanced → Enable Developer mode
Step 2: Create New Connector
Go back to Connectors page → Click “Create” (top right)
Step 3: Name Your Connector
Enter any name you'd like for this connector (descriptions are optional)
Step 4: Get the Connector URL
Log in to PatchOps → Navigate to the /mcp page → Copy the connector URL you want to use
Step 5: Add the URL
Paste the URL in the “MCP Server URL” text box
Step 6: Set Authentication
Click the authentication dropdown → Select “No authentication” (PatchOps handles authentication internally)
Step 7: Create the Connector
Click “I understand and want to continue” checkbox → Press Create
Step 8: Using the Connector
Start a new chat → Click the + button (left of text box) → Open dropdown → Hover over three dots labeled “More” → Select your connector
Instructions for connecting US Foreign Trade to GitHub Copilot:
Coming Soon
Detailed setup instructions for GitHub Copilot will be added here.
For other MCP-compatible platforms:
Step 1: Get the Connector URL
Log in to PatchOps → Navigate to the /mcp page → Copy the connector URL you want to use
Step 2: Add to Configuration
Add this configuration to your MCP settings file. Replace the URL with your specific connector URL from the /mcp page:
"US Foreign Trade-MCP": {
"url": "https://patchops.ai/api/mcp/...",
"type": "http"
}Example Configuration
Here’s an example using PatchOps MCP:
"PatchOps-MCP": {
"url": "https://patchops.ai/api/mcp/...",
"type": "http"
}