Run Game of Life from Your Terminal: an MCP + Claude Code Recipe
How to call our Game of Life MCP server straight from the command line with Claude Code — claude mcp add, headless -p scripting, and a one-off recipe that never touches your global config.
Run Game of Life from Your Terminal: an MCP + Claude Code Recipe
Our MCP server tour covers the tools, and our step-by-step tutorial walks through them one at a time in a chat window with a hand-edited Claude Desktop config. This is neither of those. This is for people who live in a terminal and want the whole thing to be a command, not a conversation — using Claude Code's own CLI, not a config file you edit by hand.
Every command and response below is real, run against claude 2.1.220 and the live production MCP server while writing this.
Register the server with one command
Claude Code has a built-in subcommand for adding MCP servers — no JSON file to open, no editor:
claude mcp add --transport http gameoflife https://life.angen.ai/api/mcp/mcp
That's it. --transport http tells Claude Code this is a plain HTTP MCP endpoint (not a local subprocess), gameoflife is the name you'll refer to it by, and the URL is the same public, unauthenticated endpoint used everywhere else on this site. By default this writes to your project's local scope (-s local); add -s user instead if you want it available in every project, not just the one you're in.
Check it registered:
claude mcp list
claude mcp get gameoflife shows the same entry with a live health check — useful if a call starts failing and you want to confirm the problem is the network, not your config. -s local (the default) keeps the server scoped to whatever project directory you're in; -s user registers it once for every project; -s project writes it to a checked-in .mcp.json so teammates get it too. Done experimenting? claude mcp remove gameoflife takes it back out.
The scripting-friendly version: no config file at all
The command above persists the server to your Claude Code config. If you just want to run one task — in a CI job, a cron script, a Makefile target — without adding anything permanent, claude -p (headless/print mode) accepts an MCP server definition inline:
claude -p --mcp-config '{"mcpServers":{"gameoflife":{"type":"http","url":"https://life.angen.ai/api/mcp/mcp"}}}' \
--strict-mcp-config \
--output-format json \
"Use the gameoflife MCP server: fetch the pentadecathlon pattern, then run it forward 15 generations. Report the population and whether the offset is (0,0)."
--strict-mcp-config tells Claude Code to use only the server(s) passed via --mcp-config, ignoring anything already registered — the whole point of a scriptable, reproducible recipe. --output-format json gives you a single JSON result object back on stdout instead of streamed chat text, which is what you actually want if another program is going to parse the output.
What the tool calls look like underneath
Whether Claude Code drives them or you call them yourself, here's the same task run directly against the endpoint, so you can see exactly what a terminal session is actually doing under the hood:
curl -s -X POST "https://life.angen.ai/api/mcp/mcp" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_pattern","arguments":{"patternId":"pentadecathlon"}}}'
{"rle": "2bo4bo$2ob4ob2o$2bo4bo!", "width": 10, "height": 3, "cellCount": 12}
The pentadecathlon is a 12-cell oscillator with period 15 — it should return to this exact shape, in the exact same position, after 15 generations. That's a checkable claim, not folklore, so let's check it:
curl -s -X POST "https://life.angen.ai/api/mcp/mcp" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"run_generations","arguments":{"rle":"2bo4bo$2ob4ob2o$2bo4bo!","generations":15}}}'
{
"rle": "2bo4bo$2ob4ob2o$2bo4bo!",
"generationsRun": 15,
"population": 12,
"extinct": false,
"aborted": false,
"offset": { "dx": 0, "dy": 0 }
}
Same RLE, same population, offset: {dx: 0, dy: 0} — a real oscillator returning to its starting state after exactly one period, computed by the server's own simulation, not asserted. This is the same run_generations/verify_prediction pair our step-by-step tutorial covers in more depth if you want the full four-step walkthrough with prediction-checking.
Publish straight from the shell
Ship the result as a link, still without leaving the terminal:
curl -s -X POST "https://life.angen.ai/api/mcp/mcp" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"create_board","arguments":{"patternId":"pentadecathlon","name":"terminal recipe demo board"}}}'
{
"shareUrl": "https://life.angen.ai/shared/8zzidyocmbuoogg7lopwui",
"id": "8zzidyocmbuoogg7lopwui",
"name": "terminal recipe demo board",
"cellCount": 12
}
That link is live: life.angen.ai/shared/8zzidyocmbuoogg7lopwui — a real pentadecathlon board, published by the curl call above while writing this article, not a screenshot.
Why this is worth scripting instead of chatting
The moment a Life-related task turns repetitive — verify a batch of patterns' claimed periods, generate a set of boards for a test fixture, sanity-check a set of RLE strings before committing them somewhere — a chat window is the wrong tool. claude -p with --mcp-config and --output-format json turns the same MCP tools into something you can loop over in bash, wire into a Makefile, or run in CI without a human in the loop:
for pid in glider pentadecathlon pulsar; do
claude -p --mcp-config '{"mcpServers":{"gameoflife":{"type":"http","url":"https://life.angen.ai/api/mcp/mcp"}}}' \
--strict-mcp-config --output-format json \
"Fetch pattern '$pid' from the gameoflife MCP server and print its cellCount." \
>> pattern-report.jsonl
done
Every response in that loop is the real server doing real work — same guarantee as everywhere else on this site: no hand-simulated cell counts, no guessed periods, just tool calls you can check.
Try it
Register the server (claude mcp add), or skip straight to the scripting form (claude -p --mcp-config ... --strict-mcp-config) — both point at the same public endpoint, no API key required. If you want the conceptual tour of every tool before scripting against them, the MCP server tour has the full list, and the /mcp page has copy-paste configs for Claude Desktop, curl, JavaScript, and Python if your terminal of choice isn't Claude Code. Or skip the command line entirely and try the pentadecathlon yourself in the simulator.