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

PaidMCP — UK & Global Compliance Engine

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

[![MCP Registry](https://img.shields.io/badge/MCP%20Registry-io.github.HGN--ind%2Fpaid--mcp-0f766e)](https://registry.modelcontextprotocol.io)

PaidMCP 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://paidmcp-api-j7cpz2cyjq-nw.a.run.app/mcp` (Streamable HTTP)
- **Service Overview:** `https://paidmcp-api-j7cpz2cyjq-nw.a.run.app/`
- **Agent Discovery Manifest:** `https://paidmcp-api-j7cpz2cyjq-nw.a.run.app/llms.txt`
- **Health & Snapshot Checksum:** `https://paidmcp-api-j7cpz2cyjq-nw.a.run.app/health`
- **Official MCP Registry ID:** `io.github.HGN-ind/paid-mcp`
- **Primary Region:** `europe-west2` (London)

---

## Tool Catalog (11 Deterministic Tools across 4 Packs)

Discovery methods (`initialize`, `ping`, `tools/list`) and pre-payment Zod input validation are **free**. Paid `tools/call` requests settle deterministically via HTTP 402.

| 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) |
| `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**; for card agents, use the **$0.75–$1.00 bulk tools** or the **$29/mo subscription tier** (1,500 calls/mo).*

---

## Quickstart

### Connect via MCP Client (Streamable HTTP)

Add PaidMCP to Claude Desktop, Cursor, Windsurf, or any Streamable HTTP MCP client:

```json
{
  "mcpServers": {
    "paidmcp": {
      "url": "https://paidmcp-api-j7cpz2cyjq-nw.a.run.app/mcp"
    }
  }
}
```

### Inspect Schemas Without Authentication

```bash
curl -sS -X POST "https://paidmcp-api-j7cpz2cyjq-nw.a.run.app/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-Receipt`) with `Accept: text/html` browser redirect to Stripe Checkout.
3. **MCP Marketplace (`x-mcp-license-key`):** Subscription license verification with singleflight coalescing and bounded cache.

---

## Architecture & Security

PaidMCP splits execution into two isolated planes:

- **Plane 1 (`src/` — TypeScript / Node 22 on Cloud Run):**
  - 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 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, and US OFAC SDN.
  - 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 PaidMCP 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.