---
name: crossborder-empire-os
description: 5-stage Cross-Border Commerce Operating System (Atom, Tax, Ship, Localize, Clock) compiling factory BOM JSON or CSV into exact 2026 Decimal US/DE/FR/JP landed costs (MFN, Section 301, MPF/HMF, IOSS EUR 150, JP 8%/10% JCT), 3D master-carton & FBA size-tier savings, cent-exact Commercial Invoices + Packing Lists, native compliance localization packs (en-US/de-DE/fr-FR/ja-JP), and holiday-aware CPM launch schedules via Streamable HTTP MCP or REST API. Strictly $0 billed on invalid/empty BOMs or refused illicit customs-evasion requests. Zero BOM / Trade-Secret Reselling Pledge.
---

# CrossBorder-Empire-OS — AI Agent Integration Skill (`crossborder.fastmesh.dev`)

- **Base URL**: `https://crossborder.fastmesh.dev` *(local upstream `http://127.0.0.1:9024` via `python3 -m src.server --host 127.0.0.1 --port 9024` or `python3 run_hand.py serve`)*
- **Remote Streamable MCP**: `https://crossborder.fastmesh.dev/mcp` (JSON-RPC 2.0)
- **OpenAPI 3.1 Spec**: `https://crossborder.fastmesh.dev/openapi.json`
- **Machine Discovery Index**: `https://crossborder.fastmesh.dev/llms.txt`
- **Treg Hub Tool ID**: `crossborder-empire-os` (`0%` seller commission, `$2.00` hard micro-spend cap, `$0` on empty/refused inputs)
- **Causal Bazaar Card / Hand ID**: `crossborder_empire_os_v1` (`is_public=1`, `$0.15` dossier / `$2.00` max cap)
- **Privacy Guarantee**: **Zero BOM / Trade-Secret Reselling Pledge** — customer factory BOMs, supplier FOB pricing, factory margins, packaging specs, and compiled dossiers are never resold, licensed to third parties, or used to train external models.
- **Compliance Scope Notice**: Objective engineering calculations and public 2026 regulatory indexing only — does not replace a licensed customs broker, customs legal counsel, or accredited testing laboratory.

---

## 1. Connect via Streamable HTTP MCP (`POST /mcp`)

### Step A: Initialize & List Tools

```bash
curl -fsSL -X POST "https://crossborder.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"sourcing-agent","version":"1.0"}}}'

curl -fsSL -X POST "https://crossborder.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}'
```

### Exposed MCP Tools

| Tool Name | List Price | Same-Tenant Repeat (`10%`) | Stage / Purpose |
| :--- | :---: | :---: | :--- |
| `analyze_bom_atom` | `$0.02` (`20,000` micros) | `$0.002` | **Stage 1 (Atom)** — Parse JSON/CSV BOM into materials, controlled-component flags, HS hints, and certification dependency tree |
| `calculate_landed_cost` | `$0.04` (`40,000` micros) | `$0.004` | **Stage 2 (Tax)** — Exact `Decimal` US/DE/FR/JP landed cost, Section 301/MPF/HMF/VAT/JCT, net margin, negative-margin alert, break-even price |
| `optimize_shipping_carton` | `$0.04` (`40,000` micros) | `$0.004` | **Stage 3 (Ship)** — 3D carton dimensional weight, 4-lane freight comparison, Amazon FBA 2026 cliff tweaks, cent-exact Commercial Invoice & Packing List |
| `compile_compliance_localization` | `$0.05` (`50,000` micros) | `$0.005` | **Stage 4 (Localize)** — Native `en-US`/`de-DE`/`fr-FR`/`ja-JP` listing templates, metric/imperial + FX conversion, mandatory marks/warnings, hype-claim scan |
| `plan_launch_clock` | `$0.03` (`30,000` micros) | `$0.003` | **Stage 5 (Clock)** — Forward/backward CPM schedule integrating 2026–2027 CN/US/DE/FR/JP holidays, lab lead times, and FBA Holiday Peak cutoffs |
| `compile_crossborder_dossier` | `$0.15` (`150,000` micros) | `$0.015` | **All 5 Stages** — End-to-end Atom -> Tax -> Ship -> Localize -> Clock export dossier with deterministic `receipt_sha256` |
| `tools_search` / `tools_inspect` / `tools_execute` | `$0.00` discovery | — | Flat discovery and dispatch helpers for autonomous agents |

