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

# MCP Server

> Connect an agent to Rako with three MCP tools.

# MCP Server

The fastest way to connect an agent to Rako is the Rako MCP server. Add it to Claude Desktop, Cursor, or any MCP-compatible client and your agent gets tools to search offers, check what information checkout requires, and generate a hosted checkout link.

```json mcp-config.json theme={null}
{
  "mcpServers": {
    "aap": {
      "command": "bunx",
      "args": ["@rakohq/mcp"],
      "env": {
        "AAP_API_KEY": "your-api-key"
      }
    }
  }
}
```

## Flow

```text theme={null}
search_offers → get_checkout_requirements → get_checkout_link
```

1. `search_offers` returns eligible offers and a session ID.
2. `get_checkout_requirements` explains what the user must confirm or provide before checkout for the selected offer.
3. `get_checkout_link` records the attribution context and generates a hosted checkout link for the user.

`get_checkout_link` only returns a URL. It does not process payment, charge the user, transfer money, prove conversion, confirm commission, or settle anything; the user chooses whether to open the link and complete checkout. Conversion requires later platform-side outcome evidence.

## Example conversation

```text theme={null}
User: I need a new SIM deal. Cheap, at least 10GB, no contract.

Agent: [calls search_offers(vertical="sim", min_data_gb=10, contract_months=0)]
       I found 4 options:

       1. SMARTY 30GB — £10/mo (Three network, no credit check)
       2. giffgaff 10GB — £10/mo (O2, 5G included)
       3. giffgaff 25GB — £12/mo (O2, 5G included)
       4. Lebara 5GB — £5/mo (Vodafone)

       SMARTY 30GB looks like the best match because it gives you more data
       at the same price and keeps the rolling monthly terms you asked for.

User: Sounds good, let's go with SMARTY.

Agent: [calls get_checkout_requirements(offer_id)]
       Before I generate the checkout link, please confirm you're happy with
       the rolling monthly SIM terms and that you'll complete checkout yourself.

User: Yes, that's fine.

Agent: [calls get_checkout_link(session_id, offer_id, context="Best match: 30GB for £10 rolling monthly")]
       Here's your checkout link: https://aap.link/r/...
```

<Note>
  Use an API key intended for agent/server integrations. Do not put private API keys in client-side code or public repositories.
</Note>

<CardGroup cols={2}>
  <Card title="MCP flow tutorial" href="/guides/mcp-agent-flow">
    Walk through the same flow with placeholder keys and fake data.
  </Card>

  <Card title="Runnable examples" href="/examples/overview">
    Start the local mock server and run SDK examples before using a non-mock API key.
  </Card>
</CardGroup>
