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

# Build with AI

> Build on SaucerSwap with AI coding tools: llms.txt indexes, the docs MCP server, per-client setup, and a rules file with canonical endpoints and gotchas.

These docs are machine-readable. Point your coding agent at the indexes and MCP server below, and drop the rules file into your project so the agent starts with the endpoints and Hedera-specific gotchas it would otherwise get wrong.

## Machine-readable docs

| Surface           | URL                                             | Use                                             |
| ----------------- | ----------------------------------------------- | ----------------------------------------------- |
| Page index        | `https://docs.saucerswap.finance/llms.txt`      | Compact index of every page for context loading |
| Full content      | `https://docs.saucerswap.finance/llms-full.txt` | The entire docs site as one plain-text file     |
| Per-page Markdown | Append `.md` to any page URL                    | Fetch a single page as clean Markdown           |

## MCP server

The docs are also served over the Model Context Protocol (MCP) at `https://docs.saucerswap.finance/mcp`, giving agents tools to search and read this documentation. No wallet connection or SaucerSwap REST API key is required.

### Agent Plugins bundle (experimental)

The [SaucerSwap docs bundle](https://github.com/saucerswaplabs/docs/tree/main/plugins/saucerswap-docs) packages this endpoint in the [Agent Plugins 1.0.0 format](https://agent-plugins.org/). Use it with a client that supports Agent Plugins MCP components and the `streamable-http` transport.

<Steps>
  <Step title="Download the bundle">
    Download `plugin.json` and `mcp.json` into the same directory, or copy `plugins/saucerswap-docs` from the docs repository. No build step is needed.

    ```bash theme={"dark"}
    mkdir -p saucerswap-docs
    curl --fail --location \
      https://raw.githubusercontent.com/saucerswaplabs/docs/main/plugins/saucerswap-docs/plugin.json \
      --output saucerswap-docs/plugin.json
    curl --fail --location \
      https://raw.githubusercontent.com/saucerswaplabs/docs/main/plugins/saucerswap-docs/mcp.json \
      --output saucerswap-docs/mcp.json
    ```
  </Step>

  <Step title="Load it in your client">
    Inspect both files, then use your client's Agent Plugins installation flow to load the `saucerswap-docs` directory and enable its MCP server. Installation and permissions are client-specific; check the [compatible clients directory](https://agent-plugins.org/compatible-clients).
  </Step>

  <Step title="Check the connection">
    Ask your agent: "Search the SaucerSwap docs for token association requirements and cite the relevant pages." Confirm that it uses the docs server and returns documentation links.
  </Step>
</Steps>

<Note>
  This is experimental packaging support, not a universal installation command. If your client does not support this format or transport, use direct MCP setup below. Choose one setup method to avoid duplicate connections.
</Note>

The hosted server also exposes a documentation-feedback tool. Review your client's tool permissions before enabling it. Queries and submitted feedback go to the documentation service; do not include private keys, API keys, or other secrets.

### Direct MCP setup

<Tabs>
  <Tab title="Claude Code">
    ```bash theme={"dark"}
    claude mcp add --transport http saucerswap-docs https://docs.saucerswap.finance/mcp
    ```
  </Tab>

  <Tab title="Cursor">
    Add to `.cursor/mcp.json` in your project (or `~/.cursor/mcp.json` globally):

    ```json theme={"dark"}
    {
      "mcpServers": {
        "saucerswap-docs": {
          "url": "https://docs.saucerswap.finance/mcp"
        }
      }
    }
    ```
  </Tab>

  <Tab title="VS Code">
    Add to `.vscode/mcp.json` in your workspace:

    ```json theme={"dark"}
    {
      "servers": {
        "saucerswap-docs": {
          "type": "http",
          "url": "https://docs.saucerswap.finance/mcp"
        }
      }
    }
    ```
  </Tab>
</Tabs>

## Rules file for coding agents

Copy this block into your agent rules file (`CLAUDE.md`, `.cursor/rules`, `AGENTS.md`, or equivalent). It encodes the canonical endpoints and the mistakes agents most often make on Hedera.

```markdown theme={"dark"}
# SaucerSwap integration rules

## Canonical endpoints
- REST data API (mainnet): https://api.saucerswap.finance — requires `x-api-key` header
- REST data API (testnet): https://test-api.saucerswap.finance
- Orderbook API (mainnet): https://orderbook-api.saucerswap.finance
- Orderbook API (testnet): https://testnet-orderbook-api.saucerswap.finance
- Hedera mirror node (public, no key): https://mainnet.mirrornode.hedera.com
- Docs: https://docs.saucerswap.finance (llms.txt available)

## Canonical mainnet IDs
- SAUCE token: 0.0.731861 (6 decimals) · xSAUCE token: 0.0.1460200
- WHBAR token: 0.0.1456986 (8 decimals) · WhbarHelper: 0.0.5808826
- V1 router (SaucerSwapV1RouterV3): 0.0.3045981
- V2 SwapRouter: 0.0.3949434 · V2 QuoterV2: 0.0.3949424
- Mothership (SAUCE staking): 0.0.1460199 · Masterchef (farms): 0.0.1077627
- Full list: https://docs.saucerswap.finance/developers/contracts

## Hard rules
- ALWAYS quote before swapping: QuoterV2 (V2), getAmountsOut/In (V1), or
  the Orderbook API quote endpoints (V3). Quotes via mirror-node
  `/api/v1/contracts/call` are free and need no key.
- HBAR uses 8 decimals (1 HBAR = 100,000,000 tinybar). Every token amount
  is denominated in its smallest unit; token decimals vary per token
  (SAUCE = 6). Never assume 18 decimals.
- Keep uint256 values (amounts, nonces, deadlines) as strings in JS.
  Never cast to Number before signing or submitting.
- Hedera accounts must ASSOCIATE a token before receiving it, or the
  transaction fails with TOKEN_NOT_ASSOCIATED_TO_ACCOUNT.
- HTS token inputs require a spender allowance to the router contract.
- Use the WHBAR token address wherever a swap path includes HBAR.
- V3 order book fees are expressed in pips (1 pip = 1e-6), NOT basis points.
- Never log Orderbook WebSocket URLs: they carry the JWT in the query string.
- Develop on testnet first with a dedicated integration account. Never put
  a primary wallet private key in a bot process.
```

<Note>
  Agents should treat prices, fees, and rate limits as live data: fetch them from the APIs or contracts at run time rather than hard-coding values from documentation.
</Note>

## Next steps

<CardGroup cols={2}>
  <Card title="Developer quickstart" href="/developers/quickstart">
    The first three calls, ready to paste into an agent session.
  </Card>

  <Card title="API reference" href="/api-reference/overview">
    Every endpoint across both APIs with auth models.
  </Card>

  <Card title="Contract deployments" href="/developers/contracts">
    Verify every ID in the rules file above.
  </Card>

  <Card title="TypeScript bot client" href="/developers/orderbook/typescript-client">
    A server-side pattern for V3 order book bots.
  </Card>
</CardGroup>
