Skip to main content
Glama


Bot Arena is a web app you run on your own machine. Pick a game, put an agent in each seat, and the arena referees it: legal moves only, a clock per move, and a forfeit for running out of time or crashing. Every game is saved and replays move by move.

Game

Rules the arena enforces

Good for

Chess

Full rules: checkmate, stalemate, repetition, the fifty-move rule, insufficient material

A real test of an agent's reasoning

Connect Four

Four in a row across, up or diagonally wins, a full board draws

A step up: traps two moves deep, against a bot that looks 8 plies ahead

Tic-tac-toe

Three in a row wins, a full board draws

Wiring up and testing an agent in seconds

  • Your agents, any way you like. An MCP client (Claude Code, Cursor, your own), a script in any language over REST, an HTTP server the arena calls each turn, or a JavaScript function you paste in.

  • Agent against agent, or against the house. Built-in bots give your agent something to beat: a random mover in every game, two search engines each in chess and Connect Four, and a perfect minimax in tic-tac-toe.

  • Teach your agent in one line. npx skills add ai-automation-tools/bot-arena installs a skill with the whole play loop into Claude Code, Codex, Cursor and more.

  • Nothing to sign up for. No accounts, keys or database. Games are JSON files on disk (~/.bot-arena with npx, .arena/ in a clone): a game in progress picks up where it left off after a restart, and every finished one has a match report with each seat's move times, timeouts and rejected moves.

NOTE

Thelive demo is a static build: it replays games the house bots played, and you can play tic-tac-toe against the house bots in your browser. To play your own agents, run the arena yourself.

๐Ÿš€ Run it locally

Needs Node.js 20 or newer. The quickest start, no clone:

npx @ai-automation-tools/bot-arena     # http://localhost:9002; games are saved in ~/.bot-arena

--port and --data change those, and --stdio makes it an MCP server on stdin/stdout for clients that only launch stdio servers; npx @ai-automation-tools/bot-arena --help lists the options. To work on the code instead, clone it:

git clone https://github.com/ai-automation-tools/bot-arena.git
cd bot-arena
npm ci
npm run dev          # http://localhost:9002 (or: npm run build && npm start)

Then open New Match, pick a game, set a seat to Agent (MCP or REST), and start. The page gives that seat a token and the exact commands to connect. For Claude Code:

claude mcp add --transport http bot-arena http://localhost:9002/api/mcp

and ask it to "use the bot-arena tools to play match <id> with seat token <token>". With the skill installed, "play tic-tac-toe in bot arena against the house bot" is enough: the agent starts the match itself. Ready-made example agents (Python over REST, a Node webhook, a Claude Code command) are a good start for your own. The connection guide covers every client, the REST API, webhooks, code bots, the turn object and the error codes.

You want to

Put in the seat

Play an MCP agent

Agent, then connect it to /api/mcp

Play a script or service in any language

Agent, then long-poll /api/matches/:id/turn and POST /api/matches/:id/move

Have the arena call your agent's HTTP endpoint

Webhook with its URL

Try a quick idea in JavaScript

Code bot: paste a function; chess.js is available

Play it yourself

The Play Tic-Tac-Toe page, against a house bot

Give your agent an opponent

House bot: Strong Engine, Search Engine or Random Mover in chess; Deep Minimax, Minimax or Random Mover in Connect Four; Minimax or Random Mover in tic-tac-toe

๐Ÿณ With Docker

docker compose up -d     # builds the image, serves http://localhost:9002

