Skip to main content
Glama
Japan Tariff

Japan Tariff

by pipeworx-io
README.md
# @pipeworx/japan-tariff

Japan's applied customs tariff schedule (実行関税率表) by HS code: the general, temporary, WTO, GSP and LDC duty rates, the rate under each economic partnership agreement, and the quantity units, with the schedule edition date on every response.

Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 1879+ live data sources. This is an independent, unofficial integration — not affiliated with, endorsed by, or published by the upstream provider.

## Tools

- `jp_tariff_lookup(hs_code, partner?, limit?)` — rates for a 2-digit chapter (heading list), 4-digit heading, 6-digit subheading or 9-digit statistical code. "What duty does Japan charge on HS 0713?" Optional `partner` (e.g. `cptpp`, `eu`, `uk`, `india`, `rcep`, `viet_nam`) keeps only that agreement's column. An unknown code returns `found:false` with a reason and a hint.
- `jp_tariff_search(keyword, chapter?, limit?)` — keyword search over line descriptions, returning matching HS lines with their headline rates. "Which HS code and duty does Japan apply to green tea?" If no line names every word, lines naming some of the words are returned and flagged `match_mode: partial_words`.

## Auth

Keyless.

## Data sources

- Japan Customs, Ministry of Finance of Japan, "Japan's Tariff Schedule" (English edition). The newest edition on the publisher's list is used; its date is returned as `data_as_of`.

Licence: the publisher's notice applies the Public Data License 1.0 (compatible with CC BY 4.0), so reuse with attribution is permitted; every response carries the attribution.

Notes for the next person:

- Rates are returned exactly as published ("Free", "10%", "417 yen/kg"); parentheses around a WTO rate mark a bound rate that is not currently applied. A blank column means nothing is published in it for that line. Lines under a quota or seasonal rate repeat the code once per rate band.
- Rates are read live, one chapter per lookup. The keyword search uses a description-only index (no rates) built by `scripts/bake-index.mjs` and delivered through the gateway's KV; rerun the script to refresh it. A stale index still finds the right lines, since chapters are stable across amendments, and the response says when the index edition differs from the rate edition.
- The chapter pages are declared ISO-8859-1 but a few cells carry Shift_JIS full-width parentheses; `src/parse.ts` repairs them.
- English descriptions only. The tariff names goods by class, so a botanical or brand name (e.g. sword bean) usually matches nothing; search the class word ("beans").

## Quick Start

Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):

```json
{
  "mcpServers": {
    "japan-tariff": {
      "url": "https://gateway.pipeworx.io/japan-tariff/mcp"
    }
  }
}
```

### What this endpoint actually serves

`tools/list` at `https://gateway.pipeworx.io/japan-tariff/mcp` returns the tools in the table
above **plus the shared Pipeworx meta-tools** — `ask_pipeworx`,
`discover_tools`, `search_within`, `remember`/`recall` and the rest of the
gateway-wide set. So the tool count you see is larger than this table: a
single-pack endpoint currently lists roughly 30 shared tools alongside the
pack's own. The connection's `initialize` response states its exact scope, and
is the authoritative answer for a given day.

This is deliberate, not multiplexing by accident. The meta-tools are what let a
scoped connection answer a question this pack does not cover — via
`ask_pipeworx`, which routes across the whole catalog — without you adding a
second MCP server. There is currently no way to mount a pack endpoint without
them; if the extra schemas cost you more context than the routing is worth,
connect to the full gateway once rather than to several pack endpoints.

Or connect to the full Pipeworx gateway to get every pack's tools listed
directly, instead of just this one's:

```json
{
  "mcpServers": {
    "pipeworx": {
      "url": "https://gateway.pipeworx.io/mcp"
    }
  }
}
```

Both URLs reach the same gateway and the same 1879+ data sources. The
only difference is which pack's tools are listed **directly**; `ask_pipeworx`
reaches all of them from either one.

## No MCP client? Call it over HTTP

```bash
curl -X POST https://gateway.pipeworx.io/v1/tools/jp_tariff_lookup \
  -H 'Content-Type: application/json' \
  -d '{"hs_code":"0713"}'
```

No account needed for the first calls. Inspect any tool: `GET https://gateway.pipeworx.io/v1/tools/jp_tariff_lookup`. Find one: `POST https://gateway.pipeworx.io/v1/tools/search_packs` with `{"query":"..."}`.

## Run it from npm

`@pipeworx/mcp-japan-tariff` is a local stdio bridge to the Pipeworx gateway: your MCP client
starts it with `npx`, and it forwards every call to the same
`https://gateway.pipeworx.io/japan-tariff/mcp` endpoint shown above. It needs network access;
there is no offline mode.

```json
{
  "mcpServers": {
    "japan-tariff": {
      "command": "npx",
      "args": ["-y", "@pipeworx/mcp-japan-tariff"]
    }
  }
}
```

Without a key it calls anonymously, capped at 50 calls a day. A free account
raises that to 200 a day: get a key at https://pipeworx.io/signup and add
`"env": { "PIPEWORX_API_KEY": "<your key>" }` to the server entry.
The key is sent as a Bearer token, the same way a hosted connection sends it,
so calls are metered and billed exactly as they are there.

It lists **only** this pack's tools by default. Set `PIPEWORX_META_TOOLS=1` to
also list `ask_pipeworx` and the other gateway-wide tools.

Behind an HTTPS proxy: Node's built-in `fetch` does not read `HTTPS_PROXY` by
default. Newer Node releases honour it when `NODE_USE_ENV_PROXY=1` is set; check
your Node version's documentation.

## Using with ask_pipeworx

Instead of calling tools directly, you can ask questions in plain English —
this works on the pack endpoint above as well as on the full gateway:

```
ask_pipeworx({ question: "your question about Japan Tariff data" })
```

The gateway picks the right tool and fills the arguments automatically.

## More

- [Docs and guides](https://pipeworx.io/docs)
- [pipeworx.io](https://pipeworx.io)

## License

MIT