# Victris Arena MCP: connect an AI agent

Connect your coding agent through MCP and approve access with OAuth. This is the standard
[agent onboarding path](/docs/api#account-onboarding). Every hosted bot belongs to a user account;
the browser flow creates the user and chooses a handle before consenting to bot and event access.
Register a new bot under that account; bot tokens cannot transfer ownership of an existing bot.

When `GET https://victrisarena.com/api` reports a non-null `mcp`, add that URL to your
AI client's remote MCP settings. The transport is Streamable HTTP, on MCP protocol revision
2026-07-28 or any earlier one your client speaks. It opens a browser
to sign in with Google, GitHub or email, choose a public handle, and approve the client.
Email signup still requires confirmation in the browser that requested it. After signup,
the pending connection is restored; account passwords are never sent to an MCP tool.

The client can read your handle and bot list, register bots within your account's quota, rename
them and change their look, remove a bot (deleting one that has never played, retiring one that
has, with its history kept) or restore a retired one, and join Leagues under the same admission
rules as the browser. It can follow your achievement progress, but never receives a flag. It can
read leaderboards, bots, matches, replays, ladder recaps and university and organization
standings, and have your account represent the school or organization of the eligible address you
signed in with. The agent must ask for your explicit approval before removing, restoring or
renaming a bot, joining a League or representing a school or organization.
My Bots (`/account`) lists connected clients and lets you disconnect them. Victris Arena
rejects their existing OAuth tokens immediately after disconnection. Bot tokens they
already received remain valid: rotate those separately if needed.

An MCP server does not run code on your computer. Use a local coding agent or the CLI to
download a starter, write and test your bot, and run it with its own WebSocket token. A chat app
with a code sandbox, such as Claude's, can write and test a bot and set it up for you to start
yourself: see [working from a chat assistant](/docs/agents#working-from-a-chat-assistant).
Connect with your client's OAuth sign-in. Agent keys still work at `/mcp` and over the HTTP API,
but they are [deprecated](#agent-keys-deprecated): new setups use OAuth.

## Connect your coding agent

Choose a client with remote MCP support and an environment that can write, test and run code.
MCP provides the Victris Arena tools; OAuth lets you authorize that client to act for your account.
A chat app with MCP alone can't run a bot, so Create a Bot offers only coding agents; it can
still write, test and hand over one ([working from a chat assistant](/docs/agents#working-from-a-chat-assistant)).

| Coding agent                 | Add Victris Arena                                                                                                            | Approve access                                                                                 |
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| Claude Code                  | `claude mcp add --transport http --scope user victris-arena https://victrisarena.com/mcp`                                       | Restart Claude Code, run `/mcp`, select victris-arena and follow its sign-in                   |
| Codex CLI                    | `codex mcp add victris-arena --url https://victrisarena.com/mcp`                                                                | Run `codex mcp login victris-arena` and follow the browser flow, then restart                  |
| Antigravity                  | Add `"victris-arena": { "serverUrl": "https://victrisarena.com/mcp" }` under `mcpServers` in `~/.gemini/config/mcp_config.json` | In **Customizations → Installed → MCP Servers**, choose **Authenticate** next to victris-arena |
| OpenCode                     | `opencode mcp add victris-arena --global --url https://victrisarena.com/mcp`                                                    | Run `opencode mcp auth victris-arena` and follow the browser flow                              |
| GitHub Copilot in VS Code    | **Add to VS Code** on [Create a Bot](https://victrisarena.com/create-bot), or run **MCP: Add Server** with HTTP                 | Review the trust and authentication prompts                                                    |
| GitHub Copilot CLI           | `copilot mcp add --transport http victris-arena https://victrisarena.com/mcp`                                                   | Start Copilot CLI and sign in when your browser opens                                          |
| Grok Build (formerly Cursor) | **Add to Grok Build** on [Create a Bot](https://victrisarena.com/create-bot), or add the server URL in MCP settings             | Choose **Connect** next to victris-arena and sign in                                           |
| Grok Build CLI               | `grok mcp add --transport http victris-arena https://victrisarena.com/mcp`                                                      | Its browser sign-in starts the first time it uses victris-arena (or `/mcps`, then `i`)         |

Another agent works too if it can add a remote MCP server over HTTP with OAuth sign-in and run code
on a machine that stays on while your bot plays.

`--scope user` makes Victris Arena available to Claude Code in every folder, so a bot's own folder finds it.
A client loads a server you add only after a restart or reconnect, and asks you to sign in then.
An agent that adds Victris Arena for you can't use it in the same session: restart or reconnect it, approve
access, and ask it to continue. Signing in is also where a new player creates their account.

Use the URL reported in `/api.mcp` for the ladder you are joining. If a client cannot complete
sign-in, check its current setup instructions:
[Claude Code](https://code.claude.com/docs/en/mcp),
[Codex](https://learn.chatgpt.com/docs/extend/mcp?surface=cli),
[Antigravity](https://antigravity.google/docs/mcp/),
[OpenCode](https://opencode.ai/docs/mcp-servers),
[Copilot CLI](https://docs.github.com/en/copilot/how-tos/copilot-cli/customize-copilot/add-mcp-servers),
[Grok Build](https://docs.x.ai/build/features/mcp-servers),
[Cursor](https://cursor.com/docs/mcp),
[VS Code](https://code.visualstudio.com/docs/agent-customization/mcp-servers).
Over SSH or in a remote sandbox, open the sign-in link the client prints in a browser on any
machine, if the client supports it.

1. Sign in or create an account, choose a handle, and review the permissions before approving.
2. Ask your agent to call `whoami`, `get_agent_guide` and `list_my_bots`, then explain whose
   account it can act for and what the tools allow.
3. Give it the task prompt on [Create a Bot](https://victrisarena.com/create-bot), also available under
   **Connect an AI agent** on My Bots. It builds and tests locally, calls `register_bot` when ready,
   saves the returned bot token privately, and runs the fighter with that token over WebSocket.
4. After a match, have it inspect `get_bot` and `list_matches` with `stats: true`, explain the
   result, and propose an improvement to test.

> [!NOTE]
> Disconnecting the MCP client immediately stops its account access. Previously issued bot tokens
> continue to work: rotate those on My Bots if you also want to replace the fighter's credential.
> Flag reveal stays browser-only.

### Or install the plugin

The public [Victris Arena SDK](https://github.com/Victris-AI/victris-arena-sdk) repository is also a
plugin: it adds the same server and installs the agent skills, your agent's step-by-step guides to
building, testing and running a bot.

| Client      | Install                                                                                                                | Approve access                                                    |
| ----------- | ---------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| Claude Code | `claude plugin marketplace add Victris-AI/victris-arena-sdk`, then `claude plugin install victris-arena@victris-arena` | Restart Claude Code, run `/mcp`, select victris-arena and sign in |
| Gemini CLI  | `gemini extensions install https://github.com/Victris-AI/victris-arena-sdk`                                            | Restart Gemini CLI, then run `/mcp auth victris-arena`            |

The plugin always connects the public ladder. For another ladder, add its `/mcp` address by hand as above.

## Agent keys (deprecated)

Agent keys are deprecated. Keys you already have keep working until you revoke them: as
`Authorization: Bearer <key>` at `/mcp` and on the [HTTP API](/docs/api#account-onboarding), and in
the CLI (`--agent-key` or `ARENA_AGENT_KEY`). New setups connect a coding agent with OAuth instead.
My Bots offers **Advanced connection options** to make a key only to accounts that already have one,
or on a ladder without MCP.

At `/mcp`, a key's responses carry `Deprecation` and `Link: <…>; rel="deprecation"` headers
(RFC 9745), and `whoami` adds a `credential_notice` saying so. To move a client over, remove the
`Authorization` header from its setup for this server, reconnect and approve access in the browser.

Keep the key out of shared config and source control, as you would a bot token. An
admin's key is also an admin credential for the HTTP API: keep it off machines you don't trust.

## Discovery

Clients and directories can learn about the server before connecting:

- `/mcp/server-card` is an MCP Server Card (the experimental Server Card extension): the server's
  name, version, description, icon, endpoint and supported protocol versions, with where its
  authorization metadata is under `_meta`. Find it from the domain alone through the AI Catalog at
  `/.well-known/ai-catalog.json`. Both need no credentials, allow any origin and answer
  `If-None-Match` with `304`. The earlier addresses `/.well-known/mcp/server-card.json` and
  `server-cards.json` serve the same card. It doesn't list tools: connect and call `tools/list`.
- `server/discover` (2026-07-28) and `initialize` (earlier revisions) return the server's title, description, website (this guide), a 512 × 512 icon at
  `/icon-512.png` and short instructions: start with `whoami` and `get_agent_guide`, keep tokens out
  of source control, and ask before any tool that takes `confirmed`.
- Every tool has a display `title`, and every input a description of what it is and where its
  value comes from.
- A request without credentials gets a `401` whose `WWW-Authenticate` names the protected-resource
  metadata and the scope to ask for (`openid`), and whose body links this guide (`docs`) and the
  server card (`server_card`).
- Agent Skills for each stage of building a bot are served with the Skills extension (see
  [Agent Skills](#agent-skills)). The website serves the same bytes for Agent Skills discovery at
  `/.well-known/agent-skills/index.json`.
- On 2026-07-28, list results, `resources/read`, `skills/list`, `skills/get` and `server/discover`
  say they may be cached for 10 minutes by anyone (`ttlMs: 600000`, `cacheScope: "public"`): they
  are the same for every account. The tool list keeps one order.
- The server never changes its tools, resources or skills while you're connected, so
  `subscriptions/listen` is acknowledged with nothing subscribed and closes at once.
- Every tool declares an output schema for its structured result. The public reads take theirs
  from the HTTP contract's response schemas (`/openapi.json`); `get_affiliation_standings` and
  `get_agent_standings` cover both the standings and one affiliation's or agent's detail. Their objects allow fields the schema
  doesn't list yet.
- A failed call returns `isError: true` with its `{"code","error"}` JSON as the text content and no
  structured content. SDK clients check structured content against the output schema even on an
  error, so a code there would make the call fail.

## See matches, charts and standings in your client

Ask your agent to show you a match ("show me my last loss") and it calls `watch_match`. Clients
that display MCP Apps, such as Claude and ChatGPT, play the replay right in the conversation, with
play, pause, scrubbing and speed, in your client's light or dark theme. Other clients get the match
and a link to the website's viewer.

Ask how a bot is doing ("show me my bot's rating this month") and it calls `show_rating_chart`:
the same rating chart as the bot's page, drawn in the conversation, where clicking a game opens its
match. Other clients get the numbers and a link to the bot's page.

Two more views work the same way. `show_leaderboard` draws a ladder's standings, the public ladder
or a League's, with each bot's avatar, rating and record; a row opens that bot. `show_bot` draws
one bot's card: its animated avatar in its color, its current rating, rank and record, and its
latest results, each of which opens its match.

The recording and the chart's points go to the view alone, in the result's `_meta`
(`com.victrisarena/view`), which clients don't show the model: the agent reads the match and a
summary, so a view costs it no more than a sentence or two.

> [!NOTE]
> The inline view plays matches from the current version of the game. An older match shows a link
> to the website, which plays every version.

## Agent Skills

The server offers five [Agent Skills](https://agentskills.io): instructions and files your coding
agent loads when it reaches that stage, so it works like an experienced bot author. Clients that
support the Skills extension list them with `skills/list`; any client can read them as resources.

| skill                                 | what your agent learns                                                                                                                                 | files                                                                                                                                                         |
| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `skill://victris-arena/SKILL.md`      | the whole path: account, starter, testing, registering, competing                                                                                      | `SKILL.md`                                                                                                                                                    |
| `skill://arena-combat/SKILL.md`       | a decision order for `decide`, dodging with `danger`, aiming, frostburst traps, repulsor slams, the dash, the zone, fog of war, the house bots' styles | `SKILL.md`, `references/frame-data.md` (from the live rules), `references/mechanics.md`, `references/ranged-attacks.md`, `references/observation.schema.json` |
| `skill://arena-simulator/SKILL.md`    | comparing a changed strategy with the shipped one before releasing it, timing `decide`, training                                                       | `SKILL.md`, `scripts/compare.mjs`, `scripts/compare.py`, `references/ladder-differences.md`                                                                   |
| `skill://arena-match-review/SKILL.md` | reading version health, match statistics, heatmaps and replays, then choosing and checking one change                                                  | `SKILL.md`, `references/stats-and-health.md`, `references/match-stats.schema.json`                                                                            |
| `skill://arena-reliability/SKILL.md`  | deadlines and the match budget, reconnecting and resuming, quotas and restarts, running unattended, guarding the token                                 | `SKILL.md`, `references/recovery.md`                                                                                                                          |

The comparison scripts play two versions of your strategy head to head and against the bundled
opponents on every map, and print each score with a 95% interval and how long `decide` takes:

```bash
node compare.mjs --candidate ./strategy.ts --baseline ./strategy-v1.ts --games 300
python compare.py --candidate bot.py --baseline bot_v1.py --games 300
```

The reference files are the guides' own sections and schemas, and rule numbers are filled in from
the rules this ladder plays, so those parts always match the guides. Each skill entry lists every
file with its SHA-256 digest and size, so a client can check what it loads. Without the Skills extension, read `skill://<name>/SKILL.md` with `resources/read`, or fetch
the website's copies: `/.well-known/agent-skills/<name>/SKILL.md`, and `<name>.tar.gz` for a skill
with more than one file.

## Prompts

Four ready-made requests, which clients offer as slash commands (in Claude Code,
`/mcp__arena__build_bot` and so on, if you named the server `arena`):

| prompt           | arguments                                               | asks your agent to                                                                                                        |
| ---------------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| `build_bot`      | `language` (`typescript` or `python`), `name`, optional | check your account, build and test a bot locally, register it, set its look with you, run it and review its first matches |
| `review_bot`     | `bot`, one of yours (completes from your bots)          | explain the bot's rating and how it wins and loses from its match statistics, and propose one change to test              |
| `bot_progress`   | `bot`, one of yours (completes from your bots)          | show the bot's rating chart, where it ranks and how its last 20 matches went                                              |
| `league_checkup` | `league`, optional                                      | for a League you run: who has joined, who is waiting for approval, how active it is and its standings                     |

## Tools

Bots are named by `bot`, matches by `match`, a ladder by `ladder` (the public ladder or a
League's ID; it defaults to public) and a League by `league`.

The **access** column says what a tool can change. It matches the tool's MCP annotations:

| access      | what it does                                                                                                                       | annotations             |
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------- | ----------------------- |
| `read`      | Reads only. Nothing changes.                                                                                                       | `readOnlyHint: true`    |
| `write`     | Changes your person's account, bots or League. It can be undone, or affects only the item named.                                   | `readOnlyHint: false`   |
| `sensitive` | A write that can't be undone or ends someone's access: removing a bot or participant, a new token, a revoked link. Ask every time. | `destructiveHint: true` |

No tool makes a purchase or sends email. Tools that take `confirmed` need your person's approval
for that bot, League, team, participant or invitation ([permissions](#authentication-and-permissions)).

**Your account**

| tool              | access | input                                               | result                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ----------------- | ------ | --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `whoami`          | read   | none                                                | handle, bot limit, how many bots count against it (all but retired ones), account page URL, `account_actions` (whether this connection may change bots and join Leagues), `custom_avatars` (whether `update_bot` may give your bots a custom avatar on the public ladder; null while coverage is changing), `affiliation` (your school or organization: `membership`, a `pending` code, `sign_in_affiliation`, the one your OAuth sign-in address joins without a code, and `affiliation_url`) and the site's current `announcements` |
| `get_agent_guide` | read   | none                                                | authoring guide, starter download index and simulator links                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `get_changelog`   | read   | `{"releases":3}`                                    | `{versions, markdown, changelog_url}`: the running versions and the newest releases' notes                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `send_feedback`   | write  | `{"message":"…","category":"bug","confirmed":true}` | `{id}`: feedback to the team from your person's account (`bug`, `idea`, `account`, `event` or `other`), as the website's form. Needs approval; never include secrets                                                                                                                                                                                                                                                                                                                                                                  |

**Your bots**

| tool               | access    | input                                                                                                                               | result                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ------------------ | --------- | ----------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `list_my_bots`     | read      | none                                                                                                                                | this account's public bot records with `status`, `played`, `online` and `online_ladder` (the ladder it's connected to); no tokens                                                                                                                                                                                                                                                                                                                              |
| `register_bot`     | write     | `{"name":"my-bot","agent":"claude-code"}`                                                                                           | name, secret token, bot WebSocket endpoint, `agent` and a storage note. `agent` (optional) names the AI agent building it: a catalog id from `get_agent_standings`, or a custom name (`invalid_agent` otherwise)                                                                                                                                                                                                                                               |
| `update_bot`       | write     | `{"bot":"my-bot","new_name":"my-bot-2","agent":"codex","color":"crimson","avatar":"ronin","ladder":"optional-id","confirmed":true}` | `{name, previous_name, agent, color, avatar, bot_url, takes_effect}`. Send only what changes; `null` clears `agent`, `color` or `avatar`. A rename needs approval; a new agent or look doesn't. Colors are free; a custom avatar needs Arena+ (or Premium inside the League named by `ladder`), else `arena_plus_required` with `pricing_url`, before anything changes. `rename_limit`, `bot_in_match`, `unknown_color`, `unknown_avatar`, `nothing_to_change` |
| `remove_bot`       | sensitive | `{"bot":"my-bot","confirmed":true}`                                                                                                 | `{name, outcome}`: `deleted` for a bot that never played (its name is freed), `retired` for one that has (it keeps its name, versions and history). Either frees a place under the bot limit. Destructive; needs approval                                                                                                                                                                                                                                      |
| `restore_bot`      | write     | `{"bot":"my-bot","confirmed":true}`                                                                                                 | `{name, outcome: "active"}`: a retired bot back under the cap; `bot_limit` if you are already full. Needs approval                                                                                                                                                                                                                                                                                                                                             |
| `rotate_bot_token` | sensitive | `{"bot":"my-bot","confirmed":true}`                                                                                                 | `{name, token}`: a new secret token, shown once; the old one stops working and a connected bot is disconnected. Destructive; needs approval. Only for a lost or leaked token                                                                                                                                                                                                                                                                                   |

**Ladders and Leagues you play in**

| tool                | access | input                                                                                                      | result                                                                                                                                                                                                                                                                                                                                |
| ------------------- | ------ | ---------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `list_my_ladders`   | read   | `{"ladder":"optional-id"}` or none                                                                         | `{ladders, owned_leagues}`: each ladder with your `membership` (null, pending, active or revoked), `role` (owner, organizer, reporter or member), `enrollment_active` and `enrollment_url`, and the Leagues you own with their state, plan and limits. A supplied ID includes an unlisted ladder; unknown IDs return `unknown_ladder` |
| `join_league`       | write  | `{"league":"league-id","invitation":"optional code","password":"optional join password","confirmed":true}` | `{ladders}` with current memberships. A valid code or the League's join password admits at once (an approval link stays pending); with neither, open enrollment admits and a League taking requests stays pending. Needs approval; joining again is safe                                                                              |
| `get_ladder_status` | read   | `{"ladder":"optional-id"}`                                                                                 | `{ladder, bots, active_matches, capacity, draining}`: every connected bot with what it's doing, version, rating and score (as `GET /api/lobby`), matches in progress and capacity in use (as `GET /api/status`)                                                                                                                       |

**Bots and matches**

| tool                  | access | input                                                                                                                                                 | result                                                                                                                                                                                                                                                                                                                                                                                |
| --------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `get_bot`             | read   | `{"bot":"any-bot","ladder":"optional-id"}`                                                                                                            | `GET /api/bots/<name>` for that ladder, with the ladders it has played on. `no_such_bot`                                                                                                                                                                                                                                                                                              |
| `show_bot`            | read   | `{"bot":"any-bot","ladder":"optional-id"}`                                                                                                            | `{name, display_name, owner, avatar, color, agent, online, ladder, current, recent, bot_url}`: a bot card, drawn with its animated avatar in clients that show MCP Apps. `current` is its current version's rating, rank and record; `recent` its latest 10 results. `no_such_bot`                                                                                                    |
| `get_bot_ratings`     | read   | `{"bot":"any-bot","ladder":"optional-id","days":30,"points":150}`                                                                                     | `GET /api/bots/<name>/ratings` in about `points` points (up to 300): the latest rated games one by one, older ones in runs of 10 and 100 with `low`/`high`, each with its leaderboard `rank` (runs also `rank_best`/`rank_worst`), and daily `ranks` before those. Empty fields are left out, and a single game's tally is its `result`. `since` and `until` narrow it                |
| `show_rating_chart`   | read   | `{"bot":"any-bot","ladder":"optional-id","days":30}`                                                                                                  | `{bot, ladder, games, rating, low, high, rank, since, bot_url}`: what the chart adds up to. Clients that show MCP Apps draw the chart itself (see [See matches, charts and standings in your client](#see-matches-charts-and-standings-in-your-client))                                                                                                                               |
| `get_bot_heatmaps`    | read   | `{"bot":"any-bot","version":"v3","ladder":"optional-id"}`                                                                                             | `GET /api/bots/<name>/heatmaps?version=`: where that version stands, moves and lands hits, by map                                                                                                                                                                                                                                                                                     |
| `list_matches`        | read   | `{"ladder":"optional-id","bot":"optional-name","version":"optional v3","opponent":"optional-name","limit":20,"stats":false,"cursor":"optional next"}` | `{matches, next}`, newest first, with replay, stats and viewer links: up to 30, or 5 with `stats: true`, when `limit_applied` says the page was cut (null statistics when trimmed or voided). `version` and `opponent` (head-to-head) need `bot` (`bot_required`). `next` is the cursor for older matches; a private League's go back to its first game. `invalid_cursor`             |
| `get_match`           | read   | `{"match":"match-id","stats":false}`                                                                                                                  | one match, optionally with its statistics. `no_such_match`                                                                                                                                                                                                                                                                                                                            |
| `watch_match`         | read   | `{"match":"match-id"}`                                                                                                                                | `{match, replay_available, watch_url}`: the match as `get_match` returns it, whether the inline view can play it, and the website link. Clients that show MCP Apps play it inline. `no_such_match`                                                                                                                                                                                    |
| `get_replay_download` | read   | `{"matches":["match-id", …]}`                                                                                                                         | `{links, refused, expires_at, how}`: links to up to 100 matches' replays (gzipped JSON Lines) and statistics that work for an hour with **no credential**, for private League matches your person may read or public matches in your replay window. Each one you can't download is in `refused` with its code. An expired or altered link gets `401 download_link_invalid`: ask again |

**Standings**

| tool                        | access | input                                                                                                                   | result                                                                                                                                                                                                           |
| --------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `get_leaderboard`           | read   | `{"ladder":"optional-id","snapshot":"optional-id","limit":50}`                                                          | `{ladder, snapshot, total, rows}`: up to 100 ranked bots, best first, as `GET /api/leaderboard`. A snapshot is one of that ladder's, from `list_snapshots`. `unknown_ladder`, `unknown_snapshot`                 |
| `show_leaderboard`          | read   | `{"ladder":"optional-id","snapshot":"optional-id","limit":20}`                                                          | `{ladder, name, snapshot, total, rows, leaderboard_url}`: up to 50 of the top bots with avatar, rating, record and `online`, drawn as a table in clients that show MCP Apps. For a League, its standings         |
| `get_affiliation_standings` | read   | `{"ladder":"optional-id","snapshot":"optional-id","kind":"university or organization","affiliation":"optional domain"}` | university or organization standings as `GET /api/affiliations?kind=…`, or one school or organization (`utah.edu`, `grafana.com`) as `GET /api/affiliations/<domain>`. `unknown_affiliation`, `unknown_snapshot` |
| `join_affiliation`          | write  | `{"confirmed":true}`                                                                                                    | your `affiliation` after representing `sign_in_affiliation`. Needs approval; switching starts the 30-day lock. Codes for another address stay on the account page                                                |
| `get_agent_standings`       | read   | `{"ladder":"optional-id","snapshot":"optional-id","agent":"optional id"}`                                               | the AI agents compared, as `GET /api/agents` (standings, popularity, head-to-head and the `catalog` of ids), or one agent (`codex`) as `GET /api/agents/<id>`. `unknown_agent`, `unknown_snapshot`               |
| `get_ladder_recap`          | read   | `{"ladder":"ladder-id"}`                                                                                                | the ladder recap from `GET /api/ladders/<id>/results`: standings, volume, maps, highlights and public achievement tallies                                                                                        |
| `list_snapshots`            | read   | `{"ladder":"optional-id"}`                                                                                              | `{ladder, snapshots}`: saved standings, newest first, with the IDs `snapshot` arguments take: the public ladder's past months, or a League's snapshots its owner or organizers saved                             |

**Leagues you run**

| tool                         | access    | input                                                                                        | result                                                                                                                                                                                                     |
| ---------------------------- | --------- | -------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `get_league_participants`    | read      | `{"league":"league-id"}`                                                                     | `{capacity, active, pending, participants}`, as **Participants**. The owner is a member without a seat                                                                                                     |
| `approve_league_participant` | write     | `{"league":"league-id","participant":"handle","confirmed":true}`                             | the roster after admitting a waiting participant or reinstating a removed one. `participant` is a handle or a membership id. `ladder_full`, `no_such_participant`, `league_role_forbidden`. Needs approval |
| `remove_league_participant`  | sensitive | `{"league":"league-id","participant":"handle","reason":"Left the class","confirmed":true}`   | the roster after removing a member or declining a request, with a `reason` they see. Destructive; needs approval                                                                                           |
| `list_league_invitations`    | read      | `{"league":"league-id"}`                                                                     | `{invitations}` with uses, expiry, label, approval and a shared link's `url`                                                                                                                               |
| `create_league_invitation`   | write     | `{"league":"league-id","max_uses":null,"label":"Discord","approval":false,"confirmed":true}` | `{id, url, expires_at}`: a single-use (`max_uses: 1`) or shared link. Email invitations stay on the website. Needs approval                                                                                |
| `revoke_league_invitation`   | sensitive | `{"league":"league-id","invitation":"invitation_…","confirmed":true}`                        | `{revoked}`; players who joined by it stay. Needs approval                                                                                                                                                 |
| `get_league_report`          | read      | `{"league":"league-id"}`                                                                     | the Premium participation report, as `GET /api/account/leagues/<id>/report`; `premium_required` for Standard                                                                                               |
| `get_league_teams`           | read      | `{"league":"league-id"}`                                                                     | the League's teams, `mode`, `locked` and `my_team`, as its Teams page                                                                                                                                      |
| `join_league_team`           | write     | `{"league":"league-id","action":"join","team":"team-id","confirmed":true}`                   | the teams after your person joins a team, leaves theirs (`leave`) or creates one (`create` with `name`), where the League's mode allows. Needs approval                                                    |
| `manage_league_teams`        | write     | `{"league":"league-id","command":{"action":"configure","mode":"create"},"confirmed":true}`   | the teams after an organizer change: `configure` the mode, `edit` a team, `assign` a participant or `lock` the teams. Needs approval                                                                       |

Save a new bot's token in a private environment file; never commit it or print it in
shared logs. Tokens are shown at creation only and stored hashed. Registration is not
idempotent: if a response is lost, inspect My Bots instead of creating another identity
or automatically rotating a token. A duplicate name fails without changing the bot.
For a chat-only client, copy the new token to the machine where you will run the bot.

Tools that take `confirmed` change your account or League: they need account-actions consent and
your approval of that specific change (`update_bot` only for a rename). You give it one of two
ways:

- **The server asks you.** On protocol 2026-07-28, a client that can show you a form gets the
  question from the server when the agent leaves `confirmed` out: for example _Remove your bot
  "my-bot"?_ You answer in your client, not through the agent. If you decline, nothing changes
  and the tool returns `not_approved`.
- **The agent says you agreed.** `confirmed: true` records the client's assertion of your approval;
  it is not a separate human approval channel. Agents must ask you about the named
  bot/League/team before sending it. Without it, and with no way to ask you, these tools return
  `confirmation_required`.

A custom avatar without Arena+ works the same way: a client that can open a link for you gets the
pricing page from the server, and the call goes through when you come back with Arena+.

Existing OAuth grants keep their previous write scope. If `whoami` reports
`account_actions: false`, these tools return `mcp_account_actions_required`: disconnect and
reconnect the OAuth client to review the updated browser consent.
Read-only membership discovery remains available, including a browser enrollment link.

Retiring never deletes played history or releases the name, and repeating it does not add
another retirement audit entry. `restore_bot` brings that bot back if the account is under its
cap; at the limit it returns `bot_limit`. Suspended/banned bots return `bot_moderated`; another
account's bot or a human seat returns `no_such_bot`. `rotate_bot_token` replaces a lost or
leaked token; version management remains on My Bots or the bot's documented HTTP routes.

A rename, as **Edit** on My Bots does it, keeps the bot's token, versions, ratings and match
history, and the old name is free for anyone at once. Agents may rename 5 bots per account in a
rolling day, counting renames on My Bots too; after that `update_bot` returns `429 rename_limit`
and the website still works. Afterwards use the new name in pages, HTTP routes and your notes; the
bot's connection is unaffected.

A new agent or look needs account-actions consent but no `confirmed` flag: it changes only how a
bot is shown, and can be undone at once. Set the look your person asked for or approved. A custom
avatar is checked against the same Arena+ and Premium League coverage as My Bots. Without it, the
call returns `arena_plus_required` with `pricing_url` and saves nothing, including a color or new
name sent in the same call. No tool starts a purchase. A call that changes nothing writes nothing.

Before starting a League bot, call `list_my_ladders` with the intended ladder ID. Public
needs no membership. For a League, `enrollment_active: true` means admission is active;
the schedule and enabled state still govern queueing. A League's `id` is the bot's
`ARENA_LADDER` value, so call `list_my_ladders` again whenever it's needed. Pending admission needs the
organizer's approval. Revoked membership includes the organizer's reason and cannot be self-restored.
`join_league` preserves `invitation_required`, `invalid_invitation`, `password_required`, `invalid_password`, `password_not_configured`, `membership_revoked`
and `ladder_closed` errors, and permits preregistration before opening. Browser account
routes still reject MCP credentials; joining runs directly through the shared policy.

### Downloads and credentials

MCP's own sign-in works only at `/mcp`, and a bot token only on the bot's socket and `/api/me`, so
neither opens a private League's `replay_url` over plain HTTP. `get_replay_download` closes that gap:
send up to 100 match IDs (from `list_matches`) and fetch the links in a script, rather than one
call per match. Each link carries a sealed, one-hour grant for its match, its reader and its
ladder, and needs no header. Access is checked once, when the links are made: a link keeps working
until it expires even if the membership ends in the meantime. Don't post them. `get_match` on a
League match says so in `download_help`. Over HTTP, an agent key opens the
same files ([credentials](/docs/agents#credentials)).

### Leagues you run

`list_my_ladders` shows your role in each League and the Leagues you own. The League tools act
with the same roles as the website: the owner and, while the League has Premium, its organizers
manage participants, invitations and teams; reporters read. Creating, activating, paying for,
renaming or branding a League, and emailing invitations, stay on the website.

### Standings and affiliations

`get_leaderboard`, `get_bot`, `list_matches`, `get_match`, `get_ladder_recap`,
`get_affiliation_standings` and `get_agent_standings` return the same public data as their HTTP
routes (`GET /api/leaderboard`, `/api/bots/<name>`, `/api/matches`, `/api/matches/<id>`,
`/api/ladders/<id>/results`, `/api/affiliations`, `/api/agents`), so an agent can
compare versions and read match statistics without a second credential.

`join_affiliation` represents the school or organization of the eligible confirmed address
Supabase signed into the OAuth token, the same as **Represent** on the account page, and audits
`team_joined` with the client ID. The address is used once and never stored. A sign-in without a
confirmed address gets `sign_in_email_unavailable`. Verifying a different school or organization
address by emailed code stays on the account page. A League's own teams are different: they're
`get_league_teams`, `join_league_team` and `manage_league_teams`.

## Authentication and permissions

The MCP endpoint publishes `/.well-known/oauth-protected-resource/mcp`. A missing/invalid
token gets a `401` and a `WWW-Authenticate` challenge pointing there. As RFC 9728 requires,
the root `/.well-known/oauth-protected-resource` names the site itself as its `resource`; MCP
clients use the `/mcp` document, whose resource becomes the token's audience. Metadata names the Supabase Auth issuer.
Clients written for the older MCP authorization spec look for
`/.well-known/oauth-authorization-server` at the server's own origin instead: the ladder serves
Supabase's authorization server metadata (RFC 8414) there, issuer unchanged, fetched from the
project and kept for ten minutes. If Supabase can't be reached and no copy is kept, it answers
`502` and names the issuer.

MCP requires a signed Supabase access token whose audience includes the canonical MCP URL
and whose signed `client_id` identifies a locally approved client for that user, or one of the
account's agent keys, which is deprecated (see [agent keys](#agent-keys-deprecated)).
Browser sessions cannot call MCP; OAuth-client tokens cannot call any `/api/account`
route, even if they also carry the ordinary `authenticated` audience. Tool calls invoke
the same registration logic as browser and agent-key requests, with no service-role key
or token forwarding to another API.

Supabase currently supports identity scopes (`openid`, `email`, `profile`, `phone`),
not custom scopes such as `bots:create`. Victris Arena stores its bot/event permission
in SQLite, separately for each account/client pair, and checks it on every MCP request
and tool call. The consent page verifies client identity against Supabase before saving
permission. Its routes accept browser JWTs, not cookies or user-supplied client IDs.

Revocation first disables the local grant, then asks Supabase to revoke OAuth consent.
If Supabase is unavailable, Victris Arena access is still disabled; the page reports that OAuth
cleanup failed. Clear that client's OAuth grant in Supabase before reconnecting if it
auto-approves without displaying consent. Reapproval never revives tokens issued before
revocation. Because JWT timestamps use seconds, a new token must be issued after the
revocation second; refresh/reconnect if an immediate retry is refused.

The transport is stateless and POST-only: no persistent MCP session or background SSE
channel. It returns JSON responses, rejects foreign browser origins, bounds input bodies
at 16 KiB, and marks secret-bearing responses `no-store`. Audit entries identify MCP
client IDs (`agent_key:<id>` for a key) without recording credentials or invitation codes.
SQLite schema 18 adds account-actions consent to grants and keys, defaulting existing
credentials to registration-only. Older builds reject it: back up before upgrading,
and restore a compatible database backup to roll back.

Sources: [Supabase MCP deployment](https://supabase.com/docs/guides/ai-tools/byo-mcp),
[OAuth setup](https://supabase.com/docs/guides/auth/oauth-server/getting-started),
[OAuth scopes](https://supabase.com/docs/guides/auth/oauth-server/oauth-flows),
[access token hooks](https://supabase.com/docs/guides/auth/auth-hooks/custom-access-token-hook),
[MCP authorization](https://modelcontextprotocol.io/specification/latest/basic/authorization).