Or run the published image without cloning (it's also how the MCP registry lists Bot Arena):

docker run -d -p 127.0.0.1:9002:9002 -v bot-arena-data:/data ghcr.io/ai-automation-tools/bot-arena

Games live in the arena-data volume, so they survive docker compose down and upgrades (docker compose down -v deletes them). The port is published on 127.0.0.1 only; ARENA_PORT=9100 docker compose up -d moves it. A webhook agent running on your machine is http://host.docker.internal:<port>/... from inside the container (on Linux, start the example webhook with HOST=0.0.0.0).

Related MCP server: chess-mcp

๐Ÿ”’ Running it safely

The arena runs your agents and plays moves without asking anyone to log in. That's right for a tool on your own machine, and it's why the server only answers this machine:

  • npx @ai-automation-tools/bot-arena, npm run dev and npm start listen on 127.0.0.1, not your network.

  • Every API and MCP request must name localhost or 127.0.0.1 as its host, and a browser request from another site is refused. That stops a web page you visit from reaching the arena through your browser (DNS rebinding and cross-site requests).

  • Code bots run with full access, the same as any script you run yourself. Only paste code you trust.

To use it from other machines (a home server, a shared box, a container on another host):

  1. Set an access key: ARENA_API_KEY=$(openssl rand -hex 24) in .env.local or the compose environment. Every page and API call then needs it. Agents send it as the X-Arena-Key header (the seat token stays the Bearer), and a browser enters it once at /unlock. The Connect page's snippets add the header for you.

  2. List the host names people will use in ARENA_ALLOWED_HOSTS, and listen on the network (-H 0.0.0.0, or change the compose port mapping). Those names only work with a key: with ARENA_ALLOWED_HOSTS set and no ARENA_API_KEY, the arena still refuses them (HOST_NOT_ALLOWED) and logs why on the first API call.

  3. Serve it over HTTPS (a reverse proxy, or a private network like Tailscale) so the key isn't sent in the clear.

๐Ÿ“ฆ What's in here

Folder

What's in it

๐Ÿ“š docs/

The connection guide, roadmap, changelog, and the history of the rebuild

๐Ÿงฉ src/

The Next.js app: pages and the API in app/, the arena (seats, agents, the match loop, the game registry in games.ts) in lib/arena/, each game's rules in lib/protocols/, UI in components/

๐ŸŽ“ skills/

The bot-arena agent skill: how to connect, start a match, play the loop and play well

๐Ÿค– examples/

Example agents: Python over REST, a Node webhook, and a Claude Code command over MCP

๐Ÿ› ๏ธ scripts/

generate-demo-matches.ts rewrites the demo-match fixtures; build-pages.mjs builds the static demo; examples-test.mjs plays the example agents (npm run examples:test); pack-externals.mjs runs when the npm package is packed

๐Ÿ“ฆ bin/, server.json

The launcher behind npx @ai-automation-tools/bot-arena, and the MCP registry entry (npm package and Docker image)

๐Ÿณ Dockerfile, compose.yaml

The container image (Next standalone output, games in /data) and the one-command setup

โš™๏ธ .github/workflows/

ci.yml (lint, types, build, tests, the example agents, the npm package and a Docker build on every PR), pages.yml (builds the demo on every PR, deploys it from main) and release.yml (on a v* tag: the GHCR image, the npm package and the MCP registry entry)

๐Ÿงช src/__tests__/

The request-guard test (proxy.test.ts); every other test sits beside the code it tests

๐Ÿ› ๏ธ Develop

npm run lint && npx tsc --noEmit && npx jest --ci && npx next build   # what CI runs
npm run demo:matches   # replay the house-bot demo matches into src/data/demo-matches/
npm run build:pages    # static export of the replay demo into out/

๐Ÿ” How work lands

Changes ship through pull requests into main. A weekly roadmap routine takes the next open item from the roadmap, builds it on a roadmap/auto-<date> branch and opens a PR; the org PR sweep reviews and merges those. The Pages workflow rebuilds the replay demo from main. A release is a version bump in package.json and server.json, then a vX.Y.Z tag: release.yml publishes the Docker image, the npm package (trusted publishing, no token) and the MCP registry entry.


Available Tools

6 tools
create_matchCreate a matchA

Starts a match of chess (seats "white" and "black"), tic-tac-toe (game "tictactoe", seats "x" and "o"; x moves first) or Connect Four (game "connect4", seats "red" and "yellow"; red moves first). Pass one agent per seat. Each agent is {"kind":"external"} for an MCP or REST agent (you get a seat token for it), {"kind":"house","bot":"random-mover"|"search-engine"|"strong-engine"} for a built-in bot (chess and Connect Four: strong-engine > search-engine > random-mover; in tic-tac-toe both engines play perfect minimax), {"kind":"code","code":"export default function (state) { return state.legalMoves[0] }"} for JavaScript run by the arena, or {"kind":"webhook","url":"http://..."} for an agent the arena POSTs each turn to. To play yourself, make your side external and keep its token. To have two agents play each other, make both external and hand each its token.

Inputs: o, x, red, game, +4 more.

get_matchGet a matchC
Read-only

One match with its full move list and result.

Inputs: match_id (required).

list_matchesList matchesA
Read-only

Live and saved matches, newest first, without tokens.

Inputs: no named parameters.

make_moveMake a moveA

Plays your move. Chess: SAN like "Nf3" or "e8=Q", or UCI like "g1f3". Tic-tac-toe: a cell like "b2" (centre) or 1-9. Connect Four: a column, "1" to "7". An illegal move is rejected with the legal list; try again before your clock runs out.

Inputs: move (required), token (required), match_id (required).

resignResignA
Destructive

Resigns your seat; the other side wins.

Inputs: token (required), match_id (required).

wait_for_turnWait for your turnA
Read-only

Blocks until it's your move or the game ends (up to wait_seconds), then shows the board, the legal moves and the status.

Inputs: token (required), match_id (required), wait_seconds.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelogโ€ฆ

    TDQS

    A3.7/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool maps to a clearly distinct action in the match lifecycle: creating, waiting, moving, resigning, listing, and retrieving details. The closest pair, list_matches and get_match, is cleanly separated by collection-level versus single-match scope. No two tools appear to do the same thing.

    Naming Consistency4/5

    The set uses consistent snake_case and mostly follows a verb_noun pattern: create_match, make_move, list_matches, get_match, and wait_for_turn. The only minor deviation is resign, which lacks an explicit noun but remains unambiguous in context.

    Tool Count5/5

    Six tools is well-scoped for a multi-game bot arena: one tool each for creation, turn waiting, movement, resignation, listing, and detail retrieval. There are no obviously redundant or filler tools.

    Completeness4/5

    The set covers the core match lifecycle and supports external agents, house bots, code bots, and webhooks. Minor gaps include explicit draw handling, match cancellation/abort, or rematch operations, but the main create-play-finish-inspect loop is complete enough for agents to work around those limitations.

    Maintenance

    ActivityActive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to play and analyze chess, validate moves, and view a live synchronized visual board in the browser through MCP tools.
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables any local AI agent to play turn-based games over MCP by exposing reset, observe, and act verbs with structured observations and validated legal actions.
      6
      1
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables two autonomous LLM agents to play a full game of chess against each other over MCP, with turn order, legality, clocks, and move history enforced server-side outside both models so neither player can cheat or desync the position, while a live WebSocket GUI lets spectators watch.
      11
      MIT