Skip to main content
Glama
PaidMCP — UK & Global Compliance Engine

PaidMCP — UK & Global Compliance Engine

by HGN-ind
README.md
# TradeCheck MCP — Deterministic UK & Global Trade Compliance MCP Server

[![MCP Registry](https://img.shields.io/badge/MCP%20Registry-io.github.HGN--ind%2Ftradecheck--mcp-0f766e)](https://registry.modelcontextprotocol.io)
[![Glama MCP Server](https://glama.ai/mcp/servers/HGN-ind/tradecheck-mcp/badges/score.svg)](https://glama.ai/mcp/servers/HGN-ind/tradecheck-mcp)
[![Glama MCP Connector](https://glama.ai/mcp/connectors/io.github.HGN-ind/tradecheck-mcp/badges/score.svg)](https://glama.ai/mcp/connectors/io.github.HGN-ind/tradecheck-mcp)

**TradeCheck MCP** (by **HGN Industries Ltd**) is a **100% deterministic, zero-LLM** Model Context Protocol (MCP) server built for autonomous AI agents and compliance pipelines. Every tool runs deterministic statutory math, JSON Schema / FHIR validation, or indexed read-only SQLite lookups against SHA-256-verified regulatory snapshots — eliminating LLM hallucinations and per-request inference latency.

- **Live Endpoint:** `https://mcp.hgn.industries/mcp` (Streamable HTTP)
- **Service Overview:** `https://mcp.hgn.industries/`
- **Agent Discovery Manifest:** `https://mcp.hgn.industries/llms.txt`
- **Health & Snapshot Checksum:** `https://mcp.hgn.industries/health`
- **Official MCP Registry ID:** `io.github.HGN-ind/tradecheck-mcp`
- **Glama Directory & Inspector:** [Glama Server Listing](https://glama.ai/mcp/servers/HGN-ind/tradecheck-mcp) · [Glama Connector](https://glama.ai/mcp/connectors/io.github.HGN-ind/tradecheck-mcp) (browse all 20 tool schemas, inspect quality score, and test online with MCP Inspector)
- **Primary Region:** `europe-west2` (London)

---

## Tool Catalog (20 Deterministic Tools across 7 Packs)

Discovery methods (`initialize`, `ping`, `tools/list`) and pre-payment Zod input validation are **free**. Paid `tools/call` requests settle deterministically via HTTP 402 or Bearer API keys (`1` call credit per single tool, `10` call credits per bulk tool).

| Tool | Pack | x402 (Base USDC) | Stripe MPP (Card) | Purpose |
| :--- | :--- | :---: | :---: | :--- |
| `tariff_lookup` | `tariff` | $0.03 | $0.50* | UK Global Online Tariff (10-digit) & USITC HTS MFN duty, VAT, preferential rates & Section 301/232 remedies |
| `freight_landed_cost` | `tariff` | $0.07 | $0.50* | UK/US landed cost in integer minor units (CIF/FOB, £135 UK de minimis, VAT, Section 301/232, US MPF & HMF) |
| `tariff_lookup_batch` | `tariff` | $0.75 | $0.75 | Bulk UK/US tariff lookup for up to **25 codes** in one call ($0.03/code at max batch) |
| `freight_landed_cost_batch` | `tariff` | $1.00 | $1.00 | Bulk UK/US landed cost for up to **20 shipments** in one call ($0.05/shipment at max batch) |
| `cbam_scope_check` | `cbam` | $0.05 | $0.50* | UK CBAM 2027 (570 HMRC Force-of-Law CN codes) & EU Reg (EU) 2023/956 Annex I scope & default embedded emissions |
| `cbam_emissions_estimate` | `cbam` | $0.07 | $0.50* | Deterministic embedded tCO2e, gross carbon liability, origin carbon price relief & net CBAM liability estimator |
| `cbam_batch_check` | `cbam` | $0.75 | $0.75 | Bulk UK/EU CBAM scope & emissions check for up to **25 CN line items** in one call |
| `aml_country_risk` | `aml` | $0.04 | $0.50* | FATF Black/Grey Lists, UK MLR 2017 High-Risk Third Countries, EU Tax Annex I/II & UK/OFAC/EU embargo profiles |
| `aml_corridor_screen` | `aml` | $0.06 | $0.50* | Cross-border payment/trade corridor AML & embargo screening across origin, intermediaries & destination |
| `aml_country_risk_batch` | `aml` | $0.75 | $0.75 | Bulk country AML/tax/embargo screening for up to **25 ISO-2 jurisdictions** in one call |
| `export_control_lookup` | `export_control` | $0.05 | $0.50* | UK Consolidated Strategic Export Control List & EU Dual-Use Reg (EU) 2021/821 Annex I (Cat 0–9) + UK Military List |
| `export_control_screen` | `export_control` | $0.07 | $0.50* | Destination embargo screening & indicative CN-to-dual-use correlation triggers for export classification triage |
| `export_control_batch_screen` | `export_control` | $0.75 | $0.75 | Bulk dual-use & destination embargo screening for up to **25 export lines** in one call |
| `validate_openapi_31` | `validate` | $0.03 | $0.50* | OpenAPI 3.1.0 validator (JSON Schema Draft 2020-12, duplicate `operationId`, local `$ref`, 2xx & security checks) |
| `validate_fhir_ukcore` | `validate` | $0.06 | $0.50* | HL7 FHIR R4 & NHS England UK Core validator (Mod-11 NHS Numbers, ODS, SDS/GMC/NMC & SNOMED/dm+d codings) |
| `sanctions_screen_entity` | `sanctions` | $0.03 | $0.50* | UK FCDO & US OFAC SDN entity/vessel screening (NFKD folding, token sorting, Levenshtein & Jaro-Winkler) |
| `sanctions_screen_batch` | `sanctions` | $0.75 | $0.75 | Bulk UK FCDO & US OFAC SDN screening for up to **25 entities** in one call ($0.03/entity at max batch) |
| `uk_entity_compliance_check` | `sanctions` | $0.07 | $0.50* | UK Companies House entity & officer sanctions + insolvency cross-check (`PASS` / `REVIEW` / `BLOCK`) |
| `gpdo_class_a_rear_extension` | `planning` | $0.03 | $0.50* | England GPDO 2015 (SI 2015/596 Sch. 2, Pt. 1, Class A) rear/side extension & Prior Approval calculator |
| `gpdo_outbuilding_and_loft_check` | `planning` | $0.06 | $0.50* | England GPDO 2015 Class E outbuildings & Class B loft additions statutory compliance engine |

*\*Stripe PaymentIntents enforce a $0.50 USD card minimum. For single calls ($0.03–$0.07), pay via **x402 Base USDC** or **Bearer API Keys** ([$10 Credit Pack — 250 calls](https://buy.stripe.com/4gMdR2eWtcjr9mc3crcs801) or [$29/mo Pro — 1,500 calls/mo](https://buy.stripe.com/3cI5kwg0xfvD8i89APcs800)); for card MPP agents, use the **$0.75–$1.00 bulk tools**.*

---

## Quickstart

### Try Live in 10 Seconds (5 Free Calls/Day, No Card Required)

Use `Authorization: Bearer tradecheck_trial` on any single-item tool (up to 5 calls/day per IP). Swap `tradecheck_trial` for a `pmcp_live_...` key from a [$10 Credit Pack (250 calls)](https://buy.stripe.com/4gMdR2eWtcjr9mc3crcs801) or [$29/mo Pro Subscription (1,500 calls/mo)](https://buy.stripe.com/3cI5kwg0xfvD8i89APcs800) when ready for production volume or bulk tools:

```json
{
  "mcpServers": {
    "tradecheck": {
      "url": "https://mcp.hgn.industries/mcp",
      "headers": {
        "Authorization": "Bearer tradecheck_trial"
      }
    }
  }
}
```

See [examples/](examples/) for copy-paste **Claude Desktop / Cursor**, **`curl`**, **OpenAI Agents SDK**, and **`@x402/fetch`** agent templates.

### Inspect Schemas Without Authentication

```bash
curl -sS -X POST "https://mcp.hgn.industries/mcp" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
```

### Payment Rails

1. **x402 (Live — Base Mainnet USDC):** Native HTTP 402 micropayments (`PAYMENT-REQUIRED` → `PAYMENT-SIGNATURE` → `PAYMENT-RESPONSE`) settled on Base (`eip155:8453`) with exact $0.03–$1.00 pricing and local replay deduplication.
2. **Stripe Machine Payments Protocol (MPP):** HTTP 402 Shared Payment Tokens (`WWW-Authenticate` → `Authorization: Payment ...` → `Payment-Receipt`) with `Accept: text/html` browser redirect to Stripe Checkout and built-in Tempo `$0.01+` stablecoin composition support.
3. **Auto-Provisioned Bearer API Keys (`Authorization: Bearer pmcp_live_...`):** Firestore-backed atomic quota enforcement provisioned instantly via HMAC-verified Stripe webhooks, one-time strict-CSP checkout reveal (`/checkout/success`), and welcome emails.
4. **MCP Marketplace (`x-mcp-license-key`):** Subscription license verification with singleflight coalescing and bounded cache.

---

## Architecture & Security

TradeCheck MCP splits execution into two isolated planes:

- **Plane 1 (`src/` — TypeScript / Node 22 on Cloud Run behind Cloudflare Edge `mcp.hgn.industries`):**
  - Zero LLM tokens per request, strict fail-fast Zod config & input validation before payment gating.
  - Non-root container, zero implicit outbound HTTP retries (`HTTP_MAX_RETRIES=0`), 256 KiB request body cap, 64 KiB upstream response cap, JSON-RPC array batch rejection (`400 -32600`), and hash-pinned strict CSP/security headers.
  - Read-only SQLite snapshot store verified via SHA-256 checksum, `PRAGMA quick_check(1)`, core table row-count checks, and monotonic `builtAtUtc` anti-rollback on GCS sync.
- **Plane 2 (`supervisor/` — Python 3.12 Cloud Run Job):**
  - Daily autonomous regulatory drift monitor for UK Trade Tariff, USITC HTS, UK FCDO Sanctions, US OFAC SDN, and live GOV.UK HMRC 2027 CBAM default values.
  - Four hard IAL circuit breakers (budget ceiling, normalized doom-loop breaker, `max_retries=0`, external gateway cap), strict test-immutability verification gate, secret-scrubbed dead-letter alerts, and atomic GCS snapshot publication.

See [SECURITY.md](SECURITY.md) for vulnerability disclosure and hardening controls, and [docs/LAUNCH_RUNBOOK.md](docs/LAUNCH_RUNBOOK.md) for full GCP least-privilege deployment steps.

---

## Local Development & Verification

```powershell
npm install
npm run typecheck
npm test
pytest supervisor/tests
```

---

## License

Licensed under the **GNU Affero General Public License v3.0** (`AGPL-3.0-only`). See [LICENSE](LICENSE) for full terms.

- Calling the hosted TradeCheck MCP HTTP `/mcp` API incurs **no** copyleft obligations on client agents or applications.
- Self-hosting or distributing modified copies of the server source requires making source modifications available under AGPL-3.0.