MCP-AnkiConnect
The MCP-AnkiConnect server integrates Claude conversations with Anki's spaced repetition system for flashcard management.
Check Due Cards: Get the count of cards due for review, optionally filtered by deck
List Decks and Notes: Retrieve available decks, note types, and their fields
Get Examples: Fetch sample notes to guide flashcard creation, with options to filter by recency, performance, etc.
Fetch Due Cards: Retrieve cards due for learning, with options to filter by deck and time period
Submit Reviews: Rate reviewed cards as "wrong", "hard", "good", or "easy"
Add Notes: Create new flashcards by specifying deck, note type, fields, and optional tags
Connects to Anki via AnkiConnect to enable flashcard management, including retrieving due cards, submitting reviews, adding new cards, and accessing deck information for spaced repetition learning.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP-AnkiConnect Let's go through today's flashcards"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-ankiconnect MCP server
Connect Claude conversations with AnkiConnect via MCP to make spaced repetition as easy as "Let's go through today's flashcards" or "Make flashcards for this"
Components
Tools
The server implements the following tools:
num_cards_due_today: Get the number of cards due todayOptional
deckargument to filter by specific deckReturns count of due cards across all decks or specified deck
get_due_cards: Get cards that are due for reviewOptional
limitargument (default: 5) to control number of cardsOptional
deckargument to filter by specific deckOptional
today_onlyargument (default: true) to show only today's cardsReturns cards in XML format with questions and answers
submit_reviews: Submit answers for reviewed cardsTakes list of
reviewswithcard_idandratingRatings: "wrong", "hard", "good", "easy"
Returns confirmation of submitted reviews
search_notes: Find notes by AnkiConnect query. Returns IDs + a short Front preview by default (cheap); passreturn_card_content=trueto receive cleaned field content inline.inspect_cards: View per-card state for given card IDs or note IDs. Sparse-fieldset selection via thepropertieslist: any ofidentity,state,scheduling,timestamps,history,fields, orall(default:["identity", "state", "scheduling"]). The legacyinclude_history=trueflag is still accepted as an alias.update_note_fields: Modify the text content of one note's fields. Uses the same MathJax/code conversions asadd_note.update_note_tags: Add and/or remove tags on one or more notes.set_suspended: Suspend or unsuspend one or more cards.change_deck: Move cards (by card ID) into a different deck.reschedule_cards: Set due date, forget, or relearn one or more cards.
Related MCP server: Anki MCP Server
Configuration
Prerequisites
Anki must be running with AnkiConnect plugin installed (plugin id 2055492159) AnkiConnect can be slow on Macs due to the AppSleep feature, so disable it for Anki. To do so run the following in your terminal.
defaults write net.ankiweb.dtop NSAppSleepDisabled -bool true defaults write net.ichi2.anki NSAppSleepDisabled -bool true defaults write org.qt-project.Qt.QtWebEngineCore NSAppSleepDisabled -bool true
Installation
Quickstart
Install the AnkiConnect plugin in Anki:
Tools > Add-ons > Get Add-ons...
Enter code:
2055492159Restart Anki
Configure Claude Desktop:
On MacOS:
~/Library/Application\ Support/Claude/claude_desktop_config.jsonOn Windows:%APPDATA%/Claude/claude_desktop_config.jsonAdd this configuration:
{ "mcpServers": { "mcp-ankiconnect": { "command": "uv", "args": ["run", "--with", "mcp-ankiconnect", "mcp-ankiconnect"] } } }Restart Anki and Claude desktop
Debugging
Since MCP servers run over stdio, debugging can be challenging. For the best debugging experience, we strongly recommend using the MCP Inspector. First, clone the repository and install the dependencies:
git clone https://github.com/samefarrar/mcp-ankiconnect.git
cd mcp-ankiconnect
uv syncYou can launch the MCP Inspector via the mcp CLI:
uv run mcp dev mcp_ankiconnect/server.pyUpon launching, the Inspector will display a URL you can access in your browser to begin debugging.
Available Tools
14 toolsadd_noteA
Add a flashcard to Anki. Ensure you have looked at examples before you do this, and that you have got approval from the user to add the flashcard.
For code examples, use <code> tags to format your code.
e.g. <code>def fibonacci(n):
if n <= 1:
return n
return fibonacci(n-1) + fibonacci(n-2)</code>
For MathJax, use the <math> tag to format your math equations. This will automatically render the math equations in Anki.
# e.g. <math>\frac{d}{dx}[3\sin(5x)] = 15\cos(5x)</math>
To attach images to a card, use the picture parameter. Each picture object must have a filename
and exactly one source (url, data, or path). The fields list specifies which card fields get the <img> tag inserted.
## How to attach images based on the source:
**User provides a URL:**
[{"url": "https://example.com/photo.jpg", "filename": "photo.jpg", "fields": ["Back"]}]
**User provides a local file (e.g. screenshot, downloaded image):**
[{"path": "/absolute/path/to/image.png", "filename": "image.png", "fields": ["Back"]}]
**Base64-encoded data (for small images only):**
[{"data": "iVBORw0KGgo...", "filename": "diagram.png", "fields": ["Back"]}]
IMPORTANT: When a user shares an image file or screenshot, prefer using "path" with the absolute
file path rather than trying to base64-encode the image contents. AnkiConnect reads the file directly
from disk which is faster and more reliable.
Args:
deckName: str - The target deck name.
modelName: str - The note type (model) name.
fields: dict - Dictionary of field names and their string content.
tags: List[str] - Optional list of tags.
picture: List[dict] - Optional list of picture attachments. Each dict should have:
- filename (str): Name for the stored image file.
- url (str, optional): URL to download the image from.
- path (str, optional): Absolute file path to a local image. Preferred for user-shared files.
- data (str, optional): Base64-encoded image data.
- fields (List[str]): Card field names where the <img> tag will be inserted.
- skipHash (str, optional): MD5 hash to skip if file matches.
Inputs: deckName (required), modelName (required), fields (required), tags, +1 more. Returns: result
change_deckA
Move cards into a different deck.
Operates on card IDs (AnkiConnect's `changeDeck` is card-scoped). If you only
have note IDs, call `inspect_cards(note_ids=...)` first — a single note's cards
can legitimately live in different decks, so this tool never silently expands
notes into cards.
Args:
card_ids: Card IDs to move.
deck: Target deck name (e.g. "Spanish::Verbs").
Inputs: card_ids (required), deck (required). Returns: result
fetch_due_cards_for_reviewA
Fetch cards due for review, formatted for an LLM to present.
Args:
deck: Optional[str] - Filter by specific deck name.
limit: int - Maximum number of cards to fetch (default 5).
today_only: bool - If true, only fetch cards due today. If false, fetch cards due up to MAX_FUTURE_DAYS ahead (currently {MAX_FUTURE_DAYS}).
Inputs: deck, limit, today_only. Returns: result
get_examplesA
Get example notes from Anki to guide your flashcard making. Limit the number of examples returned and provide a sampling technique:
- random: Randomly sample notes
- recent: Notes added in the last week
- most_reviewed: Notes with more than 10 reviews
- best_performance: Notes with less than 3 lapses
- mature: Notes with interval greater than 21 days
- young: Notes with interval less than 7 days
Args:
deck: Optional[str] - Filter by specific deck (use exact name).
limit: int - Maximum number of examples to return (default 5).
sample: str - Sampling technique (random, recent, most_reviewed, best_performance, mature, young).
Inputs: deck, limit, sample. Returns: result
inspect_cardsA
Inspect per-card state with sparse fieldset selection.
Provide EXACTLY ONE of `card_ids` or `note_ids`. When `note_ids` is given,
the tool resolves to all cards belonging to those notes via an `nid:` query.
Use `properties` to pick which categories of information to return. The
default keeps responses small; opt into the heavier categories explicitly.
Property categories:
- `identity` — cardId, noteId, deck, modelName
- `state` — suspended, queue, queue_label, type
- `scheduling` — ease, interval, reps, lapses, raw_due
- `timestamps` — modified_iso, last_review_iso (the latter only with `history`)
- `history` — full review log (extra AnkiConnect call). Each entry has
an ISO timestamp, an "again"/"hard"/"good"/"easy" rating, interval in
days, and time taken in ms.
- `fields` — cleaned, non-empty note field content (extra `notesInfo`
round trip). Image Occlusion notes collapse to a single placeholder.
- `all` — shorthand for every category above.
Default when `properties` is None: `["identity", "state", "scheduling"]`.
`include_history=True` is kept as a soft-deprecated alias — equivalent to
adding `"history"` to `properties`. Prefer the new param going forward.
Args:
card_ids: List of card IDs to inspect.
note_ids: List of note IDs; expands to every card on those notes.
properties: List of property categories to include.
include_history: Soft-deprecated alias for `properties=["history", ...]`.
Inputs: card_ids, note_ids, properties, include_history. Returns: result
list_decks_and_notesC
Get all decks (excluding specified patterns) and note types with their fields.
Inputs: no named parameters. Returns: result
num_cards_due_todayB
Get the number of cards due exactly today, with an optional deck filter.
Inputs: deck. Returns: result
reschedule_cardsA
Manipulate the scheduling state of one or more cards.
Modes:
- `set_due`: Set the cards' due date. Requires `due`. Accepts AnkiConnect's
`setDueDate` spec:
* "1" → due 1 day from now
* "1-7" → randomly due between 1 and 7 days from now
* "3!" → due in 3 days AND reset interval to 3
- `forget`: Reset cards to the "new" queue (re-enters the learning pipeline).
- `relearn`: Move cards into the relearning queue.
Args:
card_ids: Card IDs to reschedule.
mode: One of "set_due", "forget", "relearn".
due: Required for `mode="set_due"`; ignored otherwise.
Inputs: card_ids (required), mode (required), due. Returns: result
search_notesA
Search for notes in Anki using the powerful built-in search syntax.
This tool allows you to find existing notes/flashcards using Anki's query language.
Results include note IDs which can be used for follow-up actions.
Tiered access — call this first to narrow by query, then drill in by ID:
- Default (`return_card_content=False`): cheap response with noteId + a
~80-char Front preview, so you can pick which IDs matter.
- `return_card_content=True`: full cleaned field content for every match.
- For scheduling/state details (queue, ease, interval, lapses, review
history) on specific IDs, call `inspect_cards(note_ids=[...])`. Pass
`properties=["fields"]` there if you also want the cleaned note content
alongside the per-card stats in one call.
## Common Search Patterns
**Simple text search:**
- `dog` - notes containing "dog" (matches "doggy", "underdog")
- `dog cat` - notes with both "dog" AND "cat"
- `dog or cat` - notes with "dog" OR "cat"
- `-cat` - notes WITHOUT "cat"
- `"a dog"` - exact phrase match
- `w:dog` - whole word match only
**Field-specific search:**
- `front:dog` - Front field exactly equals "dog"
- `front:*dog*` - Front field contains "dog"
- `front:` - Front field is empty
- `front:_*` - Front field is non-empty
**Deck and tag filters:**
- `deck:French` - cards in French deck (including subdecks)
- `deck:French -deck:French::*` - only top-level French deck
- `tag:vocab` - notes with "vocab" tag
- `tag:none` - notes without any tags
- `note:Basic` - notes using "Basic" note type
**Card state:**
- `is:due` - cards due for review
- `is:new` - new cards not yet studied
- `is:learn` - cards in learning phase
- `is:review` - review cards
- `is:suspended` - suspended cards
- `is:buried` - buried cards
**Card properties:**
- `prop:ivl>=10` - interval >= 10 days
- `prop:due=0` - due today
- `prop:due=1` - due tomorrow
- `prop:lapses>3` - lapsed more than 3 times
- `prop:ease<2.5` - easier than default
- `prop:reps<10` - reviewed fewer than 10 times
**Recent activity:**
- `added:7` - added in last 7 days
- `edited:3` - edited in last 3 days
- `rated:1` - answered today
- `rated:7:1` - answered "Again" in last 7 days
- `introduced:30` - first answered in last 30 days
**Combining searches:**
- `deck:Spanish tag:verb is:due` - due Spanish verbs
- `added:7 -is:review` - new cards added this week
- `(dog or cat) deck:Animals` - dog or cat in Animals deck
Args:
query: The Anki search query string.
limit: Maximum notes to return (1-100, default 20).
return_card_content: If True, returns full cleaned field content per
note. If False (default), returns a short Front preview per note.
Returns:
JSON object with `query`, `total_found`, `returned`, and `notes`.
Each note has `noteId`, `modelName`, `tags`, and either `preview`
(default) or `fields` (when `return_card_content=True`).
Inputs: query (required), limit, return_card_content. Returns: result
set_suspendedA
Suspend or unsuspend one or more cards.
Args:
card_ids: Card IDs to act on (not note IDs).
suspended: True to suspend, False to unsuspend.
Inputs: card_ids (required), suspended (required). Returns: result
store_media_fileA
Store an image or media file in Anki's media folder.
Use this tool to store images that can be referenced in flashcard fields using
HTML img tags: <img src="filename">
This is useful when you need to:
- Store an image before creating a note (e.g. to reference it in multiple notes)
- Add an image to an existing card's field
Provide exactly one of url, data, or path:
- path: Absolute path to a local file. PREFERRED when the user shares an image file or screenshot.
- url: A URL to download the image from (e.g. "https://example.com/photo.jpg")
- data: Base64-encoded file content (for small images only)
IMPORTANT: When a user shares an image file or screenshot, prefer using "path" with the absolute
file path. AnkiConnect reads the file directly from disk, which avoids needing to base64-encode
large image files.
Args:
filename: str - The filename to store the media as (e.g. "diagram.png").
url: str - Optional URL to download the image from.
data: str - Optional base64-encoded image data.
path: str - Optional absolute path to a local file. Preferred for user-shared files.
Inputs: filename (required), url, data, path. Returns: result
submit_reviewsA
Submit multiple card reviews to Anki using ratings ('wrong', 'hard', 'good', 'easy').
Args:
reviews: List of review dictionaries, each with:
- card_id (int): The ID of the card reviewed.
- rating (str): 'wrong', 'hard', 'good', or 'easy'.
Inputs: reviews (required). Returns: result
update_note_fieldsB
Update the text content of one or more fields on an existing note.
Only fields you pass in are changed; omitted fields are left alone. MathJax
(`<math>...</math>`) and code blocks/inline code are auto-converted to the
same HTML representations used by `add_note`.
Args:
note_id: Anki note ID (not a card ID).
fields: Mapping of field name -> new value.
Inputs: note_id (required), fields (required). Returns: result
update_note_tagsA
Add and/or remove tags on one or more notes.
Tags MUST NOT appear in both `add` and `remove`. At least one of the two lists
must be non-empty.
Args:
note_ids: Note IDs to modify.
add: Tags to add (each tag should not contain spaces).
remove: Tags to remove.
Inputs: note_ids (required), add, remove. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 14 tools
Each tool targets a distinct functionality: adding notes, moving decks, fetching reviews, inspecting cards, searching, storing media, etc. There is no overlap or ambiguity between tools.
Most tools follow a verb_noun pattern in snake_case (e.g., add_note, search_notes). One tool (num_cards_due_today) uses 'num' as a prefix instead of a verb, and list_decks_and_notes uses 'and', but overall the pattern is consistent.
14 tools is well-scoped for an Anki integration, covering adding, editing, searching, reviewing, scheduling, and media management without being excessive or too sparse.
The tools cover core workflows (add, edit, review, search, inspect) but lack deletion operations (no delete_note or delete_card) and deck/note type creation. These gaps limit full lifecycle management.
Maintenance
Related MCP Connectors
An MCP server that integrates with Discord to provide AI-powered features.
Augments MCP Server - A comprehensive framework documentation provider for Claude Code
Driflyte MCP server which lets AI assistants query topic-specific knowledge from web and GitHub.
MCP server giving Claude AI access to 22+ NYC public-record databases for real estate due diligence
Related MCP Servers
- AlicenseAqualityBmaintenanceAn MCP server that enables AI assistants like Claude to interact with Anki flashcard decks, allowing users to create, manage, and update flashcards through natural language conversations.945MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that bridges Claude AI with Anki flashcard app, allowing users to create and manage flashcards using natural language commands.10MIT
- FlicenseAqualityDmaintenanceAn MCP server that enables Claude Code to create, manage, and search Anki flashcards directly from the terminal. It supports batch card creation, deck statistics retrieval, and synchronization with AnkiWeb for cross-platform review.8-
- AlicenseAqualityDmaintenanceAn MCP server that connects to Anki for card review and creation, featuring automatic date-based organization of new cards.434 npm1MIT