Skip to main content
Glama

Hanabi Table

A Hanabi referee, an MCP server and a live web viewer, built to study how teams of LLM agents learn and evolve conventions in a cooperative game, and what that says about teamwork.

The table knows the rules, deals the deck, validates every move, shows each player only what they are allowed to know, tracks hint and strike tokens, and logs the whole game. Agents (for example 3-5 Claude Code sessions) sit at the table through MCP. You watch the games in the browser.

Features

  • Rules engine: standard 5-colour game (50 cards, 8 hints, 3 strikes), 2-5 players, deterministic seeded decks, configurable tokens and hand size. Pure TypeScript, no I/O, fully tested.

  • Information hiding: every player sees the other hands and the public log, never their own cards. Each card carries what its owner has learned from hints.

  • Private reasoning: each move requires a reasoning string. It is saved for observers and hidden from the other players (optionally revealed after the game).

  • MCP server (Streamable HTTP, per-player token): lobby, turns (wait_for_turn), moves, history, retrospective chat.

  • Series of games: several tables in parallel, games played back to back with the same players, optional maxGames, organizer "close table".

  • Retrospective chat: communication is closed during play (hints only) and opens after each game.

  • Web app: live board (SSE), per-player view, step-by-step replay, statistics chart, JSON export.

  • Persistence: SQLite event log; state is rebuilt by replaying events.

Related MCP server: PokeArena

Quick start

Requires Node.js 20+.

npm install
npm run dev          # http://localhost:3000
npm test             # engine and table service tests
npm run bots -- 4 2  # smoke test: 4 random bots play 2 games through MCP

Data is stored in data/hanabi.db (override with HANABI_DB).

Connect agents

claude mcp add --transport http -s user hanabi http://localhost:3000/api/mcp

Open one terminal per agent, each in its own directory (so each keeps its own notes):

mkdir -p ~/hanabi-agents/alice && cd ~/hanabi-agents/alice
claude --allowedTools "mcp__hanabi"

Then paste the prompt from docs/agent-prompt.md. The agent flow is:

get_rules → register_player (keep the token) → create_table / join_table → start_game → loop wait_for_turn + give_hint / play_card / discard_card until gameOver → post_retro → next_game.

Any MCP client works; the token can be passed as a tool argument or as an Authorization: Bearer header.

MCP tools

Tool

Purpose

get_rules, resource hanabi://rules

Rules and workflow

register_player

Get a secret token

list_tables, create_table, join_table

Lobby (create_table takes seed, maxGames, maxHints, maxStrikes, handSize, revealReasoningAfterGame)

start_game, next_game

Start the first / next game with the same players

wait_for_turn

Blocks until your turn, game end, or timeout; returns your view and new events

get_state, get_history

Your filtered view and the event log

give_hint, play_card, discard_card

Moves; each requires reasoning

post_retro, get_retro

Retrospective chat, open only after a game ends

Study design

  • No communication during play except hints.

  • A seed on the table makes game N use deck seed-N, so strategies can be compared on identical decks.

  • The simulator provides no memory between games: agents keep their own notes.

  • maxGames ends a series; the organizer can press Close table in the web app to stop everything (agents get table_closed / tableClosed).

  • Export a game (/api/games/[id]/export) to analyse moves, reasoning and retrospectives offline.

Project layout

src/engine/    pure rules engine, seeded deck, per-viewer projection
src/table/     tables, series, wait_for_turn, retro chat, observer queries
src/store/     SQLite connection and schema
src/mcp/       MCP tool definitions
src/app/       Next.js pages and API routes (/api/mcp, /api/tables, /api/stats, ...)
scripts/       bots.mts, random-bot smoke test
tests/         vitest suites

Security note

The web app and the MCP endpoint have no authentication beyond per-player tokens. They are designed for local use; do not expose them to the internet as is.

License

MIT

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables LLM agents to play six-on-six Pokémon battles with hidden information, a full move set, and a deterministic battle engine, including local play, reproducible matches, and benchmarking against AI opponents.
      6
      -
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI agents to join 250game-server rooms as ordinary players over native WebSocket without modifying the game server, supporting room setup, card play and manipulation, scoring, and turn-based decisions while filtering hidden information and rejecting stale-state actions.
      16
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      A QQ group-chat board game engine exposed over MCP that runs Werewolf, Undercover, Liars Dice, and Number Bomb matches with AI bots and human players, keeping seats, roles, turn order, timers, and scoring under program control while an AI referee only relays messages. It lets MCP-capable agents join lobbies, view private roles, speak, act, and referee through tools, resources, and prompts over Streamable HTTP, SSE, or stdio.
      MIT