Anki

io.github.nietusv0.2.0更新於 Oct 5, 2026

Study and manage Anki flashcards via AnkiConnect: quizzes, stats, leeches, bulk edits.

概覽

AI 產生的概覽

讓助理透過 AnkiConnect 學習與管理 Anki 單字卡,包括測驗、統計、難記卡片分析與批次編輯。

功能
透過 AnkiConnect 提供 35 個工具,用來學習與管理 Anki 牌組。它可以針對到期卡片進行測驗並記錄作答,回報到期數量、連續學習天數、記憶保留率與複習紀錄,找出難記卡片,並批次建立、編輯、移動、重新排程、暫停或刪除筆記與卡片。它也能管理牌組、筆記類型、標籤與 AnkiWeb 同步,並在設定 Azure 金鑰後為卡片產生音訊。
適用情境
適合已使用 Anki 學習、希望讓助理進行測驗、彙總到期任務與記憶保留情況、整理一直記不住的卡片,或批次修改筆記、標籤與排程的使用者。
執行需求
以 stdio 本機程序執行;需要 Node.js 18+、正在執行的 Anki,以及 AnkiConnect 外掛(代碼 2055492159)。選用環境變數:ANKI_CONNECT_HOST、ANKI_CONNECT_PORT、ANKI_CONNECT_KEY,以及供音訊工具使用的 AZURE_API_KEY 與 AZURE_REGION。僅支援桌面端。
安裝前請注意
寫入與破壞性工具可以變更或刪除筆記、卡片、牌組、筆記類型與排程;批次修改支援 dryRun 預覽,刪除需要確認權杖。AZURE_API_KEY 會啟用付費的 Azure 文字轉語音呼叫。ANKI_CONNECT_KEY 是本機外掛的憑證。同步會將牌組資料傳送到 AnkiWeb。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Anki,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

anki-mcp

[tests] [License: MIT]

Study and manage your Anki collection by talking to Claude (or any MCP client). 35 tools over AnkiConnect: get quizzed in chat, see what is due and how your retention is going, find the cards you keep forgetting, create and clean up notes in bulk, and pause whole groups of cards until you want them back.

[Watch the video]

What you can ask

  • "What do I have to study today?" → due counts per deck, streak, reviews this week.
  • "Quiz me on 10 due cards from my Spanish deck." → one question at a time, graded, and recorded in Anki with the next interval.
  • "Which cards do I keep getting wrong? Help me fix them." → leeches, their review history, and rewrites you approve.
  • "Suspend everything tagged HSK5 until my exam, and make it easy to bring back." → named pause that restores exactly those cards, scheduling intact.
  • "Turn this article into cloze cards in my Biology deck." → duplicate-checked bulk add.
  • "Add audio to every card in this deck that doesn't have it." → Azure TTS in bulk.
  • "Move the cards tagged grammar to a new subdeck" / "rename the tag todo to review" / "spread my backlog over the next two weeks".

Bulk changes can be previewed with a dry run, deleting always needs a confirmation step, and when Anki is closed the assistant is told to ask you to open it instead of failing silently.

Install

You need Node.js 18+, Anki running, and the AnkiConnect add-on (code 2055492159).

Claude Desktop

Download anki-mcp.mcpb from the latest release and drag it into Settings → Extensions. That's it.

Claude Code

bash
claude mcp add anki --scope user -- npx -y github:nietus/anki-mcp

Cursor and other MCP clients

Add this to the client's MCP configuration:

json
{  "mcpServers": {    "anki": {      "command": "npx",      "args": ["-y", "github:nietus/anki-mcp"]    }  }}

On Windows, if the client cannot start npx directly, use "command": "cmd" with "args": ["/c", "npx", "-y", "github:nietus/anki-mcp"].

From source

bash
git clone https://github.com/nietus/anki-mcpcd anki-mcpnpm installnpm run build

Then point your client at node /path/to/anki-mcp/build/client.js. To build the Claude Desktop bundle yourself, run npm run pack:mcpb (output in dist/anki-mcp.mcpb).

Configuration

All environment variables are optional. Put them in a .env file in the project folder or pass them through your MCP client.