### Step B: Invoke `compile_crossborder_dossier` Over MCP

```bash
curl -fsSL -X POST "https://crossborder.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 3,
    "method": "tools/call",
    "params": {
      "name": "compile_crossborder_dossier",
      "arguments": {
        "sku_id": "TWS-ANC-2026",
        "product_name": "ANC Wireless Bluetooth Earbuds with Charging Case",
        "category": "electronics_lithium",
        "hs_code": "8518.30.2000",
        "origin_country": "CN",
        "target_markets": ["US", "DE", "FR", "JP"],
        "quantity": 1000,
        "unit_fob_usd": 11.50,
        "retail_price_usd": 49.99,
        "unit_weight_kg": 0.18,
        "unit_dims_cm": {"length": 10.5, "width": 8.5, "height": 4.2},
        "shipping_mode": "matson_fast_ocean",
        "battery_spec": {"chemistry": "Li-ion", "watt_hours": 1.85, "cells": 3},
        "target_launch_date": "2026-11-15",
        "tenant_id": "sourcing_agent_01"
      }
    }
  }'
```

---

## 2. Canonical Input Schema (JSON & CSV BOM)

### Supported Categories, Markets & Shipping Modes
- **Categories (`category`)**: `electronics_lithium`, `food_supplements`, `apparel_textiles`, `cosmetics_skincare`, `toys_homeware`
- **Target Markets (`target_markets`)**: `US`, `DE`, `FR`, `JP` *(aliases `en-US`, `EU-DE`/`de-DE`, `EU-FR`/`fr-FR`, `ja-JP` auto-normalized)*
- **Origin Countries (`origin_country`)**: `CN` (default), `VN`, `MX`, `TW`, `JP`, `DE`
- **Shipping Modes (`shipping_mode`)**: `express_air`, `air_ddp`, `matson_fast_ocean`, `standard_ocean`

### Canonical Request Keys
- Core SKU fields: `sku_id`, `product_name`, `category`, `hs_code`, `origin_country`, `target_markets`, `quantity` (`int >= 1`), `unit_fob_usd`, `retail_price_usd`, `unit_weight_kg`, `unit_dims_cm` (`{"length","width","height"}` or `length_cm`/`width_cm`/`height_cm`), `shipping_mode`, `tenant_id`.
- Stage 1 BOM & compliance fields: `bom` (array of component dicts) OR `bom_csv` (CSV text), `materials`, `ingredients`, `allergens`, `battery_spec`, `claims`, `description`, `age_grade`, `is_food_contact`.
- Stage 5 CPM schedule fields: `start_date` (`YYYY-MM-DD`, forward schedule) OR `target_launch_date` (`YYYY-MM-DD`, backward schedule to compute `latest_factory_po_date`).

### Factory BOM CSV Schema (`bom_csv` field or `Content-Type: text/csv`)
When importing a factory spreadsheet directly, pass standard CSV columns:

```csv
part_id,component_name,material,qty_per_unit,unit_cost_usd,weight_g,controlled_hint
BATT-01,Lithium-Ion Polymer Cell 500mAh 3.7V,Li-ion,1,1.65,12,lithium_battery
RF-02,Bluetooth 5.3 SoC Module,PCB/Silicon,1,2.40,4,rf_transmitter
CASE-03,Charging Case Shell,ABS Plastic,1,1.10,42,enclosure
PACK-04,Retail Magnetic Gift Box,Paperboard,1,0.75,58,packaging
```

---

## 3. REST API Examples (`https://crossborder.fastmesh.dev`)

### A. Full 5-Stage Export Dossier — JSON (`POST /v1/crossborder/compile-dossier` — `$0.15`)

```bash
curl -fsSL -X POST "https://crossborder.fastmesh.dev/v1/crossborder/compile-dossier" \
  -H "Content-Type: application/json" \
  -d '{
    "sku_id": "GUMMY-PRO-60",
    "product_name": "Organic Berry Protein Gummies 60ct",
    "category": "food_supplements",
    "hs_code": "2106.90.9998",
    "origin_country": "CN",
    "target_markets": ["US", "DE", "FR", "JP"],
    "quantity": 1200,
    "unit_fob_usd": 4.20,
    "retail_price_usd": 24.99,
    "unit_weight_kg": 0.26,
    "unit_dims_cm": {"length": 11.5, "width": 6.8, "height": 6.8},
    "shipping_mode": "matson_fast_ocean",
    "ingredients": ["Pea Protein", "Organic Tapioca Syrup", "Cashew Butter", "Pectin"],
    "allergens": ["Tree Nuts", "Cashew"],
    "claims": ["Supports daily protein intake"],
    "target_launch_date": "2026-11-20",
    "tenant_id": "cpg_ops_bot"
  }'
```

