# Automate HS Code Classification and Duty Checks (CLI + MCP)

*Source: https://eximagent.ai/blog/automate-hs-code-classification-duty-cli-mcp · Published: October 27, 2026 · Category: Artificial Intelligence*

> Looking up one HS code in a web tool is fine. Checking forty SKUs before a quote, or doing it again every time a tariff changes, is not. This tutorial shows how to classify a product and read its duty from a script or from your AI…

Looking up one HS code in a web tool is fine. Checking forty SKUs before a quote, or doing it again every time a tariff changes, is not. This tutorial shows how to classify a product and read its duty from a script or from your AI agent, using the EximAgent CLI or MCP server. It also covers how to check the answer before you trust it.

Use the results as research. Tariff and classification results are not a customs ruling, so confirm anything high-stakes with a licensed broker or a binding ruling.

## What you'll set up

- The **CLI** for scripts and terminals, or
- The **MCP server** for Claude Code, Codex, Cursor or another MCP client. The same endpoint powers the hosted connector in chat apps.

Both are free to start. You sign in with Google, so there's no API key to paste.

## Option A: the CLI

Install it:

```bash
curl -fsSL https://cli.eximagent.ai/install | sh

irm https://cli.eximagent.ai/install.ps1 | iex
```

Sign in and check your session:

```bash
eximagent login
eximagent whoami
```

The full list of commands is on the [commands reference](https://eximagent.ai/docs/reference/commands).

## Option B: the MCP server in your agent

The MCP server runs at `https://mcp.eximagent.ai/mcp` (Streamable HTTP, OAuth sign-in).

```bash
claude mcp add --transport http eximagent https://mcp.eximagent.ai/mcp --scope user

codex mcp add eximagent --url https://mcp.eximagent.ai/mcp

eximagent connect all
```

Setup for each client is covered in the [MCP integration docs](https://eximagent.ai/docs/integrations/mcp). If you use a chat app rather than a coding tool, add the [connector](https://eximagent.ai/connectors) instead.

## Step 1: describe the product in plain words

From product to duty in 4 steps: describe, check official text, read the national line, check preferences.

Write the product the way a buyer would describe it, including what it's made of and what it's for. Then search:

```bash
eximagent hscode search --query "LED ceiling light fitting"
```

When we ran this on 27 Oct 2026, the top candidates were (exact labels from the response):

| HS code | Label (from `full_path`) |
| --- | --- |
| 940519 | Chandeliers and other electric ceiling or wall lighting fittings, excluding those of a kind used for lighting public open spaces or thoroughfares : Other |
| 940511 | Designed for use solely with light-emitting diode (LED) light sources |
| 940521 | Electric table, desk, bedside or floor-standing luminaires : Designed for use solely with light-emitting diode (LED) light sources |
| 940542 | Other electric luminaires and lighting fittings : Other, designed for use solely with light-emitting diode (LED) light sources |
| 940541 | Other electric luminaires and lighting fittings : Photovoltaic, designed for use solely with light-emitting diode (LED) light sources |

In your agent, just ask: *"What's the HS code for an LED ceiling light fitting?"* The agent calls the same search.

## Step 2: check the candidate against the official text

A search ranks candidates. It doesn't choose for you. Open each likely code and read the official description:

- 940511 is limited to luminaires **designed for use solely with LED light sources**. A fitting that takes an ordinary bulb doesn't belong there.
- "Other" codes such as 940519 are residual: they cover what the named siblings don't.

You can read the code pages on the [HS code lookup](https://eximagent.ai/hscode) (for example [9405](https://eximagent.ai/hscode/94/9405)). Each page shows what the code covers, what it doesn't, and the official text.

Every answer carries a confidence label: `verified`, `extracted`, `heuristic` or `inferred`. Treat anything below `verified` as a lead to confirm, not a fact. See [confidence](https://eximagent.ai/docs/concepts/confidence).

## Step 3: read the duty for your lane

MacMap, 2025 MFN applied, MX→US, retrieved 27 Oct 2026.

Once you have the code, ask for the tariff between the exporting and importing country:

```bash
eximagent tariff --exporter MX --importer US --product 940511
```

On 27 Oct 2026 this returned national tariff lines under 940511 from the MacMap source (2025 MFN applied rates):

| US tariff line | MFN applied rate |
| --- | --- |
| 94051140 | 3.90% |
| 94051160 | 7.60% |
| 94051180 | 3.90% |

These are MFN applied rates only. Other duties can still apply on top — for example HTS Chapter 99 provisions and similar extra duties. Confirm the full liability on the official schedule or with a licensed broker before you quote.

The output also listed non-tariff measures (16 for this lane) and flagged trade remedies.

Two things to notice:

1. **The six-digit code doesn't fix the rate.** The importing country splits it into national lines with different rates. Pick the line that matches your product.
2. **MFN isn't always what you pay.** A trade agreement can lower the rate if the goods qualify. For this lane the output showed only MFN applied rows — no preferential rate row. Check preference use separately:

```bash
eximagent duty fta --exporter MX --importer US --product 940511
```

For the wider picture, `eximagent trade lookup --type all` returns duties, taxes, remedies and non-tariff measures together, and `eximagent landed cost` estimates the cost on arrival. How the duty math works is explained in [how to calculate import duty](https://eximagent.ai/blog/how-to-calculate-import-duty).

## Step 4: run it for a list

Because it's a CLI, a product list is just a loop:

```bash
while IFS= read -r product; do
  echo "== $product"
  eximagent hscode search --query "$product"
done < products.txt
```

Then review the candidates and run `tariff` only for the codes you've confirmed. Don't pipe the top search result straight into a quote. Step 2 is where mistakes get caught.

## Mistakes to avoid

- **Describing the product by brand or SKU.** Classification depends on material, function and form, so describe those.
- **Stopping at six digits.** Duty is set at the national line.
- **Reading MFN as the final rate.** Check preferences, remedies and taxes.
- **Treating a candidate as a ruling.** Keep the confidence label and source with every result you pass to a customer. The cost of a wrong code is covered in [what happens if you use the wrong HS code](https://eximagent.ai/blog/what-happens-if-you-use-the-wrong-hs-code).

## FAQ

**Can AI classify HS codes accurately?**
It can rank strong candidates quickly, especially from a clear product description. Accuracy depends on the description and on someone checking the official text. That's why every result shows its source and a confidence label. Use it to narrow the choice, then confirm.

**Is there an API for HS codes and tariffs?**
There is no public REST API for HS codes and tariffs. The CLI and the MCP server are the programmatic routes: the CLI for scripts, and the MCP server for AI agents.

**Do I need an API key?**
No. You sign in with Google through OAuth.

**What does it cost?**
It's free to start. See [pricing](https://eximagent.ai/pricing).