VariableDefaultPurpose
AZURE_API_KEY–Enables the audio tools (Azure Text-to-Speech).
AZURE_REGIONeastusAzure Speech region.
ANKI_CONNECT_HOSThttp://127.0.0.1AnkiConnect host.
ANKI_CONNECT_PORT8765AnkiConnect port.
ANKI_CONNECT_KEY–AnkiConnect API key, if you set one in the add-on config.

Development

bash
npm test           # unit + in-memory MCP server tests (no Anki needed)npm run inspector  # try the tools interactively

Available Tools

Every tool is annotated as read-only, write or destructive, so clients like Claude Desktop can auto-approve reads and ask before destructive changes. Errors (including "Anki is not running") come back as readable tool results.

Most bulk tools select cards or notes the same way: deckName (subdecks included), tags (matches any), query (any Anki search, ANDed), or explicit cardIds / noteIds. Write tools accept dryRun: true to preview the change first.

Studying

ToolWhat it does
get_study_overviewToday's new/learning/review counts per deck, cards reviewed today, streak, 7/30-day totals.
get_due_cards / get_new_cardsnum cards to study (optionally from one deckName), with the interval each button would give.
answer_cardsRecord answers (cardId, ease 1-4) and get each card's new interval. (Previously update_cards.)
find_leechesWeakest cards (leech tag / many lapses), ranked by lapses and ease.
get_card_historyFull review log of up to 20 cards.
get_retention_statsTrue retention (young/mature), reviews per day and time spent for a deck over N days.
undoUndo the last action in Anki.

Selecting and scheduling cards

ToolWhat it does
find_cardsPaginated search (query, limit, offset); pick the sections to return with include: question, answer, fields, stats.
suspend_cards / unsuspend_cardsDeactivate/reactivate cards, e.g. all cards with tag X in deck Y. Scheduling is preserved. Pass a label when suspending (notes get the tag paused::<label>) and unsuspend_cards { label } later resumes exactly that group, leaving cards suspended for other reasons alone.
move_cardsMove cards to targetDeck (created if missing).
reschedule_cardsset_due_date (days: 0, 1!, 3-7), forget (reset to new) or relearn.

Creating and editing notes

ToolWhat it does
add_cardCreate one note.
add_bulkCreate many notes; duplicates/invalid notes are skipped and reported with the reason.
add_cloze_cardsCreate cloze notes from text plus terms to hide, or text with {{c1::...}} markup.
update_note_fields / bulk_update_notesEdit fields of existing notes.
find_and_replacePlain or regex replace across notes, optionally limited to some fields.
manage_tagslist (with a filter: tag counts), add, remove, rename, clear_unused.
add_imageAdd an image to a field from a url, local path or base64 data.
delete_notesTwo-step delete: the first call previews and returns a confirmToken, the second call (with the token) deletes.

Audio (requires AZURE_API_KEY)

ToolWhat it does
add_card_with_audioCreate a note with audio generated from sourceField into audioField.
update_card_with_audioGenerate audio for one existing note.
bulk_generate_audioGenerate audio for many notes (by default only those with an empty audio field), limit per call.

Supported languages: en, es, fr, de, it, ja, ko, pt, pt-PT, ru, zh, ar, nl, hi, tr, pl, sv, fi, da, no, cs, hu, el, he, th, vi, id, ms, ro.

Decks and note types

ToolWhat it does
get_deck_names / create_deckList or create decks.
get_deck_model_infoWhich note types a deck uses (call before adding cards to it).
get_model_names / get_model_detailsList note types / fields, templates and CSS of one.
edit_note_type_fieldadd, remove, rename or reposition a field.
update_note_type_templates / update_note_type_stylingReplace templates or CSS.
create_modelCreate a note type.
syncSync with AnkiWeb.

Prompts

PromptWhat it does
quiz_meStudy session: one question at a time, graded and recorded in Anki.
make_cardsTurn a text into atomic flashcards (previewed before adding).
leech_reviewFind the cards you keep forgetting and fix them.

Resources

  • anki://collection/overview – study overview.
  • anki://search/isdue, anki://search/isnew, anki://search/deckcurrent – up to 50 cards each.
  • anki://deck/{deckName}/overview – due counts for one deck.
  • anki://model/{modelName} – fields, templates and CSS of a note type.

License

MIT

來源:README.md,提交 ace7997

工具

0
工具後設資料尚未被收錄。

版本歷史

1
  1. v0.2.0最新Oct 5, 2026