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

# MCP server

> trackrev-mcp — TrackRev as Model Context Protocol tools. 61 tools over stdio, generated from the same command registry as the CLI, so Claude, Cursor or any MCP client can run your program.

`trackrev-mcp` exposes TrackRev as [Model Context Protocol](https://modelcontextprotocol.io)
tools: 61 of them, over stdio. Point Claude, Cursor, or anything else that speaks MCP at it and
it can create tracking links, answer revenue questions, approve partners and reconcile
commissions against your workspace.

Every tool is generated from the same command registry as the [CLI](/developers/cli), which is
generated from the same [API](/developers/introduction). One surface, three ways in — the numbers
always match the dashboard.

## Install

<CodeGroup>
  ```jsonc Claude Desktop theme={null}
  // claude_desktop_config.json
  {
    "mcpServers": {
      "trackrev": {
        "command": "npx",
        "args": ["-y", "trackrev-mcp"],
        "env": { "TRACKREV_KEY": "lk_live_…" }
      }
    }
  }
  ```

  ```bash Claude Code theme={null}
  claude mcp add trackrev --env TRACKREV_KEY=lk_live_… -- npx -y trackrev-mcp
  ```

  ```jsonc Cursor theme={null}
  // .cursor/mcp.json
  {
    "mcpServers": {
      "trackrev": {
        "command": "npx",
        "args": ["-y", "trackrev-mcp"],
        "env": { "TRACKREV_KEY": "lk_live_…" }
      }
    }
  }
  ```
</CodeGroup>

Get a secret key from **Settings → Developers**, or with `trackrev keys create --scope secret`.
Requires Node 20 or newer.

## The tools

Each is named after the command it runs: `trackrev links create` is `trackrev_links_create`,
`trackrev payouts mark-paid` is `trackrev_payouts_mark_paid`.

| Group      | Tools | What it covers                                                            |
| ---------- | ----- | ------------------------------------------------------------------------- |
| Analytics  | 4     | channel and link performance, the raw click stream, one visitor's journey |
| Links      | 7     | create, update, delete, bulk-create, QR                                   |
| Developers | 8     | API keys, outbound webhooks                                               |
| Setup      | 7     | attribution model and window, campaign folders                            |
| Revenue    | 5     | payment providers, sync                                                   |
| Audience   | 4     | visitors, orders, CSV export                                              |
| Domains    | 7     | branded short domains, retargeting pixels                                 |
| Affiliate  | 9     | programs, partners, groups                                                |
| Money      | 5     | commissions, payouts                                                      |
| Settings   | 4     | transactional email, partner-facing branding                              |
| Account    | 1     | which workspace, plan and limits the key has                              |

Flags become typed parameters — `--days N` is a number, `--retarget on|off` is an enum, a
repeatable `--channel` is an array — and a parameter the CLI documents as required is required in
the schema. A parameter that isn't real is rejected **by name**: a model that guesses `partnerId`
is told the parameter is `partner`, rather than getting an unfiltered answer it believes was
filtered.

Analytics, affiliate and money tools need a **paid plan**, and fail with `plan_required` on a free
workspace. Link and account tools work on every plan.

## What it deliberately won't do

<AccordionGroup>
  <Accordion title="Destructive tools need confirm: true">
    The 11 tools that cannot be undone — deleting a link, banning a partner, voiding a commission,
    marking a payout paid — take a `confirm` boolean that must be true. It is the MCP equivalent of
    the CLI's `--yes`, and the server enforces it as well as declaring it in the schema. Treat it
    as an intent signal, not an authorisation system: the real gate is your client asking you to
    approve the call.
  </Accordion>

  <Accordion title="--read-only removes them entirely">
    Run the server with `--read-only` and every tool that changes data disappears from the list.
    29 tools remain and nothing reachable can write. Useful for an agent whose job is to answer
    questions about the numbers.
  </Accordion>

  <Accordion title="No login or logout">
    Those rewrite the local key file and prompt for a secret. Which key is in play is decided by
    whoever launched the server, not by the conversation.
  </Accordion>

  <Accordion title="No writing files to your disk">
    The CLI can write a QR or a CSV export to any path you name. The MCP tools return the bytes
    instead — "write this file wherever I say" is not a capability a link tracker needs to hand an
    agent.
  </Accordion>

  <Accordion title="No creating payout batches, and no emails">
    Creating a batch stays in the dashboard, as it does in the CLI: it applies per-group payout
    floors and platform fees, and a second implementation would eventually pay someone wrong.
    `partners approve` and `payouts mark-paid` change the record without sending the mail the
    dashboard sends, so a retry loop can't mail anyone twice — it will change the ledger twice.
  </Accordion>
</AccordionGroup>

## Flags

```bash theme={null}
trackrev-mcp [flags]

  --read-only       expose only the tools that cannot change data (29 of 61)
  --profile NAME    use a saved `trackrev login` profile
  --api-url URL     API base (default: the profile's, or app.trackrev.io)
  --timeout N       per-call timeout in seconds (default 60)
  --version
  --help
```

## No shell, no MCP client?

The same surface is plain HTTPS at [`/api/v1`](/developers/introduction) with the same key, and
the same commands are in the [CLI](/developers/cli) for anything that can run a shell command.
