Skip to main content
Glama

anki-mcp

An MCP server that lets AI assistants (Claude Code, Claude Desktop, and other MCP clients) manage your Anki collection — decks, note types, notes, cards, tags and media — through the AnkiConnect add-on.

It is a thin, local wrapper: each MCP tool maps to one or more AnkiConnect actions over http://127.0.0.1:8765. Nothing leaves your machine and no telemetry is collected — requests are proxied straight to your local Anki.

Unofficial project. Not affiliated with, endorsed by, or sponsored by Anki / AnkiWeb. "Anki" is a trademark of its respective owner. AnkiConnect is a separate third-party add-on. See Prior art for similar tools.

Prerequisites (one-time)

  1. Install Anki Desktop — https://apps.ankiweb.net

  2. Install the AnkiConnect add-on: Anki → Tools → Add-ons → Get Add-ons… → paste code 2055492159 → OK → restart Anki.

  3. Keep Anki Desktop running whenever you use the tools.

AnkiConnect only talks to Anki Desktop. To get cards onto your phone, use the sync tool (or Anki's own sync) and pull them in AnkiDroid via AnkiWeb.

Related MCP server: AnkiMCP Server

Install

Requires Python 3.10+.

git clone https://github.com/kazim4uk/anki-mcp.git
cd anki-mcp
python -m venv .venv

Install into the venv:

# Windows (PowerShell)
.venv\Scripts\python.exe -m pip install -e .

# macOS / Linux
.venv/bin/python -m pip install -e .

Smoke test (optional, verifies the connection)

With Anki running:

# Windows
.venv\Scripts\python.exe scripts\smoke_test.py
# macOS / Linux
.venv/bin/python scripts/smoke_test.py

Expected: AnkiConnect version: 6 and a list of your decks. With Anki closed you'll get a friendly "cannot reach AnkiConnect" message — that confirms the error handling works.

Register the server

Use the absolute path to the venv's console script (installed as anki-mcp). It works from any working directory.

  • Windows: <repo>\.venv\Scripts\anki-mcp.exe

  • macOS / Linux: <repo>/.venv/bin/anki-mcp

Claude Code

claude mcp add anki -s user -- "/absolute/path/to/anki-mcp/.venv/bin/anki-mcp"

Claude Desktop

Add to your claude_desktop_config.json (%APPDATA%\Claude\ on Windows, ~/Library/Application Support/Claude/ on macOS), then restart Claude Desktop:

{
  "mcpServers": {
    "anki": {
      "command": "/absolute/path/to/anki-mcp/.venv/bin/anki-mcp"
    }
  }
}

On Windows use the .exe and escaped backslashes, e.g. "C:\\path\\to\\anki-mcp\\.venv\\Scripts\\anki-mcp.exe".

Tools

This server exposes the complete AnkiConnect API — 100+ tools covering everything AnkiConnect can do. Grouped by category:

Connection & misc — anki_version, request_permission, list_supported_actions, sync, reload_collection, get_profiles, get_active_profile, load_profile, export_package, import_package, raw_request (escape hatch: call any AnkiConnect action directly).

Decks — list_decks, list_decks_with_ids, get_decks_for_cards, create_deck, delete_deck, move_cards, deck_stats. Deck options: get_deck_config, save_deck_config, set_deck_config_id, clone_deck_config, remove_deck_config.

Note types (models) — list_note_types, list_note_types_with_ids, find_note_types_by_id, find_note_types_by_name, note_type_fields, note_type_field_descriptions, note_type_field_fonts, note_type_fields_on_templates, create_note_type, note_type_templates, note_type_styling, update_note_type_templates, update_note_type_styling, find_and_replace_in_note_types. Structure editing: note_type_template_{rename,reposition,add,remove}, note_type_field_{rename,reposition,add,remove,set_font,set_font_size,set_description}.

Notes — add_note, add_notes, can_add_notes, find_notes, notes_info, notes_mod_time, update_note_fields, update_note, update_note_tags, get_note_tags, delete_notes, remove_empty_notes.

Tags — list_tags, add_tags, remove_tags, clear_unused_tags, replace_tag, replace_tag_in_all_notes.

Cards — find_cards, cards_info, cards_to_notes, cards_mod_time, suspend_cards, unsuspend_cards, are_suspended, are_due, get_intervals, get_ease_factors, set_ease_factors, set_card_values, forget_cards, relearn_cards, set_due_date, answer_cards.

Media — store_media_file, retrieve_media_file, list_media_files, get_media_dir_path, delete_media_file.

Statistics — cards_reviewed_today, cards_reviewed_by_day, collection_stats_html, card_reviews, get_reviews_of_cards, get_latest_review_id, insert_reviews.

GUI (drive Anki's windows) — gui_browse, gui_selected_notes, gui_add_cards, gui_edit_note, gui_current_card, gui_show_question, gui_show_answer, gui_answer_card, gui_undo, gui_deck_overview, gui_deck_browser, gui_deck_review, gui_import_file, gui_check_database, gui_exit_anki.

Every tool has a description the assistant reads, so you can just ask in plain language — e.g. "move all suspended cards in Deck A to Deck B", "create a Cloze note type called X", "reschedule these cards to be due in 3 days".

Search syntax

find_notes / find_cards use Anki's native search syntax, e.g.:

  • deck:Default

  • tag:new -is:suspended

  • deck:"My Deck" front:*hello*

Configuration

Environment variables (see .env.example) — all optional:

Variable

Default

Purpose

ANKI_CONNECT_URL

http://127.0.0.1:8765

AnkiConnect endpoint

ANKI_CONNECT_API_KEY

(none)

Only if you set an apiKey in the add-on config

ANKI_CONNECT_TIMEOUT

15

Request timeout (seconds)

Troubleshooting

  • "Cannot reach AnkiConnect" — Anki Desktop isn't running, or the add-on isn't installed. Start Anki; verify 2055492159 is under Tools → Add-ons.

  • Tool calls hang / time out — Anki is showing a modal dialog (e.g. a sync prompt). Dismiss it in Anki.

  • duplicate error on add_note — pass allow_duplicate=true, or change a field so the first field is unique.

Prior art

Several other open-source Anki MCP servers exist — worth a look if you want different trade-offs (TypeScript, read-only, extra features): ankimcp/anki-mcp-server, nailuoGG/anki-mcp-server, CamdenClark/anki-mcp-server.

Credits

Built on AnkiConnect and the Model Context Protocol.

License

MIT

Available Tools

109 tools
add_noteA

Add a single note. 'fields' maps the note type's field names to their HTML/text values (e.g. {'Front': '...', 'Back': '...'}). The deck and note type (model) must already exist. Returns the new note ID.

Inputs: deck (required), model (required), fields (required), tags, +1 more. Returns: object

add_notesA

Add many notes in one call. Each item is {'deck': str, 'model': str, 'fields': {..}, 'tags': [..]?, 'allow_duplicate': bool?}. Returns a note ID per note (null where a note could not be added, e.g. a duplicate).

Inputs: notes (required). Returns: object

add_tagsC

Add one or more tags to the given notes.

Inputs: tags (required), note_ids (required). Returns: result

anki_versionA

Health check: confirm AnkiConnect is reachable and return its API version (expected: 6). Call this first if other tools are failing.

Inputs: no named parameters. Returns: object

answer_cardsA

Programmatically answer cards as if reviewed. Each item is {'cardId': int, 'ease': 1-4} where 1=Again, 2=Hard, 3=Good, 4=Easy.

Inputs: answers (required). Returns: result

are_dueA

For each card ID, return whether it is currently due for review.

Inputs: card_ids (required). Returns: result

are_suspendedA

For each card ID, return True if suspended, False if not, null if the card does not exist.

Inputs: card_ids (required). Returns: result

can_add_notesA

Check whether notes could be added (without adding them). Same note shape as add_notes. Returns a list of booleans plus per-note error detail.

Inputs: notes (required). Returns: object

card_reviewsA

Return all review log entries for a deck made after the given review ID (a Unix-ms timestamp; use 0 for all).

Inputs: deck (required), start_id. Returns: result

cards_infoC

Get detailed info for specific card IDs (deck, fields, interval, due, ease, review count, suspended/marked state).

Inputs: card_ids (required). Returns: result

cards_mod_timeB

Get the last-modified timestamp for specific card IDs.

Inputs: card_ids (required). Returns: result

cards_reviewed_by_dayA

Return review counts per day as [date_string, count] pairs.

Inputs: no named parameters. Returns: result

cards_reviewed_todayA

Return how many cards have been reviewed so far today.

Inputs: no named parameters. Returns: object

cards_to_notesA

Map card IDs to their parent note IDs (deduplicated).

Inputs: card_ids (required). Returns: result

clear_unused_tagsA

Delete tags that are no longer used by any note.

Inputs: no named parameters. Returns: result

clone_deck_configA

Create a new options group named 'name', optionally cloned from an existing group's config ID. Returns the new config ID (or False).

Inputs: name (required), clone_from. Returns: object

collection_stats_htmlC

Return Anki's statistics report as an HTML string.

Inputs: whole_collection. Returns: object

create_deckA

Create a new deck. Use '::' in the name to create a nested subdeck (e.g. 'Languages::Romanian'). Existing decks are left untouched.

Inputs: name (required). Returns: object

create_note_typeA

Create a new note type. 'fields' are the ordered field names. 'card_templates' is a list of {'Name','Front','Back'} template dicts whose Front/Back are HTML using {{Field}} placeholders. Optional 'css' styles the cards; set is_cloze=True for a cloze-deletion type.

Inputs: fields (required), model_name (required), card_templates (required), css, +1 more. Returns: object

deck_statsB

Get review statistics (new/learning/review counts, totals) for the given deck names.

Inputs: decks (required). Returns: object

delete_deckA

Delete a deck. If cards_too is True (default) its cards are deleted as well; otherwise the cards are moved to the Default deck. Irreversible.

Inputs: name (required), cards_too. Returns: result

delete_media_fileB

Delete a file from the collection's media folder. Irreversible.

Inputs: filename (required). Returns: result

delete_notesA

Permanently delete the given notes (and all their cards). Irreversible.

Inputs: note_ids (required). Returns: result

export_packageA

Export a deck to an .apkg file at 'path'. Set include_sched=True to keep scheduling info (due dates, review history).

Inputs: deck (required), path (required), include_sched. Returns: result

find_and_replace_in_note_typesB

Find & replace text within a note type's templates/css. Toggle which parts to touch with front/back/css.

Inputs: find_text (required), model_name (required), replace_text (required), css, +2 more. Returns: object

find_cardsA

Search cards with Anki's query syntax. Returns the total count, all matching card IDs, and detailed info (deck, note, interval, due, suspended state) for up to 'limit' cards.

Inputs: query (required), limit. Returns: object

find_notesA

Search notes with Anki's query syntax (e.g. 'deck:Default tag:new'). Returns the total count, all matching note IDs, and detailed field data for up to 'limit' notes.

Inputs: query (required), limit. Returns: object

find_note_types_by_idB

Get full definitions (fields, templates, css) for note types by ID.

Inputs: model_ids (required). Returns: result

find_note_types_by_nameA

Get full definitions (fields, templates, css) for note types by name.

Inputs: model_names (required). Returns: result

forget_cardsB

Reset cards to the 'new' state (forget all review progress).

Inputs: card_ids (required). Returns: result

get_active_profileA

Return the name of the currently active Anki profile.

Inputs: no named parameters. Returns: object

get_deck_configC

Get the options/config group for a deck (new/review limits, intervals, etc.).

Inputs: deck (required). Returns: object

get_decks_for_cardsB

Given card IDs, return a map of deck name -> the card IDs it contains.

Inputs: card_ids (required). Returns: object

get_ease_factorsB

Get the ease factor (per mille, e.g. 2500) of each card.

Inputs: card_ids (required). Returns: result

get_intervalsA

Get the current interval of each card. With complete=True, returns the full list of all intervals in each card's history instead.

Inputs: card_ids (required), complete. Returns: result

get_latest_review_idB

Return the most recent review ID for a deck (0 if none).

Inputs: deck (required). Returns: object

get_media_dir_pathA

Return the absolute path of the collection's media folder.

Inputs: no named parameters. Returns: object

get_note_tagsC

Get the tags of a single note.

Inputs: note_id (required). Returns: result

get_profilesA

List the names of all Anki user profiles.

Inputs: no named parameters. Returns: result

get_reviews_of_cardsC

Return the full review history for specific card IDs.

Inputs: card_ids (required). Returns: object

gui_add_cardsA

Open Anki's Add dialog pre-filled with the given note (does not save it automatically). Returns the note ID if the user confirms.

Inputs: deck (required), model (required), fields (required), tags. Returns: object

gui_answer_cardA

Answer the current reviewer card with an ease button (1=Again, 2=Hard, 3=Good, 4=Easy).

Inputs: ease (required). Returns: result

gui_browseA

Open Anki's Card Browser filtered by 'query' and return the shown card IDs. Anki must be in the foreground to see it.

Inputs: query (required). Returns: result

gui_check_databaseB

Run Anki's 'Check Database' maintenance operation.

Inputs: no named parameters. Returns: result

gui_current_cardA

Return info about the card currently shown in the reviewer (or null).

Inputs: no named parameters. Returns: object

gui_deck_browserA

Open the main deck list screen.

Inputs: no named parameters. Returns: result

gui_deck_overviewC

Open the deck overview screen for a deck.

Inputs: name (required). Returns: result

gui_deck_reviewC

Start reviewing a deck in the GUI.

Inputs: name (required). Returns: result

gui_edit_noteB

Open the Edit dialog for a specific note.

Inputs: note_id (required). Returns: result

gui_exit_ankiA

Close Anki Desktop. AnkiConnect will be unavailable afterwards until Anki is restarted.

Inputs: no named parameters. Returns: result

gui_import_fileC

Open Anki's import dialog for the file at 'path' (e.g. a .apkg/.csv).

Inputs: path (required). Returns: result

gui_selected_notesA

Return the note IDs currently selected in the open Card Browser.

Inputs: no named parameters. Returns: result

gui_show_answerA

Show the answer side of the current reviewer card.

Inputs: no named parameters. Returns: result

gui_show_questionA

Show the question side of the current reviewer card.

Inputs: no named parameters. Returns: result

gui_undoA

Trigger an undo in the Anki GUI.

Inputs: no named parameters. Returns: result

import_packageC

Import an .apkg package file from 'path' into the collection.

Inputs: path (required). Returns: result

insert_reviewsA

Insert raw review-log rows (advanced; each row is AnkiConnect's review tuple). Mainly for migrating history.

Inputs: reviews (required). Returns: result

list_decksA

List the names of all decks in the collection.

Inputs: no named parameters. Returns: result

list_decks_with_idsA

List all decks as a map of deck name -> deck ID.

Inputs: no named parameters. Returns: object

list_media_filesA

List media file names, optionally filtered by a glob pattern (e.g. '*.mp3').

Inputs: pattern. Returns: result

list_note_typesA

List all note type (model) names, e.g. 'Basic', 'Cloze'.

Inputs: no named parameters. Returns: result

list_note_types_with_idsA

List all note types as a map of model name -> model ID.

Inputs: no named parameters. Returns: object

list_supported_actionsA

List every AnkiConnect action supported by the running Anki/add-on version (via apiReflect). Useful to discover capabilities or debug.

Inputs: no named parameters. Returns: result

list_tagsA

List every tag used anywhere in the collection.

Inputs: no named parameters. Returns: result

load_profileC

Switch Anki to the given user profile.

Inputs: name (required). Returns: result

move_cardsA

Move the given cards to another deck. The target deck is created automatically if it does not exist. Note: in Anki you move cards, not notes — get card IDs from find_cards, or from the cards field returned by find_notes.

Inputs: deck (required), card_ids (required). Returns: result

notes_infoA

Get detailed info (fields, tags, model, cards) for specific note IDs.

Inputs: note_ids (required). Returns: result

notes_mod_timeB

Get the last-modified timestamp for specific note IDs.

Inputs: note_ids (required). Returns: result

note_type_field_addC

Add a new field to a note type, optionally at a 0-based index.

Inputs: field_name (required), model_name (required), index. Returns: result

note_type_field_descriptionsB

List each field's description (placeholder text) for a note type.

Inputs: model_name (required). Returns: result

note_type_field_fontsA

Return the editor font and size configured for each field of a note type.

Inputs: model_name (required). Returns: object

note_type_field_removeA

Remove a field from a note type. Irreversible (data in it is lost).

Inputs: field_name (required), model_name (required). Returns: result

note_type_field_renameB

Rename a field of a note type.

Inputs: new_name (required), old_name (required), model_name (required). Returns: result

note_type_field_repositionC

Move a field to a new position (0-based index).

Inputs: index (required), field_name (required), model_name (required). Returns: result

note_type_fieldsA

List the field names of a note type, in order (e.g. Basic -> ['Front', 'Back']). Use this before add_note to supply the right fields.

Inputs: model_name (required). Returns: result

note_type_field_set_descriptionC

Set the description (placeholder text) of a field.

Inputs: field_name (required), model_name (required), description (required). Returns: result

note_type_field_set_fontC

Set the editor font of a field.

Inputs: font (required), field_name (required), model_name (required). Returns: result

note_type_field_set_font_sizeC

Set the editor font size of a field.

Inputs: font_size (required), field_name (required), model_name (required). Returns: result

note_type_fields_on_templatesA

Return, per card template, which fields appear on the front and back.

Inputs: model_name (required). Returns: object

note_type_stylingB

Return the CSS styling of a note type.

Inputs: model_name (required). Returns: object

note_type_template_addB

Add a card template to a note type. 'template' is {'Name','Front','Back'}.

Inputs: template (required), model_name (required). Returns: result

note_type_template_removeB

Remove a card template from a note type. Irreversible.

Inputs: model_name (required), template_name (required). Returns: result

note_type_template_renameB

Rename a card template within a note type.

Inputs: new_name (required), old_name (required), model_name (required). Returns: result

note_type_template_repositionB

Move a card template to a new position (0-based index).

Inputs: index (required), model_name (required), template_name (required). Returns: result

note_type_templatesC

Return the card templates (Front/Back HTML) of a note type.

Inputs: model_name (required). Returns: object

raw_requestA

Escape hatch: call ANY AnkiConnect action by name with raw params. Use only when no dedicated tool covers what you need (e.g. a brand-new AnkiConnect action). 'params' must match AnkiConnect's exact keys.

Inputs: action (required), params.

relearn_cardsC

Put the given cards into the relearning queue.

Inputs: card_ids (required). Returns: result

reload_collectionA

Tell Anki to reload the collection from disk.

Inputs: no named parameters. Returns: result

remove_deck_configA

Remove an options group by its config ID (decks using it revert to the default group).

Inputs: config_id (required). Returns: result

remove_empty_notesA

Delete all notes that have no cards (empty notes). Irreversible.

Inputs: no named parameters. Returns: result

remove_tagsC

Remove one or more tags from the given notes.

Inputs: tags (required), note_ids (required). Returns: result

replace_tagC

Rename a tag on the given notes (replace old_tag with new_tag).

Inputs: new_tag (required), old_tag (required), note_ids (required). Returns: result

replace_tag_in_all_notesB

Rename a tag across the ENTIRE collection (replace old_tag with new_tag on every note).

Inputs: new_tag (required), old_tag (required). Returns: result

request_permissionA

Ask AnkiConnect whether this client is permitted to make requests. Returns the permission status (and requires user approval in Anki the first time if an origin allow-list is configured).

Inputs: no named parameters. Returns: object

retrieve_media_fileA

Retrieve a media file's contents as base64 (or false if not found).

Inputs: filename (required). Returns: object

save_deck_configA

Save a modified deck options group. Pass a config object previously obtained from get_deck_config with your changes applied.

Inputs: config (required). Returns: result

set_card_valuesA

Advanced: set specific low-level fields of one card (parallel keys/ values lists). Use with care — writing raw card properties can corrupt scheduling if misused.

Inputs: keys (required), card_id (required), new_values (required). Returns: result

set_deck_config_idC

Assign the given decks to an existing options group by its config ID.

Inputs: decks (required), config_id (required). Returns: result

set_due_dateA

Reschedule cards to be due in 'days'. 'days' is Anki's set-due-date spec: '0' = today, '3' = in 3 days, '1-7' = random within a range, add '!' (e.g. '3!') to also reset the interval to that value.

Inputs: days (required), card_ids (required). Returns: result

set_ease_factorsA

Set the ease factor of each card (parallel lists). Ease is per mille, e.g. 2500 = 250%.

Inputs: card_ids (required), ease_factors (required). Returns: result

store_media_fileA

Store a media file (image/audio) in the collection's media folder so it can be referenced from a note, e.g. '[sound:word.mp3]' or ''. Provide exactly one source: a local 'path', a 'url' to download, or base64 'data_b64'. Returns the stored filename.

Inputs: filename (required), url, path, data_b64, +1 more. Returns: object

suspend_cardsB

Suspend the given cards so they stop appearing in reviews.

Inputs: card_ids (required). Returns: result

syncA

Sync the local collection with AnkiWeb (so changes reach AnkiDroid / other devices). Requires AnkiWeb login configured in Anki Desktop.

Inputs: no named parameters. Returns: result

unsuspend_cardsA

Unsuspend the given cards so they return to the review queue.

Inputs: card_ids (required). Returns: result

update_noteA

Update fields and/or the full tag set of a note in one call. Pass 'fields' to change fields and/or 'tags' to REPLACE the note's tags.

Inputs: note_id (required), tags, fields. Returns: result

update_note_fieldsB

Update one or more fields of an existing note. Only the fields you pass are changed; omitted fields keep their current values.

Inputs: fields (required), note_id (required). Returns: result

update_note_tagsB

Replace the entire tag set of a note with 'tags'.

Inputs: tags (required), note_id (required). Returns: result

update_note_type_stylingC

Replace the CSS styling of a note type.

Inputs: css (required), model_name (required). Returns: result

update_note_type_templatesC

Update card templates of a note type. 'templates' maps template name -> {'Front': html, 'Back': html}.

Inputs: templates (required), model_name (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 109 tools

    Disambiguation5/5

    Each tool targets a distinct operation with clear descriptions, making it easy for an agent to distinguish between them. Even similar tools like 'add_note' and 'add_notes' are differentiated by batch size and return values.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern in snake_case, such as 'add_note', 'list_decks', 'suspend_cards'. There is no mixing of cases or irregular naming.

    Tool Count1/5

    With 109 tools, the server far exceeds reasonable scope, overwhelming agents with an extreme number of micro-operations. Many tools (e.g., individual note type field manipulations) could be consolidated.

    Completeness5/5

    The tool set covers nearly all aspects of Anki: note, card, deck, media, GUI, statistics, synchronization, and advanced operations. Only minor gaps exist, such as missing hierarchical deck management or copying cards.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables interaction with the Anki desktop flashcard application through the Anki-Connect plugin. Supports managing decks, cards, notes, and models, allowing AI assistants to create and query flashcards through natural language.
      10 npm
      1
      ISC
    • F
      license
      Not graded
      quality
      A
      maintenance
      Exposes Anki flashcard collections to AI assistants via MCP, enabling AI-powered study sessions, card creation, deck management, and review workflows. Supports comprehensive collection operations including search, media management, and note type customization.
      102
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that enables AI assistants to seamlessly manage Anki flashcards, decks, and templates through the AnkiConnect API. It supports intelligent querying, batch note creation, and detailed study progress analysis using natural language.
      4
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides programmatic access to Anki flashcard operations through the AnkiConnect API, allowing users to list and create decks and cards. It enables seamless management of flashcards directly from MCP-compatible clients like Claude Desktop.
      -