Magic: The Gathering harness for LLMs
See the codeBenchmark LLMs by having them play Magic: The Gathering against each other — 1v1 duels and multiplayer Commander.
Built on XMage, a full rules engine with enforcement for 28,000+ unique cards. LLMs interact via MCP tools exposed by the bridge — they see the board state, choose actions, and play full games with no manual intervention.
Card images aren't included in the repo. Download them once via the XMage desktop client:
make run-client to launch the client.plugins/images/ and reused by all future runs.export OPENROUTER_API_KEY="sk-..."
make run CONFIG=round-robin-commander
This runs 4 LLM pilots against each other in a Commander game with coverage-optimized matchmaking, observer mode, and video recording. Recordings and logs are saved to ~/.mage-bench/logs/.
Other configs:
# Default: no API keys needed (2 CPU Jumpstart duel)
make run
# List all available configs
make list-configs
# Custom config file
make run CONFIG=path/to/my-config.json
# Record to a specific file
make run OUTPUT=/path/to/video.mov
After a game finishes, the puppeteer prompts to upload the recording to YouTube.
doc/youtube.md).~/.mage-bench/youtube-client-secrets.json.YOUTUBE_PLAYLIST_ID in your environment or .env file. Defaults to the mage-bench playlist.Three layers:
Mage.Client.Bridge, Mage.Client.Observer) — the bridge lets LLMs play via MCP tool calls, and the observer renders the game and records video.puppeteer/) — orchestrates everything: spawns processes, connects LLMs to bridge clients, tracks costs, manages recordings.Game logic and XMage workarounds live in the Java bridge layer. The puppeteer stays simple.
| Type | LLM? | Description |
|---|---|---|
| Pilot | Yes | Strategic LLM player — sees board state, chooses actions |
| Sleepwalker | No | MCP auto-player for infra/testing, no LLM |
| CPU | No | XMage's built-in AI (COMPUTER_MAD) |
Configure players in JSON config files (see configs/).
The spectator provides:
See AGENTS.md for development conventions, code isolation rules, and how to run things.
Based on XMage.
(top 30 of 313)
Java
97.3%
Python
1.9%
Magic: The Gathering harness for LLMs
See the codeBenchmark LLMs by having them play Magic: The Gathering against each other — 1v1 duels and multiplayer Commander.
Built on XMage, a full rules engine with enforcement for 28,000+ unique cards. LLMs interact via MCP tools exposed by the bridge — they see the board state, choose actions, and play full games with no manual intervention.
Card images aren't included in the repo. Download them once via the XMage desktop client:
make run-client to launch the client.plugins/images/ and reused by all future runs.export OPENROUTER_API_KEY="sk-..."
make run CONFIG=round-robin-commander
This runs 4 LLM pilots against each other in a Commander game with coverage-optimized matchmaking, observer mode, and video recording. Recordings and logs are saved to ~/.mage-bench/logs/.
Other configs:
# Default: no API keys needed (2 CPU Jumpstart duel)
make run
# List all available configs
make list-configs
# Custom config file
make run CONFIG=path/to/my-config.json
# Record to a specific file
make run OUTPUT=/path/to/video.mov
After a game finishes, the puppeteer prompts to upload the recording to YouTube.
doc/youtube.md).~/.mage-bench/youtube-client-secrets.json.YOUTUBE_PLAYLIST_ID in your environment or .env file. Defaults to the mage-bench playlist.Three layers:
Mage.Client.Bridge, Mage.Client.Observer) — the bridge lets LLMs play via MCP tool calls, and the observer renders the game and records video.puppeteer/) — orchestrates everything: spawns processes, connects LLMs to bridge clients, tracks costs, manages recordings.Game logic and XMage workarounds live in the Java bridge layer. The puppeteer stays simple.
| Type | LLM? | Description |
|---|---|---|
| Pilot | Yes | Strategic LLM player — sees board state, chooses actions |
| Sleepwalker | No | MCP auto-player for infra/testing, no LLM |
| CPU | No | XMage's built-in AI (COMPUTER_MAD) |
Configure players in JSON config files (see configs/).
The spectator provides:
See AGENTS.md for development conventions, code isolation rules, and how to run things.
Based on XMage.
(top 30 of 313)
Java
97.3%
Python
1.9%