---
name: migrate-anything
description: Polymorphic lossless SaaS escape migration compiler, strong-type schema inferrer, dry-run coercion auditor, runnable Python script generator, and row-level SHA-256 Merkle checksum verifier at https://migrate.fastmesh.dev. Zero data retention; HTTP 422 returns billed_micros=0 ($0 charged).
---

# Migrate-Anything (`https://migrate.fastmesh.dev`)

Migrate-Anything converts messy high-lock-in SaaS exports (Airtable, Notion, HubSpot, Salesforce, Shopify, Zapier, Make, Legacy Billing CSV, SQL dumps, and dirty CSV/JSON) into strongly typed target schemas (`sqlite`, `postgres_ddl`, `json`, `ndjson`, `csv`, `python_dispatch`, `creem_ledger`, `woocommerce_json`, `medusa_json`) with standalone runnable Python 3 stdlib escape + rollback scripts and cryptographic row-level SHA-256 Merkle verification.

## Strict Guarantees
- **Zero Customer Data Retention**: Payloads execute strictly in memory; raw customer rows are never stored, resold, or used for training.
- **Unbilled `422` Guardrail**: Empty payloads, whitespace-only strings, binary junk, malformed JSON/CSV, or invalid tool parameters return `HTTP 422` with `"billed_micros": 0` (`$0.00`).
- **Strong Type Precedence**: `bool` is strictly separated from `int` (`isinstance(val, bool)` before `int`), currency fields use fixed-precision `Decimal` (zero float drift), timestamps normalize to ISO-8601 UTC `Z`, and omitted JSON fields are materialized deterministically before hashing.
- **Secret Redaction**: Credentials and tokens in Zapier/Make exports are redacted to `{{ENV:<CONNECTION_ALIAS>_<KEY>}}` placeholders.

---

## 1. REST API Quickstart (`https://migrate.fastmesh.dev`)

### Endpoints
- `GET /health` — Service health, supported source/target formats, zero-retention attestation
- `GET /openapi.json` — OpenAPI 3.1.0 machine specification
- `POST /v1/infer-schema` — Strong-type column schema + foreign key graph + dirty-null boundary report
- `POST /v1/dry-run` — Deterministic field mapping plan + coercion warnings + Merkle diff preview
- `POST /v1/migrate` — Target data + Python 3 stdlib migration script + rollback verifier + Merkle receipt
- `POST /v1/verify-checksum` — Compare source vs target rows and pinpoint any mutated or missing row indices

### Example: Infer Schema & Dry-Run Diff (`curl`)
```bash
curl -sS -X POST https://migrate.fastmesh.dev/v1/dry-run \
  -H "Content-Type: application/json" \
  -d '{
    "source_format": "csv",
    "target_format": "postgres_ddl",
    "table_name": "crm_deals",
    "redact": true,
    "source_data": "\ufeffid,email,is_won,retry_count,amount,closed_at\n1,ops@acme.dev,true,1,\"$1,250.50\",2026-12-01T10:00:00Z\n2,dev@acme.dev,false,0,\"($49.00)\",11/30/2026 09:15 AM"
  }'
```

### Example: Compile Lossless Migration + Python Escape Script
```bash
curl -sS -X POST https://migrate.fastmesh.dev/v1/migrate \
  -H "Content-Type: application/json" \
  -d '{
    "source_format": "airtable",
    "target_format": "postgres_ddl",
    "table_name": "airtable_projects",
    "source_data": {
      "records": [
        {"id": "recAlpha01", "createdTime": "2026-12-01T10:00:00Z", "fields": {"Name": "Escape", "Approved": true, "Budget": 4950.25}},
        {"id": "recBeta02", "createdTime": "2026-12-01T11:00:00Z", "fields": {"Name": "Cleanup", "Budget": 1200.00}}
      ]
    }
  }'
```

### Example: Verify Row-Level SHA-256 Merkle Parity
```bash
curl -sS -X POST https://migrate.fastmesh.dev/v1/verify-checksum \
  -H "Content-Type: application/json" \
  -d '{
    "source_rows": [{"id": 1, "active": true, "amount": "19.00"}],
    "target_rows": [{"id": 1, "active": true, "amount": "19.00"}]
  }'
```

---

## 2. Native MCP JSON-RPC 2.0 (`POST https://migrate.fastmesh.dev/mcp`)

Protocol version: `2024-11-05`. Supported methods: `initialize`, `notifications/initialized`, `ping`, `tools/list`, `tools/call`.

### Available MCP Tools
1. `migrate_infer_schema`
2. `migrate_dry_run`
3. `migrate_execute`
4. `migrate_verify_checksum`

### MCP `initialize`
```bash
curl -sS -X POST https://migrate.fastmesh.dev/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05"}}'
```

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

### MCP `tools/call` (`migrate_execute`)
```bash
curl -sS -X POST https://migrate.fastmesh.dev/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 3,
    "method": "tools/call",
    "params": {
      "name": "migrate_execute",
      "arguments": {
        "source_format": "shopify",
        "target_format": "medusa_json",
        "table_name": "shopify_catalog",
        "source_data": "Handle,Title,Option1 Name,Option1 Value,Variant SKU,Variant Price\npro-tee,Pro Tee,Size,M,PT-M,29.95\npro-tee,,,L,PT-L,29.95",
        "redact": true
      }
    }
  }'
```

---

## 3. Treg Hub CLI (0% Seller Commission)
```bash
treg call migrate-anything --data '{
  "source_format": "auto",
  "target_format": "postgres_ddl",
  "table_name": "customers",
  "source_data": "id,email,active,amount\n1,ops@acme.dev,true,$19.00",
  "mode": "migrate",
  "redact": true
}'
```

## 4. Prepaid Flat-Fee Packs (Creem)
- **Starter Pack (`sku_b05_starter_19`)**: `$19` one-time (`250` non-expiring runs)
- **Growth Pack (`sku_b05_growth_79`)**: `$79` one-time (`1,500` non-expiring runs)
- **Scale Pack (`sku_b05_scale_249`)**: `$249` one-time (`6,500` non-expiring runs)
- **Pay-per-run Agent Toll**: `$0.15/run` (`150,000` micros; `15,000` micros on repeat structural cache hit; `0` micros on `422` errors; max spend cap `$2.00`).
