Anki MCP Server

v2.0.0
io.github.arielbk/anki-mcp Checked 9 hours ago Published 2 days ago

MCP server for integrating with Anki flashcards through conversational AI

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

manage_flashcards Manage flashcards

Create, search, inspect, edit, tag and delete Anki notes (flashcards) in the local collection via AnkiConnect. Use this for card content; use manage_decks for deck structure/limits, manage_models for note-type fields and templates, and manage_scheduling for review state (due cards, answering, suspend/unsuspend). For guidance on writing effective cards, use the "writing_good_flashcards" prompt. Operations (set `operation`, then the listed parameters): - create: add one note. Needs deckName, modelName, fields; optional tags, allowDuplicate, duplicateScope. Writes immediately. - create_batch: ad…

ParameterTypeDescription
operation *stringWhich operation to run; see the tool description for required parameters
allowDuplicatebooleancreate/create_batch: add notes even if the first field duplicates an existing note (default false)
cardIdsarrayget_info: card IDs (max 50)
chunkSizeintegercreate_batch: notes per AnkiConnect request (default 10)
deckNamestringcreate: target deck (required). create_batch: default deck for notes without their own deckName
dryRunbooleancreate_batch: validate every note and report problems without writing anything. add_tags/remove_tags: report how many notes match (and sample IDs) without changing them. Rejected for other operations
duplicateScopestringcreate/create_batch: where to look for duplicates: "collection" (default) or only the target "deck"
fieldsobjectcreate/update: field name -> value (HTML allowed). Names must match the note type, e.g. { "Front": "...", "Back": "..." }
filePathstringcreate_batch: absolute path to a .json (array of notes like `notes`), .csv or .tsv file. CSV/TSV: header row = field names, plus optional "tags" (space-separated), "deck" and "model" columns. Use inst…
formatstringfind: "lines" (default, one line per note/group) or compact single-line JSON
groupBystringfind: return counts per tag/deck/model ({notes, cards, new, seen}) or per scheduling state, over ALL matches, instead of a listing
includearrayfind: what each listed note carries (default ["fields"]; [] = IDs only). fields = field text (HTML stripped, truncated), tags, deck, model, state = per-card queue/interval/due/reps/lapses/ease, cards…
includeDetailsbooleanfind: shorthand for include: all of fields, tags, deck, model, state, cards
limitintegerfind: max notes per page (default 50)
maxFieldCharsintegerfind: truncate each field to this many characters (default 120; 0 = no limit)
modelNamestringcreate: note type (required), e.g. "Basic". create_batch: default note type for notes without their own. Use manage_models list for field names
noteIdnumberupdate: ID of the note to change
noteIdsarraydelete/add_tags/remove_tags: note IDs to act on (add_tags/remove_tags: or use query)
notesarraycreate_batch: notes to add (or use filePath instead)
offsetintegerfind: notes to skip, for paging (default 0); use the returned next offset
querystringfind (and add_tags/remove_tags instead of noteIds): Anki search query, e.g. 'deck:"Spanish" tag:verbs', "is:new", "rated:2:1" (answered Again in the last 2 days), "prop:ivl>=21"
tagsarraycreate: tags for the note. create_batch: added to every note. update: replaces the note's tags. add_tags/remove_tags: tags to add/remove

manage_scheduling Manage scheduling and review state

Run a quiz and change review state (answer, suspend, unsuspend, reset, relearn, reposition new cards) in the local Anki collection. Use this to get due card IDs and act on them; use manage_decks get_stats for due counts, get_analytics for progress and history, and manage_flashcards to edit card content. Operations: - find_due: read-only; the IDs of matching cards due now, for running a quiz (not counts). Needs query (Anki search syntax, e.g. "deck:Spanish"). - check_status: read-only. Needs cardIds; returns due/suspended flags per card. - answer: records reviews, as if answered in Anki. Needs…

ParameterTypeDescription
operation *stringWhich operation to run; see the tool description for required parameters
answersarrayanswer: one entry per reviewed card
cardIdsarraycheck_status (required), or suspend/unsuspend/forget/relearn/reposition instead of query: card IDs (not note IDs). For reposition, the order of this array is the new queue order
dryRunbooleansuspend/unsuspend/forget/relearn: report how many cards match (and sample IDs) without changing anything. reposition: list each card's planned position without writing. Rejected for other operations
querystringfind_due (required), or suspend/unsuspend/forget/relearn/reposition instead of cardIds: Anki search query, e.g. 'deck:"Spanish"' or "tag:verbs is:due". The server finds the cards, so thousands of card…
shiftbooleanreposition: push other new cards at or after start down so positions don't collide (like Anki's "Shift position of existing cards"). Default false: ties are broken by card ID
startintegerreposition: position of the first card. Default: the lowest position among new cards in the affected decks (the front of the queue)
stepintegerreposition: gap between consecutive positions (default 1)

manage_decks Manage decks

Create, list, inspect, configure, rename and delete Anki decks, and move cards between them. Use this for deck organization and per-deck daily limits; use manage_flashcards for card content. To suspend/unsuspend cards (e.g. pause a deck), use manage_scheduling. Operations: - list: read-only; all deck names and IDs. - create: needs deckName (use "Parent::Child" for subdecks). Optional newPerDay and/or reviewsPerDay give the new deck its own daily limits (see set_limits). Does nothing if the deck already exists. - set_limits: needs deckName plus newPerDay and/or reviewsPerDay. Changes daily lim…

ParameterTypeDescription
operation *stringWhich operation to run; see the tool description for required parameters
cardIdsarraymove_cards: card IDs to move (or use query)
configIdnumberset_config: ID of an existing options preset (see get_config)
deckNamestringcreate/rename/set_limits/set_display_order/get_stats/get_config: deck name; use "Parent::Child" for subdecks
deckNamesarraydelete/set_config: deck names to act on. get_stats: several decks at once
deleteCardsbooleandelete: must be true or omitted; AnkiConnect always deletes a deck together with its cards
dryRunbooleanmove_cards only: report how many cards match, from which decks, without moving them. Rejected for other operations
interdayLearningMixstringset_display_order: when interday learning cards show relative to reviews
newGatherOrderstringset_display_order: which new cards are gathered for today
newNamestringrename: the new deck name (subdecks follow)
newPerDayintegercreate/set_limits: max new cards per day for this deck only
newReviewMixstringset_display_order: when new cards show relative to reviews
newSortOrderstringset_display_order: how gathered new cards are ordered
querystringmove_cards: Anki search query selecting the cards to move instead of cardIds, e.g. 'deck:"Old" tag:verbs'
rawbooleanget_config: true returns the full preset JSON instead of the summary
requireEmptybooleandelete: refuse (and delete nothing) if any of the decks has cards
reviewOrderstringset_display_order: order of review cards
reviewsPerDayintegercreate/set_limits: max reviews per day for this deck only
targetDeckstringmove_cards: destination deck (created if missing)

get_analytics Study analytics

Read-only progress and review history from the local Anki collection ("how am I doing?", "what am I failing?", "how much have I studied?"), aggregated server-side into compact JSON or one line per row. For today's due counts per deck use manage_decks get_stats; for due card IDs, manage_scheduling find_due. To act on the findings, use manage_scheduling or manage_flashcards. Scopes (set `scope`, then the listed parameters). deckName always includes subdecks; where optional, omitting it means the whole collection: - deck_overview: progress and health of one deck ("how am I doing on this deck?").…

ParameterTypeDescription
scope *stringWhich statistics to read; see the tool description for required parameters
cardIdsarraycard_details: card IDs
daysintegercollection_stats: forecast length (default 14, max 90); reviews_by_day: days back incl. today (default 30); deck_overview: stats window (default 30); trouble_cards: window (default 7)
deckNamestringDeck (includes subdecks). Required for deck_overview, card_reviews; optional filter for collection_stats, reviews_by_day, trouble_cards (omit = whole collection)
limitintegertrouble_cards: worst cards listed (default 10); deck_overview: top tags (default 10); card_reviews: max rows before summarizing (default 300)
sincestringreviews_by_day: start date YYYY-MM-DD (overrides days)
startTimestampnumbercard_reviews: only reviews after this review ID (epoch milliseconds), e.g. Date.now() - 7 days
wholeCollectionbooleanDeprecated and ignored; collection_stats uses deckName (omit for all decks)

manage_models Manage note types

List and modify Anki note types (models): fields, card templates and CSS. Use list before creating notes to find a note type's exact field names (e.g. "Front"/"Back"); use manage_flashcards for note content. Operations: - list: read-only; every note type with its ID and ordered field names. - create: needs modelName, fields (ordered names) and templates ([{ Front, Back }]); optional css, isCloze. - add_field: needs modelName, fieldName, fieldIndex. - remove_field: needs modelName, fieldName. Deletes that field's content from every note of this type (destructive). - rename_field: needs modelNa…

ParameterTypeDescription
operation *stringWhich operation to run; see the tool description for required parameters
cssstringcreate/update_styling: CSS for the card templates
fieldIndexnumberadd_field: 0-based position for the new field
fieldNamestringadd_field/remove_field/rename_field: field name (current name for rename)
fieldsarraycreate: field names in order
isClozebooleancreate: make a cloze deletion note type
modelNamestringNote type name (all operations except list), e.g. "Basic"
newFieldNamestringrename_field: new field name
templateobjectadd_template: template to add, { Front, Back } HTML
templateNamestringremove_template: template name, e.g. "Card 1"
templatesarraycreate: card templates, e.g. [{ Front: "{{Front}}", Back: "{{FrontSide}}<hr id=answer>{{Back}}" }]

manage_collection Manage collection: sync, packages, media

Collection maintenance for the Anki app: AnkiWeb sync, version check, .apkg import/export, profiles, and media files. Use this for maintenance tasks that are not about card content, decks, note types or reviews. To read a media file's contents (e.g. view an image), use get_media_file. Operations: - version: read-only; AnkiConnect version (also a quick "is Anki running?" check). - get_profiles: read-only; profile names. - sync: syncs the collection with AnkiWeb (network; may upload or download changes). - export_deck: needs deckName and filePath (.apkg path to write); optional includeSched. Wr…

ParameterTypeDescription
operation *stringWhich operation to run; see the tool description for required parameters
deckNamestringexport_deck: deck to export
filePathstringexport_deck: .apkg path to write. import_package: .apkg path to read
filenamestringstore_media/retrieve_media/delete_media: media file name, e.g. "cat.png"
includeSchedbooleanexport_deck: include review history and scheduling (default false)
mediaDatastringstore_media: base64 file contents (or use mediaUrl)
mediaUrlstringstore_media: URL Anki downloads the file from (or use mediaData)
patternstringlist_media: glob pattern, e.g. "*.png" or "*"

get_media_file Get media file contents

Read one file from Anki's media folder and return it as base64; images are also returned as image content the model can look at. Read-only. Use this when you need a referenced image/audio file's actual contents; use manage_collection list_media to find file names and store_media/delete_media to change files. Pass the bare filename as it appears in the card (e.g. "diagram.png"); paths and ".." are rejected. Returns an error object if the file doesn't exist.

ParameterTypeDescription
filename *stringBare media file name as referenced in a card, e.g. "image.png" (no paths)

control_gui Control the Anki app UI

Drive the Anki desktop application's user interface: open windows and dialogs (Card Browser, Add Cards, Edit Note, deck overview, import), run an on-screen review session, and read what the user currently has selected or on screen. Use this when the user wants to see or act on something inside the Anki app itself; use `manage_flashcards` (and the other non-GUI tools) for headless reads and writes, which are faster and do not disturb the user's windows. Side effects: every operation except `current_card` and `selected_notes` changes what is shown in Anki. `answer_card` records a review and res…

ParameterTypeDescription
operation *stringThe GUI action to perform. See the tool description for what each one does.
cardIdintegerCard ID. Required for select_card.
deckNamestringDeck name. Required for add_cards, deck_overview and deck_review.
easeintegerReview grade: 1 Again, 2 Hard, 3 Good, 4 Easy. Required for answer_card.
fieldsobjectField name to value map used to pre-fill the note, e.g. {"Front": "...", "Back": "..."}. Required for add_cards.
filePathstringAbsolute path of the file to import (.apkg, .colpkg, .txt, .csv, ...). Required for import_file.
modelNamestringNote type (model) name, e.g. "Basic". Required for add_cards.
noteIdintegerNote ID. Required for edit_note; select_note passes it on as a card ID.
querystringAnki search query (https://docs.ankiweb.net/searching.html), e.g. "deck:Spanish is:due". Required for browse.
reorderCardsobjectOptional sort order for the Card Browser. Used by browse.
tagsarrayTags to pre-fill. Optional for add_cards.