### B. Full 5-Stage Dossier — Raw CSV BOM Upload (`Content-Type: text/csv` — `$0.15`)

```bash
curl -fsSL -X POST "https://crossborder.fastmesh.dev/v1/crossborder/compile-dossier?sku_id=TWS-CSV-01&category=electronics_lithium&origin_country=CN&quantity=500&retail_price_usd=49.99" \
  -H "Content-Type: text/csv" \
  --data-binary $'part_id,component_name,material,qty_per_unit,unit_cost_usd,weight_g,controlled_hint\nBATT-01,Li-ion Cell 3.7V 500mAh,Li-ion,1,1.80,12,lithium_battery\nRF-02,Bluetooth 5.3 IC,Silicon,1,2.60,4,rf_transmitter\nHSG-03,ABS Earbud Shell,ABS,2,1.20,35,enclosure'
```

### C. 2026 Landed Cost & Margin Matrix (`POST /v1/crossborder/landed-cost` — `$0.04`)

```bash
curl -fsSL -X POST "https://crossborder.fastmesh.dev/v1/crossborder/landed-cost" \
  -H "Content-Type: application/json" \
  -d '{
    "sku_id": "TUMB-SS-32",
    "product_name": "32oz Insulated Stainless Steel Tumbler",
    "category": "toys_homeware",
    "hs_code": "7323.93.0080",
    "origin_country": "CN",
    "target_markets": ["US", "DE", "FR", "JP"],
    "quantity": 1000,
    "unit_fob_usd": 5.80,
    "retail_price_usd": 29.99,
    "unit_weight_kg": 0.48,
    "unit_dims_cm": {"length": 25.0, "width": 10.0, "height": 10.0},
    "shipping_mode": "standard_ocean",
    "is_food_contact": true,
    "tenant_id": "margin_audit_bot"
  }'
```

### D. 3D Carton Optimizer & Commercial Invoice (`POST /v1/crossborder/optimize-ship` — `$0.04`)

```bash
curl -fsSL -X POST "https://crossborder.fastmesh.dev/v1/crossborder/optimize-ship" \
  -H "Content-Type: application/json" \
  -d '{
    "sku_id": "HOME-ORG-19",
    "product_name": "Foldable Storage Organizer Bin",
    "category": "toys_homeware",
    "hs_code": "3924.10.4000",
    "origin_country": "CN",
    "target_markets": ["US", "DE", "JP"],
    "quantity": 600,
    "unit_fob_usd": 6.50,
    "unit_weight_kg": 0.85,
    "unit_dims_cm": {"length": 47.0, "width": 36.0, "height": 21.0},
    "shipping_mode": "matson_fast_ocean",
    "tenant_id": "logistics_bot"
  }'
```
*Detects that `47.0 x 36.0 x 21.0 cm` (`18.50" x 14.17" x 8.27"`) breaks the US FBA Large Standard ceiling (`18" x 14" x 8"`) and calculates exact per-unit USD savings from trimming `<= 1.5 cm`.*

### E. Multi-Market Compliance & Listing Localization (`POST /v1/crossborder/compliance-localize` — `$0.05`)

```bash
curl -fsSL -X POST "https://crossborder.fastmesh.dev/v1/crossborder/compliance-localize" \
  -H "Content-Type: application/json" \
  -d '{
    "sku_id": "SERUM-VITC-30",
    "product_name": "Vitamin C Brightening Facial Serum 30ml",
    "category": "cosmetics_skincare",
    "hs_code": "3304.99.5000",
    "target_markets": ["US", "DE", "FR", "JP"],
    "ingredients": ["Aqua", "Ascorbic Acid", "Limonene", "Linalool"],
    "claims": ["Hydrates skin barrier", "Cures eczema permanently"],
    "unit_weight_kg": 0.11,
    "tenant_id": "compliance_qa_bot"
  }'
```
*Automatically flags `"Cures eczema permanently"` as a prohibited medical/drug claim across US FDA, EU 1223/2009, and Japan PMD Act (`薬機法`), plus EU `2023/1545` fragrance allergens (`Limonene`, `Linalool`).*

### F. Holiday-Aware Launch CPM Scheduler (`POST /v1/crossborder/launch-clock` — `$0.03`)

```bash
curl -fsSL -X POST "https://crossborder.fastmesh.dev/v1/crossborder/launch-clock" \
  -H "Content-Type: application/json" \
  -d '{
    "sku_id": "TOY-ABS-03",
    "product_name": "Magnetic ABS Building Blocks Set (Ages 3+)",
    "category": "toys_homeware",
    "origin_country": "CN",
    "target_markets": ["US", "DE", "JP"],
    "shipping_mode": "matson_fast_ocean",
    "age_grade": "3+",
    "target_launch_date": "2026-11-27",
    "tenant_id": "launch_planner_bot"
  }'
```

---

## 4. Error Handling (`HTTP 422` -> `$0`) & Illicit Compliance Refusal Policy

CrossBorder-Empire-OS enforces two non-negotiable zero-charge guardrails:

1. **Invalid / Empty / Malformed Input (`HTTP 422`, `$0` Billed)**:
   Empty payloads, missing required SKU/BOM values, malformed CSV/JSON, non-positive quantities/FOB/dimensions, or invalid ISO dates / dependency cycles return:
   ```json
   {
     "ok": false,
     "billable": false,
     "charge_micros": 0,
     "charged_micros": 0,
     "error_code": "invalid_input",
     "error": "Detailed validation message describing missing or malformed fields.",
     "receipt_sha256": "..."
   }
   ```

2. **Strict Compliance Refusal Policy (`HTTP 422`, `$0` Billed)**:
   CrossBorder-Empire-OS **refuses** any prompt, BOM note, or invoice instruction requesting:
   - Customs value under-declaration, double-invoicing, or false HS misclassification to evade duties/Section 301/VAT;
   - Forging Certificates of Origin (CO) or illegal transshipment origin-laundering;
   - Bypassing OFAC/EU/UN sanctions, export controls, or UFLPA/forced-labor import bans;
   - Fabricating FCC, CE, UL, PSE, FDA, CPC, or EN 71 laboratory test reports.

   Refused calls immediately return:
   ```json
   {
     "ok": false,
     "refused": true,
     "billable": false,
     "charge_micros": 0,
     "charged_micros": 0,
     "error_code": "compliance_refusal",
     "error": "Request refused: customs under-declaration, origin forgery, or sanctions evasion is prohibited.",
     "receipt_sha256": "..."
   }
   ```

---

## 5. Accounting, Caching, Prepaid Packs & Multi-Channel Access

- **Deterministic Fields**: Every valid HTTP `200` and MCP response includes `ok: true`, `billable: true`, `charge_micros`, `charged_micros`, `cache_status` (`miss`, `cross_tenant_hit`, `same_tenant_repeat`), `receipt_sha256`, `privacy_pledge`, and `disclaimer`.
- **Wallet Balance**: `GET https://crossborder.fastmesh.dev/v1/wallet/{tenant_id}`
- **Never-Expiring Creem Prepaid Packs** (`https://crossborder.fastmesh.dev/#pricing`, webhook `POST /webhooks/creem` with HMAC-SHA256 `creem-signature`):
  - **Launch SKU Pack (`crossborder_launch_99`)**: `$99` one-time -> `$99.00` credit (`99,000,000` micros · `660` full dossiers)
  - **Brand 15-SKU Pack (`crossborder_brand_299`, Popular)**: `$299` one-time -> `$360.00` credit (`360,000,000` micros, `+20.40%` bonus · `2,400` full dossiers)
  - **Exporter Studio (`crossborder_studio_899`)**: `$899` one-time -> `$1,250.00` credit (`1,250,000,000` micros, `+39.04%` max bonus · `8,333` full dossiers)
- **Treg Hub (`0%` Commission)**: `crossborder-empire-os` (`treg hub run ./treg_hub`, `$2.00` max cap)
- **Causal Bazaar Public Card**: `crossborder_empire_os_v1` (`is_public=1`, `$2.00` max cap)
- **Support**: `support@fastmesh.dev`
