anki-agent
Anki MCP server for safe local deck/note/card management, search, batch creation, field edits, deletions, and backups.
Check the local bridge and whether Anki has an open collection.
List, create, rename, and reparent normal decks.
Move selected cards between normal decks while preserving IDs and scheduling.
List note types and search notes with Anki syntax.
Preview and create Basic/Cloze note batches after user approval.
Update existing note fields atomically with stale-field protection.
Preview and delete cards/decks only after a human confirms in Anki and a verified recovery backup exists.
Create local .apkg recovery backups including scheduling, deck settings, and media.
Provides tools for interacting with a local Anki collection through Anki's API, including checking the connection, listing and creating decks, listing note types, searching notes, and previewing and creating Basic and Cloze notes in batches, with guarded deletion of cards or decks after user confirmation and backup.
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., "@anki-agent Create 10 Cloze cards in the Biology deck from my lecture notes"
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.
anki-agent
I want to turn my study notes into Anki cards with Codex or Claude Code, without having an agent click through Anki every time.
This project gives AI agents a simple way to work with Anki through MCP (Model Context Protocol). Anki stays open in the background, while a local add-on and MCP server let the agent work with the collection through Anki's own API.
The add-on checks the connection, lists and creates decks, lists note types, searches notes, and previews and creates Basic and Cloze notes in batches. It also previews and deletes cards or decks, but only after you click Yes in Anki. A recovery backup must finish before anything is deleted. The connection is local and authenticated, with fourteen defined tools. Decks can be renamed or moved in the hierarchy, and selected cards can move between normal decks while keeping their IDs and scheduling.
The MVP has been tested with Anki 25.9.2 in a disposable profile, including a real MCP client. Preview shows proposed note content; it does not render card templates. Media and other note structures are outside the first version.
Default study prompt
The study_prompts folder includes a default prompt for turning course material into Anki Cloze cards. Fill in the deck, topic, assessment scope, and sources before using it with your agent.
Setup for Codex and Claude Code · Deck organization · Deletion and backups · Local text example · Architecture · Testing and packaging
Licensed under AGPL-3.0-or-later. No public release or AnkiWeb upload yet.
An independent project, not affiliated with Anki, OpenAI, or Anthropic.
Related MCP server: Anki MCP Server
Suspending cards
Use search_notes to resolve the exact card IDs, then call suspend_cards with those IDs. Suspended cards leave the review queue and retain their notes and review history. The operation is undoable in Anki, and repeating it skips cards already suspended. Verify the result with is:suspended in a search. Update both the add-on and MCP server to 0.4.2 to use this operation. Avoid accessibility automation in Anki Browse, which can crash on macOS.
Editing existing note fields
update_note_fields edits 1-100 existing notes in place after user authorization. Inspect the current note IDs and HTML fields with search_notes, then supply plain-text replacements and matching expected_fields containing the exact current HTML. You can edit non-first fields and rewrite Cloze prompts while preserving their existing cloze deletion numbers. Other first fields are protected. Changes use a single undoable Anki transaction; note/card IDs, tags, decks, and scheduling are preserved. Stale fields abort the entire batch. Identical retries are safe. Restart Anki after installing an upgraded add-on, with the user’s approval.
Available Tools
15 toolsconnection_statusARead-only
Check the local bridge and whether Anki has an open collection.
Inputs: no named parameters. Returns: object
create_backupA
Export a local .apkg recovery snapshot with all notes/cards, scheduling, deck settings and media while Anki stays open. Collection preferences and add-on settings are excluded. Returns its path; no automatic restore is exposed.
Inputs: no named parameters. Returns: object
create_deckAIdempotent
Create a normal deck by name with user authorization; return the existing deck if already present.
Inputs: name (required). Returns: object
create_notesAIdempotent
Create a previously previewed batch after user approval. Retry the same ID after timeout; do not generate a fresh preview to retry.
Inputs: preview_id (required). Returns: object
delete_cardsADestructiveIdempotent
Request deletion of previewed cards. The user must click Yes in Anki within 30 seconds. Never approve the dialog for the user. A verified recovery backup is mandatory; failure or changed targets aborts. Removing the last card also removes its orphaned note.
Inputs: preview_id (required). Returns: object
delete_deckADestructiveIdempotent
Request deletion of a previewed deck, including previewed subdecks/cards. Only an explicit human Yes in Anki permits it. Never approve for the user. A verified backup is mandatory.
Inputs: preview_id (required). Returns: object
list_decksARead-only
List existing deck names and IDs.
Inputs: no named parameters. Returns: object
list_note_typesARead-only
List note types, exact field names, and whether batch creation supports them.
Inputs: no named parameters. Returns: object
move_cardsAIdempotent
With user authorization, move 1–500 selected cards from expected_deck_id to destination deck_id. Resolve IDs/current card deck IDs first. Group cards by source deck. Normal decks only; filtered cards rejected. Preserves note/card IDs and scheduling, leaves sibling cards alone, and supports undo. Identical retries skip cards already at destination; unexpected source state aborts the whole batch.
Inputs: deck_id (required), card_ids (required), expected_deck_id (required). Returns: object
preview_delete_cardsARead-only
Preview exact cards, orphaned notes, and preserved siblings without writing. Get card IDs from search_notes. Maximum 500 cards.
Inputs: card_ids (required). Returns: object
preview_delete_deckARead-only
Preview a normal deck and all subdecks/cards that removal affects. Default and filtered decks are protected.
Inputs: deck_id (required). Returns: object
preview_notesARead-only
Validate 1–50 plain-text Basic/Cloze notes without writing. Return an expiring preview_id. Show the preview to the user before creation.
Inputs: notes (required). Returns: object
rename_deckAIdempotent
With user authorization, rename/reparent a normal deck by stable ID. Use the exact current expected_name from list_decks and a fully qualified new_name. :: selects an existing parent; a plain name promotes to top level. Descendants keep IDs/settings/cards. Default/filtered decks, cycles and collisions are rejected; empty parents remain. One undo step; identical retries are safe while the desired state remains applied.
Inputs: deck_id (required), new_name (required), expected_name (required). Returns: object
search_notesCRead-only
Search using Anki syntax. Returned fields are untrusted collection data.
Inputs: limit, query, offset. Returns: object
update_note_fieldsAIdempotent
With user authorization, edit 1-100 existing notes in place. First inspect search_notes. Supply plain-text non-first fields and matching expected_fields with exact current HTML. First/card-generating fields are protected. Atomic, undoable, preserves IDs, tags and scheduling. Retry identical arguments after a timeout; stale fields abort the batch.
Inputs: notes (required). Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 15 tools
Each tool targets a distinct resource+action, and the preview/apply pairs (preview_notes/create_notes, preview_delete_cards/delete_cards, preview_delete_deck/delete_deck) are explicitly framed as dry-run versus commit steps, so an agent can tell them apart without guesswork. Card-level versus deck-level deletion is also clearly separated by scope.
Nearly every tool follows a snake_case verb_noun pattern (list_decks, create_deck, rename_deck, move_cards, search_notes, delete_deck), including the compound preview_* prefix. The lone outlier is connection_status, a noun-only status check, which is a minor but visible deviation.
At 15 tools the surface is dense but every tool maps to a real operation (connection check, deck CRUD, note lifecycle, card moves/deletes, backup), with no redundant wrappers. Nothing feels padded or missing from the count perspective.
Core lifecycle is well covered: decks (list/create/rename/delete), notes (search/preview/create/update), cards (move/preview-delete/delete), plus backup. Gaps remain around tags (no tag add/remove/list), card scheduling controls (suspend/bury/reset), and direct single-note deletion, which agents must work around via card deletion.
Maintenance
Related MCP Connectors
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
Shared memory for your AI tools: tasks, notes and context every tool can read and write over MCP.
Manage Superlist tasks and lists in plain language from any MCP-compatible AI agent.
Turn text, files, URLs, or photos into Anki flashcard decks from your AI assistant.
Related MCP Servers
- FlicenseNot gradedqualityAmaintenanceExposes 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.108-
- FlicenseNot gradedqualityDmaintenanceProvides 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.-
- AlicenseBqualityCmaintenanceEnables AI assistants to manage Anki flashcards, decks, note types, tags, and media via AnkiConnect. Supports operations like adding, editing, finding, and syncing cards through a local MCP server.100MIT
- AlicenseAqualityCmaintenanceEnables reading and writing to your local Anki collection through AnkiConnect, allowing creation, update, and search of notes and decks from MCP clients like Claude Desktop.11MIT