MTG Commander AI
A conversational agent that builds and tunes full 100-card Commander decks by calling a live MCP tool server over 33,000+ constantly-changing Magic cards, tournament results, and 10+ podcast and YouTube shows.
Why this exists
A friend of mine, Wes, was building a homebrew Magic: The Gathering cube by hand. He had 10 defined archetypes and a card list, but no easy way to check whether his black-green reanimator support was actually deep enough or just felt deep. Commander deckbuilding has the same problem at a bigger scale. EDHREC gives you popularity data, not the reasoning a good player would give you for why a specific card fits your specific 99. mtgcommander.ai is a conversational assistant that reads real card data (33K+ Scryfall cards) and real expert reasoning (transcript chunks from 10+ podcast and YouTube shows), builds full Commander decks against a stated budget and bracket, and hands the actual purchase off to Mana Pool through an affiliate link. It runs as a live, free product today, not a prototype. I tried a paid subscription tier first, couldn’t find a version of it worth charging for, and pivoted to Patreon after a couple of months, so it’s funded now by Patreon and Ko-fi support instead of a paywall.
Architecture
One box-wall diagram can’t hold this system honestly, so here it is as the four flows it actually runs, plus the operations layer that keeps a one-person product alive: a chat turn, the inside of a deck build, the handoff from deck to real cart, the knowledge pipeline behind it all, and how the whole thing watches itself in production.
The chat agent loop
A chat turn is an agent loop: the SvelteKit server runs the Vercel AI SDK with Claude Sonnet as the chat model (a failover model and a per-request bake-off override are each a single env flip), and the model works the FastMCP tool surface, the same tools any MCP client could call directly. Which tools the model even sees is decided per turn by a workflow state machine informed by the 293-call usage audit: paste in a 30-card list and it detects a net-deck import and swaps in the orient/swap/buylist tools; ask a fresh question and those stay out of the model’s way. Every card name in the streamed answer is resolved against the real catalog before the reader sees it: the fabrication gate from the skill stories below.
Inside a deck build
build_commander_deck is a staged engine, not one model call. The LLM owns the two genuinely creative stages, reading the thesis and choosing the specific cards that serve it, and deterministic code owns the solved problems: structural role counts from YAML package templates, declared-minimum conformance enforced through an explicit swap plan, a mana base audited pip-by-pip against the colors the deck actually needs, and a fabrication gate that refuses any card name that doesn’t resolve in the catalog. Every stage reports its own status into the build metadata, so a degraded stage is visible in the result instead of silently swallowed.
From deck to cart: the Mana Pool handoff
When a reader clicks Buy, the deck goes to Mana Pool’s cart optimizer for live pricing and availability (if a printing is out of stock, the request retries with it dropped instead of failing the whole cart), then through deck validation (legality, color identity, quantities) and comes back as a pre-filled cart URL carrying my affiliate ref. Payment completes on Mana Pool; there is no payment surface in this app at all. The engine can also build against a constrained pool, a single seller’s inventory or the user’s own collection, so the deck it hands over is actually fulfillable. That affiliate cut, plus Patreon and Ko-fi support, is the entire business model: the product is free forever, and the support links live on a support page, not in this pipeline.
The knowledge pipeline (offline)
Everything the agent knows arrives through a batch pipeline, deliberately not real time: validating a new insight against a card’s oracle text before a user can see it matters more than shipping it a few minutes faster. Scryfall card data refreshes on a nightly cron and the ops audit auto-heals any gaps it finds; transcripts go through Whisper, then a Claude extraction pass that discards noise and pulls card-linked insights, then the oracle-text validator that flagged 8,380 hallucinated mechanic claims across the backfill and now gates every new insight the same way. It all lands in the one Supabase Postgres database: cards, insights, embeddings, decks, and conversations together, not a separate vector store.
Production operations
This is the part that doesn’t demo well but matters most: the product runs itself like a team several times its size. Every PR passes CodeRabbit’s assertive review profile and CI before Railway deploys the two services, and production ships structured logs to Axiom with a dead-man heartbeat so even a dead logger gets noticed. Then the watchers take over. A nightly ops audit checks catalog completeness against Scryfall and auto-heals gaps, has a small model read the previous day’s conversations and file deduplicated GitHub issues for real failures (that audit is where the fabrication-gate work came from), and scans Axiom for error clusters. An hourly synthetic probe runs a scripted conversation end to end, and deck-quality evals run nightly with an LLM-judged scorecard three times a week. Everything reports to a Discord alerts channel I actually read, every cron pings Healthchecks.io, and the issues the audit files feed straight back into the spec queue.
What shipped
By spec 164 the platform had grown from a favor for Wes’s cube into a real free product: a Mana Pool affiliate checkout handoff, a small Discord seeded from a card-marketplace partner, and a knowledge base that validates itself before storing anything new. The hallucination cleanup alone put 33,040 insight-card pairs through oracle-text validation, flagging 8,380 hallucinated mechanic claims, and left the extraction pipeline validating every new insight against oracle text before storage, not just the backfill. The tool-routing audit replaced guesswork with 293 real tool calls across 50 conversations, consolidating or rerouting 12 tools that had 0 calls in the sample. All of these fixes came out of the same spec, plan, tasks, and research loop with Claude Code, not a rewrite from scratch.
The extraction pipeline still runs as a batch process, not real time. That’s deliberate: validating a new insight against a card’s oracle text before it ever reaches a user matters more than shipping it a few minutes faster.