TaricHive
Multi-country customs tariff database — imports tariff data from taric-opendata into SQL Server and exposes it via a Blazor web front-end, a REST API, and an MCP server.
Solution structure
| Project | Purpose |
|---|---|
TaricHive.Core |
EF Core 10 models, DbContext, services (search, measure lookup, duty calculation, exchange rates) |
TaricHive.Importer |
CLI tool that downloads and bulk-inserts tariff data per country, with a post-import verification suite |
TaricHive.Api |
ASP.NET Core REST API over TaricHive.Core services |
TaricHive.Web |
Blazor Server front-end: search, browse, tariff detail, legislation, admin sync |
TaricHive.Mcp |
MCP server (mcp.opentaric.eu) — OAuth 2.1 resource server exposing 9 tariff tools |
TaricHive.Tests |
xunit tests (duty engine, calculator measure selection) |
Supported sources
| Code | Jurisdiction | Importer | Notes |
|---|---|---|---|
eu |
European Union | EuImporter |
TARIC official data from DG TAXUD CIRCABC (XLSX) |
be |
Belgium | BeImporter |
TARIC Plus / eurodyn XML (same format as CustomsHive TarbelSyncService) |
nl |
Netherlands | NlImporter |
Arctic Group Tariff XML (attribute-based, DTV export) |
gb |
United Kingdom | GbImporter |
UK Global Tariff CSVs from data.api.trade.gov.uk, incl. quotas + condition components |
se |
Sweden | SeImporter |
Tulltaxan XML from Tullverket |
no |
Norway | NoImporter |
Tolletaten XML/JSON, incl. quotas/VAT/excise/restrictions |
ch |
Switzerland | ChImporter |
BAZG XML, incl. permits, statistical keys, per-head units |
fr |
France | FrImporter |
RITA XML (Douane FR) |
us |
United States | UsHtsImporter |
USITC Harmonized Tariff Schedule JSON |
pl |
Poland | PlImporter |
ISZTAR4 ZIP |
tr |
Türkiye | TrImporter |
TGTC nomenclature + base duty + Import Regime applied duties (tr-measures.csv) |
ebti |
EU (rulings) | EbtiImporter |
Binding Tariff Information rulings (DDS2 EBTI, ~122k rows) |
atar |
UK (rulings) | AtarImporter |
Advance Tariff Rulings (GOV.UK scrape) |
eurlex |
EU (legislation) | EurLexImporter |
CELEX manifest (sector 3), CN legal Section/Chapter notes, CNEN |
GoodsNomenclatures for EU members (BE, NL) are skipped — the EU import is authoritative. A canonical adapter layer (Importers/Canonical) normalizes per-source conventions.
Prerequisites
- .NET 10 SDK
- SQL Server (local or remote) — connection string via User Secrets
- taric-opendata downloads (or manually placed source files)
Setup
1. Database
Apply EF Core migrations:
2. Connection string
Store the connection string in User Secrets (never commit it):
cd src/TaricHive.Importer
dotnet user-secrets set "ConnectionStrings:TaricHive" "Server=...;Database=taric;..."
The UserSecretsId is tarichive-importer.
3. Download source data
# From the taric-opendata repo
pwsh scripts/sync-eu.ps1
pwsh scripts/sync-be.ps1
pwsh scripts/sync-nl.ps1
# etc.
Or use the GitHub releases directly:
Running the importer
dotnet run --project src/TaricHive.Importer <source> [--dir <path-to-downloads>]
# Examples
dotnet run --project src/TaricHive.Importer eu
dotnet run --project src/TaricHive.Importer all
dotnet run --project src/TaricHive.Importer us --dir D:\data\taric-opendata\downloads
# Supported sources: us gb be nl eu se no ch pl fr tr ebti eurlex atar all
The importer defaults to looking for downloads in ../../taric-opendata/downloads relative to the project root (side-by-side repo layout).
Each run clears the existing data for that source and re-imports from scratch, then runs the post-import verification suite (ImportVerifier). Imports can also be triggered from the Web admin sync page (/admin/sync), which runs the same importer in-process with live progress.
Web front-end
TaricHive.Web is a Blazor Server app: full-text/code search, chapter browse, tariff detail at /tariff/{Source}/{Code}/{Movement} (measures, duty calculation, BTI/ATaR rulings, legal notes, legislation links), point-in-time date selection, favorites, dark mode.
Authentication is OIDC with a provider switch via Auth:Provider:
- Entra ID (default) — config under Auth:EntraId
- Authentik — generic OIDC (Auth:Provider=Authentik)
API
GET /api/goods/{code} Search by CN/HS code (exact or prefix)
GET /api/goods/search?text=&source= Full-text search
GET /api/goods/{code}/hierarchy Parent chain up to chapter level
GET /api/goods/{code}/measures?origin= All applicable measures (duty, prohibitions, etc.)
POST /api/goods/{code}/validate Validate a declaration input
POST /api/goods/{code}/calculate Calculate import duty
GET /api/goods/hts/{code} US HTS lookup by code
GET /api/goods/hts/search?text= US HTS full-text search
Query parameters:
- source — filter by jurisdiction code (EU, BE, NL, GB, SE, NO, CH, FR, US, PL, TR)
- onDate — validity date (ISO 8601, defaults to today)
- origin — country of origin for measure filtering (ISO alpha-2)
MCP server
TaricHive.Mcp exposes the same data over the Model Context Protocol at mcp.opentaric.eu, as an OAuth 2.1 resource server against Authentik (interactive and client_credentials M2M tokens). Tools: search_goods, get_goods_hierarchy, get_measures, compare_sources, get_quota, get_rulings, get_notes, calculate_duty, validate_declaration. Setup and go-live checklist: docs/mcp-setup.md.
Architecture notes
- SqlBulkCopy is used throughout for bulk inserts (10 k-row batches). EF Core is only used for queries and for the clear-before-reimport delete cascade.
- TaricSid is preserved as a nullable int on each row, used to resolve parent–child FK relationships during the import (e.g. measure → conditions/footnotes). Negative SIDs appear in NL national measures.
- Source column on every table allows all jurisdictions to coexist in one database without schema separation.
- Importer data flow: clear source → insert reference tables → insert Measures (phase 1) → resolve TaricSid→Id map → insert MeasureComponents/Conditions/Footnotes (phase 2).
Docs
| docs/mcp-setup.md | MCP server + Authentik OAuth setup, go-live checklist |
| docs/multi-country-tariff-gap-analysis.md | GB/NO/CH specific-duty gap analysis vs. commercial tools |
| docs/product-review-2026-07-15.md | product/UX review and resulting overhaul |
| docs/taricsupport-ux-analysis.md | Taric Support UX reverse-engineering notes |