Skip to content

About

MTG card scanner using local AI (Ollama), Scryfall API, FastAPI + React

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

MTG Card Scanner

Web app to scan Magic: The Gathering cards with a laptop or phone camera, identify them using local AI (Ollama), look them up on Scryfall, and store them in a local collection database compatible with Archidekt.

Works on desktop and mobile browsers — no cloud AI required.


Requirements

  • Python 3.12+
  • Node.js 18+
  • Ollama installed and running
  • Git

Quick Start

1. Clone the repo

git clone https://github.com/cflury/mtg-scanner.git
cd mtg-scanner

2. Run setup (installs everything + pulls moondream2)

setup.bat

This will:

  • Install frontend npm packages
  • Create a Python virtual environment
  • Install Python dependencies
  • Pull the moondream2 vision model via Ollama

3. Start the app

start.bat

Opens two terminal windows (backend + frontend) and launches http://localhost:5173 in your browser.


Usage

Scanner Tab

  1. Allow camera access when prompted
  2. Toggle Front / Rear camera as needed
  3. Hold a card up to the camera viewfinder
  4. Click Scan Card
  5. Review the match (card image, name, set, rarity)
  6. Adjust quantity/condition/finish, then click Add to Collection

Collection Tab

  • Search by name
  • Filter by rarity or color
  • Export your collection as an Archidekt-compatible CSV
  • Import an existing Archidekt CSV (bulk import)

Import Existing Collection

If you already have an Archidekt export, import it via the Collection tab → Import CSV button, or run directly:

cd backend
venv\Scripts\python.exe importer.py "C:\path\to\your\archidekt-export.csv"

Architecture

Frontend (React + Tailwind, port 5173)
    ↕ /api/* (proxied by Vite)
Backend  (FastAPI, port 8000)
    ↕                    ↕
SQLite DB          Ollama (local)
                  moondream2 — card vision
                  qwen2.5:7b — text tasks
    ↕
Scryfall API (card metadata, images)

Tech Stack

Layer Technology
Backend FastAPI, SQLAlchemy, SQLite
Vision AI Ollama moondream2
Text AI Ollama qwen2.5:7b
OCR fallback EasyOCR
Card data Scryfall REST API
Frontend React, TypeScript, Tailwind CSS, Vite

Mobile Access

While running locally, other devices on the same WiFi can access the app at:

http://<your-local-ip>:5173

Find your local IP with ipconfig (look for IPv4 under your WiFi adapter).

Camera access on mobile requires HTTPS or localhost. For full mobile support, consider running behind a local reverse proxy with a self-signed cert.


Ollama Models

ollama pull moondream2    # Vision recognition (~1.7 GB)
ollama pull qwen2.5:7b    # Text tasks (~4.4 GB) — likely already installed

About

MTG card scanner using local AI (Ollama), Scryfall API, FastAPI + React

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages