Anki MCP Server
anki-mcp
Anki 的 MCP 服务器。该服务器允许通过模型上下文协议 (MCP) 与 Anki 进行交互。它允许用户以编程方式管理抽认卡、卡片组和复习流程。
先决条件
已安装 Node.js 和 npm。
AnkiConnect 插件已安装并在 Anki 中运行。
Related MCP server: Anki MCP Server
设置和执行
强烈建议在本地运行,因为 anki connect 只能在本地运行
要在本地运行:
克隆存储库:
git clone https://github.com/nietus/anki-mcp安装依赖项:
npm install构建项目:
package.json中的prepare脚本会在安装后自动运行构建。如果您需要手动构建:npm run build此命令编译 TypeScript 代码并使客户端脚本可执行。
与 Windows 的光标设置集成
"anki": { "command": "cmd", "args": [ "/c", "node", "c:/Users/-/Downloads/anki-mcp/build/client.js" ] }
可用工具
要调试工具,请使用
npm run inspector服务器提供以下与 Anki 交互的工具:
update_cards:描述:在用户回答您向他们提问的卡片后,使用此工具将其标记为已回答并更新其难度。
输入:一个答案数组,每个答案都有
cardId(数字)和ease(数字,1-4)。
add_card:描述:在 Anki 中创建一张新的抽认卡。注意内容使用 HTML 格式。
换行符:
<br>代码:
<pre style="background-color: transparent; padding: 10px; border-radius: 5px;">列表:
<ol>和<li>粗体:
<strong>斜体:
<em>
输入:
fields:(对象)一个对象,其中键是字段名称(例如“汉字”,“拼音”),值是其 HTML 内容。modelName:(字符串)要使用的 Anki 笔记类型(模型)的名称。deckName:(可选字符串)要添加卡片的牌组名称。默认为当前牌组或“默认”。tags:(可选字符串数组)要添加到注释的标签列表。
get_due_cards:描述:返回给定数量的待审查卡片。
输入:
num(数字)。
get_new_cards:描述:返回给定数量的新卡和未见过的卡。
输入:
num(数字)。
get-deck-names:描述:获取所有 Anki 卡片组名称的列表。
输入:无。
find-cards:描述:使用原始 Anki 搜索查询查找卡片。返回包含字段在内的卡片详细信息。
输入:
query(字符串,例如'deck:Default -tag:test'或'"deck:My Deck" tag:important')。要过滤空字段,请使用'-FieldName:_*'(例如'-Hanzi:_*')。
update-note-fields:描述:更新给定 Anki 笔记的特定字段。
输入:
noteId(数字),fields(对象,例如,{"Front": "New Q", "Back": "New A"})。
create_deck:描述:创建一个新的 Anki 卡片组。
输入:
deckName(字符串)。
bulk_update_notes:描述:更新多个 Anki 笔记的特定字段。
输入:一个
notes数组,其中每个注释都有noteId(数字)和fields(对象)。
get_model_names:描述:列出所有可用的 Anki 笔记类型/模型名称。
输入:无。
get_model_details:描述:检索指定注释类型的字段、卡片模板和 CSS 样式。
输入:
modelName(字符串)。
get_deck_model_info:描述:检索指定卡组中所使用的音符类型(模型)的信息。用于判断卡组是否使用了单个、多个模型,或者卡组是否为空或不存在。
输入:
deckName(字符串)。输出:具有
deckName、status(例如“single_model_found”、“multiple_models_found”、“no_notes_found”、“deck_not_found”)以及条件modelName(字符串)或modelNames(字符串数组)的对象。
add_note_type_field:描述:向注释类型添加新字段。
输入:
modelName(字符串),fieldName(字符串)。
remove_note_type_field:描述:从注释类型中删除现有字段。
输入:
modelName(字符串),fieldName(字符串)。
rename_note_type_field:描述:重命名注释类型中的字段。
输入:
modelName(字符串)、oldFieldName(字符串)、newFieldName(字符串)。
reposition_note_type_field:描述:更改注释类型中字段的顺序(索引)。
输入:
modelName(字符串)、fieldName(字符串)、index(数字)。
update_note_type_templates:描述:更新笔记类型卡片的 HTML 模板(例如正面和背面)。
输入:
modelName(字符串)、templates(对象,例如,{"Card 1": {"Front": "html", "Back": "html"}})。
update_note_type_styling:描述:更新注释类型的 CSS 样式。
输入:
modelName(字符串),css(字符串)。
create_model:描述:创建一个新的 Anki 笔记类型(模型)。
输入:
modelName(字符串)、fieldNames(字符串数组)、cardTemplates(对象数组,每个对象包含Name、Front、BackHTML 字符串)、css(可选字符串)、isCloze(可选布尔值,默认为 false)、modelType(可选字符串,默认为“标准”)。
add_bulk:描述:一次性将多张抽认卡添加到 Anki。注释内容使用 HTML 格式。此工具用于一次性添加多张注释(卡片)。
输入:一个
notes数组,其中每个注释对象具有:fields:(对象)一个对象,其中键是字段名称,值是其 HTML 内容。modelName:(字符串)此注释使用的 Anki 注释类型(模型)的名称。deckName:(可选字符串)此笔记对应的 deck 名称。默认为“Default”。tags:(可选字符串数组)此注释的标签列表。
更多信息可以在这里找到Anki Integration | Smithery
Available Tools
3 toolsanki_add_noteC
Add a flashcard to an Anki deck
Inputs: back (required), deckName (required), front (required).
anki_add_notesC
Add multiple flashcards to an Anki deck
Inputs: cards (required), deckName (required).
anki_create_deckC
Create a new Anki deck
Inputs: deckName (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
The tools have overlapping purposes, as 'anki_add_note' and 'anki_add_notes' both handle adding flashcards, which could cause confusion for an agent deciding between single vs. batch operations. However, the descriptions clarify the distinction (single vs. multiple), mitigating some ambiguity. The 'anki_create_deck' tool is clearly distinct, focusing on deck management rather than note addition.
All tool names follow a consistent 'anki_' prefix and snake_case pattern (e.g., anki_add_note, anki_add_notes, anki_create_deck), with clear verb_noun structures. This predictability makes it easy for agents to understand and navigate the tool set without confusion from mixed conventions.
With only 3 tools, the server feels thin for managing Anki flashcards, a domain that typically involves operations like updating, deleting, reviewing, or searching notes and decks. The count is too low for the apparent scope, lacking essential CRUD lifecycle coverage beyond basic creation, which may limit agent functionality.
The tool set is severely incomplete for Anki management, covering only note addition and deck creation. Obvious gaps include updating or deleting notes/decks, listing or searching existing content, and handling reviews or scheduling—core aspects of flashcard workflows. This will likely cause agent failures when trying to perform common tasks beyond initial setup.
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
Model Context Protocol server for Studex tools, notifications, and profile integrations
Related MCP Servers
- AlicenseAqualityDmaintenanceA server implementation that connects to a locally running Anki, enabling card review and creation through the Model Context Protocol.4185MIT
- AlicenseAqualityBmaintenanceA Model Context Protocol server that enables LLMs to interact with Anki flashcard software through AnkiConnect, allowing for creation and management of flashcards, decks, and note types.16446 npm254MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that allows LLMs to interact with Anki flashcard software, enabling functions like creating decks, adding notes, searching cards, and managing flashcard content through natural language.1MIT
- AlicenseBqualityDmaintenanceA Model Context Protocol server that enables interaction with Anki flashcards through AnkiConnect, providing organized tools for managing decks, notes, cards, models, and media files.407MIT