# THORChain Swap API Quickstart

Fetch a live THORChain quote for a THORChain Swap (https://swap.thorchain.org) integration in one request — no account, no API key, no registration.

## 1. Call the MCP server

The canonical THORChain MCP server at https://mcp.thorchain.org/mcp speaks JSON-RPC 2.0 over HTTP POST. It requires the dual Accept header shown below and returns SSE events. No credential is required.

```bash
curl -N -sS https://mcp.thorchain.org/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -H 'MCP-Protocol-Version: 2025-06-18' \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "quote_swap",
      "arguments": {
        "from_asset": "BTC.BTC",
        "to_asset": "ETH.ETH",
        "amount": 100000000
      }
    }
  }'
```

## 2. Read the quote

Parse the JSON-RPC object in each SSE `data:` event. Read the quote at `result.structuredContent.data`; `result.structuredContent._metadata` records its source and freshness. The text content contains the same data as JSON. For example (illustrative values):

```text
event: message
data: {"jsonrpc":"2.0","id":1,"result":{"structuredContent":{"data":{"expected_amount_out":"123456"},"_metadata":{"source_used":"thornode","canonical":true}},"content":[{"type":"text","text":"{\"data\":{\"expected_amount_out\":\"123456\"},\"_metadata\":{\"source_used\":\"thornode\",\"canonical\":true}}"}]}}

```

- `expected_amount_out` — estimated output after fees, in 1e8 base units.
- `fees` — the returned protocol fees, including outbound, liquidity, and affiliate amounts. Source-chain gas is paid separately by the user's wallet.
- `fees.slippage_bps` — price impact in basis points.
- `recommended_min_amount_in` — below this, fees dominate the swap.
- `inbound_address` and any `memo` — time-sensitive transaction details, valid only until `expiry`. Use `prepare_swap` with a confirmed destination for executable deposit instructions; the user signs and sends funds.

## 3. Hand the user a prefilled swap link

```
https://swap.thorchain.org/sell-BTC-buy-ETH
https://swap.thorchain.org/sell-BTC.BTC-buy-ETH.USDC
```

The user completes and signs the swap themselves, in their own wallet or through the wallet-free memoless flow. THORChain Swap holds no keys and submits nothing on a user's behalf.

## Conventions

- Assets use `CHAIN.SYMBOL` notation: `BTC.BTC`, `ETH.ETH`, `ETH.USDC-0XA0B86991C6218B36C1D19D4A2E9EB0CE3606EB48`.
- The core MCP `amount` input is an integer in 1e8 base units: `100000000` = 1 BTC = 1 ETH = 1 RUNE. Returned amount fields are generally strings.
- Quotes are indicative and expire; re-fetch before showing one to a user.

## Next steps

- [MCP server reference](https://swap.thorchain.org/developers/mcp) — every tool and its parameters
- [REST API reference](https://swap.thorchain.org/developers/api) — the support endpoints and error format
- [Authentication](https://swap.thorchain.org/developers/auth) — why nothing here needs a credential, and where API keys come from
- [SDKs](https://swap.thorchain.org/developers/sdks) — TypeScript, Python, and Go clients
- [Developer portal](https://swap.thorchain.org/developers) — the full index
