> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sodax.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> SODAX is mainnet-only (no testnet chains or RPC endpoints exist) with a hub-and-spoke architecture; Sonic is the hub. SODAX is non-custodial protocol/software: it routes and settles; independent solvers on the marketplace fill — never say 'our solver', 'the SODAX solver', that SODAX trades, takes custody, or fills orders. For frontend/React integrations, prefer @sodax/dapp-kit hooks over calling @sodax/sdk directly. SDK operations — the methods that build, submit or await a transaction, and the API/quote calls — return Result<T, E> ({ ok: true, value } or { ok: false, error }): check result.ok, never wrap them in try/catch or branch on error.message; discriminate on the narrow error.code union instead. Synchronous config getters (getPartnerFee, getSupportedSwapTokens, getVault, ...) return their value directly, not a Result.

# SODAX MCP

> Give your AI coding agent live SODAX data, quotes and docs over one MCP endpoint, plus swap tools for swaps the user's own wallet signs.

The **SODAX MCP** is a hosted [Model Context Protocol](https://modelcontextprotocol.io) server. Point an MCP-capable agent at it and the agent stops guessing: it can read the live chain and token lists, pull a real quote, look up an intent, and search these docs while it writes your integration. With a SODAX API key it can also make a swap for the user it is helping, without writing code, and the server [checks each swap](#what-the-server-checks-before-the-user-signs) before the user's wallet signs it.

```
https://mcp.sodax.com/mcp
```

The data and docs tools need no API key; the swap tools need one ([API keys](https://docs.sodax.com/developers/how-to/api-keys.md)). Landing page and per-client notes: [mcp.sodax.com](https://mcp.sodax.com/).

> [!NOTE]
>
> The MCP never holds a wallet key and never signs: every tool that touches a transaction either returns
> it unsigned for the user's wallet or takes the hash of one the wallet has **already sent**.

## Add it to your agent

Most clients take the same JSON:

```json theme={null}
{
  "mcpServers": {
    "sodax": {
      "type": "http",
      "url": "https://mcp.sodax.com/mcp"
    }
  }
}
```

| Client | Where it goes |
| - | - |
| **Claude Code** | `claude mcp add --transport http sodax https://mcp.sodax.com/mcp` |
| **Cursor** | `.cursor/mcp.json` (project) or Settings → MCP (global) |
| **VS Code / Copilot** | `.vscode/mcp.json` — its own schema, below |
| **ChatGPT, Claude Desktop, Windsurf, Cline, Goose, Roo Code, Gemini** | Listed as compatible on [mcp.sodax.com](https://mcp.sodax.com/) — check the client's own MCP config format |

VS Code keys servers under `servers` instead:

```json theme={null}
{
  "servers": {
    "sodax": {
      "type": "http",
      "url": "https://mcp.sodax.com/mcp"
    }
  }
}
```

For the swap tools, send your key in an `x-api-key` header, so they need a client that can set one (VS Code takes the same `headers` under `servers`):

```json theme={null}
{
  "mcpServers": {
    "sodax": {
      "type": "http",
      "url": "https://mcp.sodax.com/mcp",
      "headers": { "x-api-key": "<your SODAX API key>" }
    }
  }
}
```

In Claude Code: `claude mcp add --transport http --scope user sodax https://mcp.sodax.com/mcp --header "x-api-key: <your SODAX API key>"`.

The key is a secret: put it in your own client's user-level config, never in a project file you commit or a config you hand to your users. The server sends it only on its own calls to the SODAX data, solver and Swaps APIs.

An SSE endpoint is available at `https://mcp.sodax.com/sse`, with `"type": "sse"`, for clients that do not speak streamable HTTP. SSE clients send `x-api-key` on the stream and on every message.

Requests are rate limited per client IP (HTTP 429 with `Retry-After`), and every MCP response carries an `X-Request-Id` header to quote when you report a problem; the [server's README](https://github.com/gosodax/sodax-mcp#errors-and-limits) has the limits.

## What it gives the agent

The landing page at [mcp.sodax.com](https://mcp.sodax.com/) lists every tool, and `https://mcp.sodax.com/api` returns the running server's list as JSON.

**Live-system tools**: network and asset configuration (supported chains, chain configs, swap tokens, hub assets, relay chain-id map), intents and solver reads (quotes, orderbook, intent lookup, oracle prices), intent relay (submit and inspect packets), AMM pools and candles, money market reserves with their supply and borrow rates, user positions, partner receivers and fee summaries, and SODA supply. They cover the same public data as the [HTTP API](https://docs.sodax.com/developers/http-api.md), so the agent works from today's values rather than its training data. The lookups filtered by chain (swap tokens, hub assets, money market tokens, chain support) take a chain as the user names it: a name, ticker, key or EVM chain id. An ambiguous id is refused with the keys to pass instead. A tool with a `format` input answers in Markdown, or with `format: "json"` the data alone.

**Documentation tools**: search and full-page reads over docs.sodax.com, plus tools to list, check and refresh them.

**Swap tools**: resolve a token on a chain, read a wallet's balance, price a swap and prepare it, then submit and track it, or cancel it.

## Swaps

> [!WARNING]
>
> A swap moves real funds on mainnet, so test with a wallet holding only what you mean to swap.

The swap tools let the agent make a swap the user asks for. The agent also needs a wallet tool that can switch chains, send the prepared transactions from the user's wallet (from a non-EVM chain, sign and send that family's raw transaction), and tell when each is confirmed; the [server's README](https://github.com/gosodax/sodax-mcp#swapping) lists what that tool must do.

### What the server checks before the user signs

Before `sodax_swap_prepare` hands the wallet anything to sign, the server checks that it is the swap the user asked for, and refuses a mismatch (`SWAP_MISMATCH`) instead of passing it on:

* The intent matches the request field by field (amounts, deadline, chains, tokens, sender, recipient, partner fee) and comes from the user's own hub wallet.
* On an EVM chain, the swap transaction matches, byte for byte, the one the SODAX SDK builds, and an approve lets the swap contract spend only the swap's amount. From a non-EVM chain, the SDK builds the transaction on the server.

An all-zero address, or an EVM recipient of `0x…dEaD`, is refused as an invalid address. After the user sends, `sodax_swap_submit_and_track` submits only a transaction whose on-chain events show the prepared swap. The [server's README](https://github.com/gosodax/sodax-mcp#safety) lists its other safety rules.

### Make a swap

**1. Price**

`sodax_swap_price` takes each side as the user names it (a chain plus a symbol, a token address or
`native`) and the amount, and returns what the user would receive. It builds and holds nothing, so
the agent uses it to show or watch a price.

**2. Prepare**

Once the user is ready to sign, `sodax_swap_prepare` takes the same plus the user's wallet as
`fromAddress` (and `toAddress` unless both chains are EVM), and optionally the slippage and deadline. It
returns the transactions to send: an approve when one is needed, with what it lets the swap
contract spend, after a reset to zero for tokens that require it, then the swap. From a non-EVM
chain there is one step: that chain family's unsigned transaction. It also returns the least the
user will receive: a tighter slippage makes a fill less likely, and an unfilled swap is refunded
after its deadline. It holds the quote until its `expiresAt`.

**3. Confirm and send**

The agent shows the user the amounts. Once they confirm, the user's wallet signs and sends each
transaction in order, each confirmed before the next.

**4. Submit and track**

`sodax_swap_submit_and_track` takes the prepared quote's `quoteId` (or, without it, the source chain) and the swap transaction's hash. It
checks the transaction on chain, submits the swap, and reports its progress. The agent makes it right
after sending, before the quote's `expiresAt`, and again while the result asks it to: from any chain but
Sonic nothing submits the swap until this call, and a first call after `expiresAt` starts the deposit's
refund instead, within a window the [server's README](https://github.com/gosodax/sodax-mcp#swapping)
gives. From Sonic the swap transaction itself creates the intent on the hub, where a solver can fill it
before this call, and an expired one is refunded there.

* **Chains:** a swap can start on Sonic, another EVM chain, Solana, Sui, Stellar, NEAR or Injective, and end on any SODAX swap chain. Bitcoin, Stacks and ICON can't start one; a price from them names the chains that can.
* **Tokens:** when the price or prepare tool can't match a token, `sodax_resolve_token` looks it up and returns the match, or the candidates for the user to pick. The agent never guesses a token or an address.
* **Balances:** neither tool checks them, so `sodax_get_balance` reads a wallet's balance when the user isn't sure they hold enough.
* **Cancel:** `sodax_swap_cancel` cancels a swap that hasn't been filled, once it's submitted (from Sonic, as soon as its transaction is mined). The first call returns the cancel transaction for the user's wallet; a second call with its hash relays it, or, from Sonic, confirms it on the hub.
* **Next step and help:** every swap tool result carries a `nextStep` that tells the agent what to do next, and a `requestId`. When a swap needs help, the user gives the `requestId` and the transaction hashes to the SODAX team on [Discord](https://www.sodax.com/discord).

### Profiles

A connection picks its tools with `?profile=<name>` on the URL or the `x-sodax-profile` header.

| Profile | Tools |
| - | - |
| `all` (default) | The live-system and documentation tools, plus the swap tools when you send a SODAX API key |
| `builder` | The live-system and documentation tools |
| `swap` | The swap tools only; refuses a connection without a SODAX API key |

The [server's README](https://github.com/gosodax/sodax-mcp#profiles) has the stdio settings and the errors a bad setting returns.

### Partner fee

A builder can take a fee on the swaps its agent quotes: add `?partnerAddress=<EVM address>&partnerFeeBps=<basis points>` to the URL, or send the `x-sodax-partner-address` and `x-sodax-partner-fee-bps` headers. Set both or neither; the [server's README](https://github.com/gosodax/sodax-mcp#partner-fee) has the allowed range and the error a bad value gets. The fee is taken from the amount the user sends and is part of the quote. It is never a tool input, so the agent can't change it.

## MCP or `@sodax/skills`?

They solve different halves of the same problem, and they compose.

| | **SODAX MCP** | **[`@sodax/skills`](https://docs.sodax.com/ai-integration-guide)** |
| - | - | - |
| What it is | Hosted server the agent calls at runtime | Skill files installed into your repo |
| Gives the agent | Live data, doc search, and swaps it makes for a user | v2-correct API shapes, patterns, anti-patterns |
| Best at | "What tokens can I swap from Base today?" · "Swap 5 USDC from Arbitrum to Base for me" · "Why did this intent fail?" | Writing and porting `@sodax/*` code |
| Needs a network call | Yes | No |
| Setup | One config block, plus an API key and a wallet tool for swaps | `npx skills@latest add gosodax/sodax-sdks/packages/skills` |

Install both. Skills keep the generated code correct; the MCP keeps the values in it real. A swap the user wants made now is the MCP's job; swaps inside your own app are the SDK's, written with the skills.

## Try it

Once it is wired, ask in plain language:

> "Which networks does SODAX support, and what can I swap into on Solana today?"

> "Look up intent `0x…` and tell me which step it failed at."

> "Swap 5 USDC on Arbitrum to USDC on Base. My wallet is `0x…`."

The last one needs an API key and a wallet tool (see [Swaps](#swaps)). The agent shows the price and asks you to confirm, your wallet signs each transaction, and the agent tracks the swap until it's filled. Follow up with "Is my swap done?" or "Cancel that swap".

The solver quote tool prices a pair without a key, with one wrinkle worth knowing: it quotes **hub-chain (Sonic) assets**, so the agent resolves the pair through the oracle tool first rather than passing a Solana or Base token address straight in. The swap tools take tokens as the user names them.

## Next

> [card] [AI coding agents](https://docs.sodax.com/ai-integration-guide.md)
>
> Install `@sodax/skills` so agents write v2-correct code.

> [card] [Your first swap](https://docs.sodax.com/quickstart.md)
>
> Install → quote → execute on mainnet.

> [card] [HTTP API](https://docs.sodax.com/developers/http-api.md)
>
> The same public data, callable directly.

> [card] [Talk to the team](https://docs.sodax.com/contact.md)
>
> Missing a tool? Tell us what you needed.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.