Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

anki-mcp

An MCP server that gives Claude Code direct access to a running Anki instance. The goal is to automatically generate flashcards from study materials (PDFs, Markdown, notebooks) and sort them into Anki decks — without any manual copying or formatting.

The included /anki-erstellen skill orchestrates the entire workflow: reading files, deriving the deck structure, detecting duplicates, creating cards, and tracking already-processed files.


Tools

Tool Description
anki_list_decks Lists all available Anki decks.
anki_add_notes Adds one or more cards to a deck. Supports Markdown (bold, italic, tables, code, MathJax) and optional media attachments (image, audio, video).
anki_get_deck_notes Returns all existing cards in a deck (including sub-decks) — used to avoid duplicates before creating new cards.
anki_get_processed_files Returns the list of files in a directory that have already been converted to Anki cards.
anki_mark_files_processed Marks files as processed so they are skipped in future runs.

Requirements

Anki with AnkiConnect

  1. Install and open Anki.
  2. In Anki: Tools → Add-ons → Get Add-ons → enter code 2055492159 → Install → restart Anki.
  3. AnkiConnect then listens on http://localhost:8765. Anki must be running whenever the MCP server is used.

Python environment

Requires Python ≥ 3.13. Install dependencies:

uv sync

Adding to Claude Code

Via CLI

claude mcp add anki -- uv run --directory /path/to/anki-mcp python server.py

To register it globally (available in all projects):

claude mcp add --scope user anki -- uv run --directory /path/to/anki-mcp python server.py

Via settings.json

Add the server to ~/.claude/settings.json (global) or .claude/settings.json (project-local):

{
  "mcpServers": {
    "anki": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/anki-mcp", "python", "server.py"]
    }
  }
}

Adjust the path, then restart Claude Code. The anki_* tools will be available in every session.


Skill /anki-erstellen

The skill at .claude/commands/anki-erstellen.md guides Claude through the full workflow:

  1. Read all files in the current directory (skip already-processed ones)
  2. Derive the deck name from the directory path (Bachelor::Semester 2::ModuleName)
  3. Check existing cards to avoid duplicates
  4. Create cards organized in thematic sub-decks
  5. Mark processed files as done
  6. Print a summary report

Run it from your study directory:

/anki-erstellen

Or with an explicit deck name:

/anki-erstellen Master::Semester 1::Statistics::Distributions

About

MCP server for Claude Code that automatically generates Anki flashcards from study materials via AnkiConnect.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages