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

# MCP Server

> Manage your Affixo program from Claude, Cursor, or any MCP client — one-click, no install.

Affixo exposes your affiliate program as a **remote MCP connector**: your
assistant connects to one URL, you sign in with Affixo, and it can read your
program and make safe changes on your behalf. No download, no config file, no
key to copy.

* **One click, where the client supports it.** Cursor and VS Code install from
  a link; Claude Code and Codex take one command; Claude and ChatGPT take the
  URL in their connector settings. See the [setup guides](#connect).
* **OAuth, never an API key.** The connector arrives with no credentials — a
  browser sign-in mints a workspace-scoped token behind the scenes. Nothing you
  paste into a config file is secret, so a shared `mcp.json` leaks nothing.
* **Workspace-scoped.** On sign-in you pick which workspace and access level to
  grant. The connector can only ever see that workspace's data.
* **Read + safe-configure only.** No tool can move money — payouts and payment
  batches are deliberately not exposed. Configure tools ask for your approval in
  the client before they run.

## Connect

<Steps>
  <Step title="Add the connector">
    Pick your client — most can add it for you, and Affixo has the buttons under
    **Settings → Developer & API → MCP server**:

    <CardGroup cols={3}>
      <Card title="Cursor" href="/mcp/setup/cursor">One click.</Card>
      <Card title="VS Code" href="/mcp/setup/vscode">One click.</Card>
      <Card title="Claude Code" href="/mcp/setup/claude-code">One command.</Card>
      <Card title="Codex" href="/mcp/setup/codex">Two commands.</Card>
      <Card title="Gemini CLI" href="/mcp/setup/gemini">One command.</Card>
      <Card title="Claude" href="/mcp/setup/claude">Settings → Connectors.</Card>
      <Card title="ChatGPT" href="/mcp/setup/chatgpt">Developer mode.</Card>
    </CardGroup>

    Any other client takes the URL directly as a remote/custom connector:

    ```
    https://go.affixo.dev/mcp
    ```

    **Windsurf** keeps its config at `~/.codeium/windsurf/mcp_config.json`, and
    names the field `serverUrl` rather than `url`:

    ```json theme={null}
    {
      "mcpServers": {
        "affixo": {
          "serverUrl": "https://go.affixo.dev/mcp"
        }
      }
    }
    ```

    There is no API key in any of these. If a setup asks you to paste an
    `sa_live_` key into a config file, it's out of date — the connector
    authenticates in the browser instead.
  </Step>

  <Step title="Connect and sign in">
    Click **Connect**. Affixo opens in your browser — sign in (or you're already
    signed in), then choose the **workspace** and **access level**:

    * **Read only** — inspect campaigns, commissions, promoters and referrals.
    * **Read & write** — also create/update campaigns, set commission rules
      (including per-product rates), configure product commissions, and invite
      affiliates.

    You must be an **admin** of the workspace to authorize a connector.
  </Step>

  <Step title="Use it">
    Affixo's tools appear in your client. Try: *"List my Affixo campaigns"* or
    *"Show my pending commissions."*
  </Step>
</Steps>

## Tools

| Tool                            | Access | What it does                                                                                                                                                                                                                                                                                                                          |
| ------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `affixo_list_campaigns`         | read   | Campaigns/tiers + attribution model + window                                                                                                                                                                                                                                                                                          |
| `affixo_campaign_performance`   | read   | Per-campaign conversions, revenue, commission totals                                                                                                                                                                                                                                                                                  |
| `affixo_pending_commissions`    | read   | Pending commissions + workspace total                                                                                                                                                                                                                                                                                                 |
| `affixo_find_promoters`         | read   | Search affiliates by name / email / status                                                                                                                                                                                                                                                                                            |
| `affixo_list_referrals`         | read   | Recent attributed conversions                                                                                                                                                                                                                                                                                                         |
| `affixo_flagged_affiliates`     | read   | AI risk assessments for fraud triage                                                                                                                                                                                                                                                                                                  |
| `affixo_create_campaign`        | write  | Create a campaign (client asks for approval)                                                                                                                                                                                                                                                                                          |
| `affixo_update_campaign`        | write  | Update name / status / window / model (approval)                                                                                                                                                                                                                                                                                      |
| `affixo_set_commission_rule`    | write  | Set a commission rule — the campaign default, a per-product rate via `product_ids`, or a per-cadence rate via `billing_interval`; `reward_type="non_cash"` (with a `unit`) pays credits / points / free months instead of cash, at any scope; or author the rate from a saved library reward via `library_reward_id` (copy-on-assign) |
| `affixo_remove_commission_rule` | write  | Remove one commission rule from a campaign                                                                                                                                                                                                                                                                                            |
| `affixo_invite_affiliate`       | write  | Invite an affiliate by email (lands pending)                                                                                                                                                                                                                                                                                          |
| `affixo_list_products`          | read   | Product catalog (Stripe-synced + manual) with prices + commission mapping                                                                                                                                                                                                                                                             |
| `affixo_list_rewards`           | read   | Reusable reward library (named value templates) + `used_by_campaigns` count                                                                                                                                                                                                                                                           |
| `affixo_set_product_commission` | write  | Turn a product's commissions off, or redirect it to another campaign                                                                                                                                                                                                                                                                  |
| `affixo_set_products_policy`    | write  | Whether products not in the catalog earn the campaign default                                                                                                                                                                                                                                                                         |
| `affixo_list_payouts`           | read   | List payouts — amount, status, batch (inspect only)                                                                                                                                                                                                                                                                                   |
| `affixo_list_links`             | read   | List referral / tracking links                                                                                                                                                                                                                                                                                                        |
| `affixo_list_webhooks`          | read   | List webhook endpoints                                                                                                                                                                                                                                                                                                                |
| `affixo_get_affiliate`          | read   | Fetch one affiliate by id                                                                                                                                                                                                                                                                                                             |
| `affixo_get_campaign`           | read   | Fetch one campaign by id                                                                                                                                                                                                                                                                                                              |
| `affixo_get_commission`         | read   | Fetch one commission by id                                                                                                                                                                                                                                                                                                            |
| `affixo_get_conversion`         | read   | Fetch one conversion by id                                                                                                                                                                                                                                                                                                            |
| `affixo_get_commission_rule`    | read   | A campaign's commission rules, each with its product mapping                                                                                                                                                                                                                                                                          |
| `affixo_report_overview`        | read   | Workspace KPI overview (optional date range)                                                                                                                                                                                                                                                                                          |
| `affixo_top_affiliates`         | read   | Per-affiliate performance breakdown                                                                                                                                                                                                                                                                                                   |
| `affixo_create_link`            | write  | Create a referral link for an affiliate                                                                                                                                                                                                                                                                                               |
| `affixo_update_affiliate`       | write  | Set affiliate status / name / email (e.g. approve)                                                                                                                                                                                                                                                                                    |
| `affixo_create_webhook`         | write  | Register a webhook endpoint for program events                                                                                                                                                                                                                                                                                        |

Configure (`write`) tools surface to the client, whose per-tool human approval is
the confirmation gate. **No tool can move money**, whatever access you grant.

### Result format

Every tool takes an optional `responseFormat`:

| Value                | What you get                                                                                                                                                                   |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `markdown` (default) | A compact table for lists, a field list for a single record. Easier for an assistant to read and cheaper in tokens — a long list stops repeating its field names on every row. |
| `json`               | The raw structure, pretty-printed, with exact types.                                                                                                                           |

You rarely need to ask for either — your assistant picks. Reach for `json` when
you want a nested field walked precisely, or when the distinction between the
string `"5"` and the number `5` matters; that is the one thing the table form
flattens. Nothing else is lost in markdown: every field survives, and a value
too structured for a cell is written there as compact JSON rather than dropped.

## Per-product commissions

A campaign carries **multiple commission rules**. Each rule is a rate +
recurrence plus an optional scope: `product_ids` (only those Stripe products)
or `billing_interval` (`one_time` purchases, `month`ly plans, or `year`ly
plans). A rule with no scope is the campaign's **default**:

* A sale of a mapped product pays **its rule's** rate.
* Otherwise a sale matching an interval rule pays **that** rate.
* Otherwise the sale pays the **default** rule.
* With only scoped rules and no match, the sale pays nothing.
* A product (or an interval) can belong to at most one rule per campaign.

So one campaign can pay, say, $195 on General Admission, $300 on VIP, and 10%
on everything else — just ask your assistant:

> "In my Affixo campaign, pay a flat $195 for the GA product, a flat $300 for
> VIP, and 10% for everything else."

The assistant will call `affixo_set_commission_rule` once per rate (your client
asks you to approve each write). Products come from your Stripe sync or manual
entry — check them with *"list my Affixo products"*.

## Non-cash rewards

Any rule — default, per-product, or per-cadence — can pay a **non-cash reward**
(credits, points, free months) instead of a cash commission. Set
`reward_type="non_cash"` with a `unit`, and `amount` becomes the count of that
unit:

> "In my Affixo campaign, give 100 credits for the Starter product and 10% on
> everything else."

A non-cash rule records a **fulfilment** for you to apply on your own system
rather than paying money — Affixo never moves funds or applies the credit
itself. Each fulfilment fires the `fulfilment.pending` webhook event when
earned (`fulfilment.completed` / `fulfilment.cancelled` follow its lifecycle)
and appears in the dashboard's **Rewards** queue until you mark it fulfilled.
Everything else (scope precedence, recurrence) works exactly as it does for
cash rules.

## Managing access

Each connection is backed by a workspace API key created when you authorize it.
To review or revoke access, go to **Settings → Developer & API → API keys** and
delete the connector's key — the connection stops working immediately. Grant
**Read only** if you just want the assistant to report on your program.
