A Chrome extension that lets Magic: The Gathering players collect cards from popular MTG websites into a shopping list for Mana Pool.
- Scryfall (scryfall.com) — Card detail pages and search results
- EDHREC (edhrec.com) — Commander recommendations and card pages
- BotBox (botbox.dev) — Pack simulator cards
- Mana Pool (manapool.com) — Card listings and browse pages
- Toggle buttons on card images across all supported sites — hover to show, click to add/remove
- Floating overlay panel with your shopping list, quantity controls, and running price total
- Live pricing from Mana Pool API with Scryfall fallback, including foil and etched variants
- Foil support — toggle foil per card, auto-detected for foil-only printings
- Sorting — by recently added, alphabetical, or price
- Mass entry export — copies your list in Mana Pool format and auto-pastes into manapool.com/add-deck
- Card links — click any card name to go directly to its Mana Pool listing
- Card image tooltips — hover over card names to preview the card
- Persistent storage via
chrome.storage.localacross sessions - MTG-themed UI — gold and mahogany design with Cinzel font
| Scryfall | EDHREC |
|---|---|
![]() |
![]() |
| BotBox | Menu |
|---|---|
![]() |
![]() |
- Download
manadrain-chrome.zip(ormanadrain-firefox.zip) from the latest release - Unzip it to a folder on your computer
- Open Chrome and go to
chrome://extensions/ - Enable Developer mode (toggle in top-right)
- Click Load unpacked and select the unzipped folder
- Visit any supported site and start collecting cards
- Clone this repository:
git clone https://github.com/nsluke/manadrain.git cd manadrain - Install dependencies and build:
This writes two unpacked extensions:
npm install npm run build
dist-chrome/anddist-firefox/. - Open Chrome and go to
chrome://extensions/ - Enable Developer mode (toggle in top-right)
- Click Load unpacked and select the
dist-chrome/folder
For Firefox, open about:debugging → This Firefox → Load Temporary Add-on
and pick dist-firefox/manifest.json. Firefox 128 or newer is required (the
BotBox integration relies on MAIN-world content scripts).
- Browse to any supported MTG site
- Hover over a card image to see the + button
- Click to add it to your list (click again to remove)
- Click the floating ⬣ button (bottom-right) to expand your shopping list
- Toggle foil, adjust quantities, sort your list
- Click Buy on TCGPlayer to copy your list and open TCGPlayer's Mass Entry page
- Or use Export in the popup for CSV, Forge, MTGO, XMage, Arena, or a print-and-play PDF sheet
The Copy for Mana Pool and Open Mana Pool buttons are disabled pending Mana Pool mass-entry support.
npm run build # Build both dist-chrome/ and dist-firefox/
npm run build:chrome # Chrome only
npm run build:firefox # Firefox only
npm run watch # Rebuild dist-chrome/ on file changes
npm run typecheck # Type-check without emitting
npm test # Unit + DOM tests (fast, no browser)
npm run test:e2e # End-to-end in real Chrome and Firefox
npm run test:all # typecheck + unit + e2eThree layers:
| Layer | Command | What it covers |
|---|---|---|
| Unit / DOM | npm test |
Pure logic plus content scripts against a simulated DOM. Runs the message-passing paths twice — once with Chrome's promise-based chrome.*, once with Firefox's promise browser.* + callback-style chrome.* — so cross-browser API bugs surface without a browser. |
| E2E Chrome | npm run test:e2e:chrome |
Real Chromium with the extension loaded: injection, storage, badge, popup sync, print page, XSS and permission checks. |
| E2E Firefox | npm run test:e2e:firefox |
Real Firefox with the extension installed as a temporary add-on: injection and the full content script → background → storage → overlay round trip. |
Both E2E suites are hermetic — every request is served from a local fixture and anything escaping to the real network fails the run. Site pages are served on the real hostnames (via request interception in Chrome, a local proxy in Firefox) because the manifest only injects on those origins.
Firefox notes: extensions need the full dist-firefox build packaged as an XPI,
which test:e2e:firefox does automatically. Geckodriver refuses to navigate to
moz-extension:// URLs, so the popup and print pages are not driven in Firefox;
their behaviour under Firefox's API shape is covered by the dual-shape unit
tests instead.
After rebuilding, reload the extension in chrome://extensions/.
src/
service-worker.ts # Background: message routing, storage, badge, pricing
content-scripts/
overlay.ts # Shadow DOM floating panel (shared across all sites)
scryfall.ts # Scryfall card detection + toggle buttons
edhrec.ts # EDHREC card detection
botbox.ts # BotBox card detection (ISOLATED world)
botbox-bridge.ts # BotBox data bridge (MAIN world)
manapool.ts # Mana Pool card detection + mass entry auto-paste
shared/
types.ts # CardEntry type, ID generation, mass entry formatting
storage.ts # chrome.storage.local wrapper for persistent data
manapool-api.ts # Mana Pool + Scryfall pricing pipeline
checkmark-state.ts # Persistent button state for re-rendering sites
popup/
popup.html/ts/css # Extension popup UI
- TypeScript
- Chrome Extension Manifest V3
- esbuild
- Vitest
- Vanilla DOM (no frameworks)



