一个模型上下文协议 (MCP) 服务器,通过 AnkiConnect 使 LLM 能够与 Anki 闪卡软件进行交互。
list_decks
- 列出所有可用的 Anki 卡组create_deck
- 创建一个新的 Anki 卡组create_note
- 创建一个新的笔记(基础或Cloze)batch_create_notes
- 一次性创建多个笔记search_notes
- 使用 Anki 查询语法搜索笔记get_note_info
- 获取关于某个笔记的详细信息update_note
- 更新现有笔记delete_note
- 删除笔记list_note_types
- 列出所有可用的笔记类型create_note_type
- 创建新的笔记类型get_note_type_info
- 获取特定笔记类型的详细结构anki://decks/all
- 所有可用卡组的完整列表anki://note-types/all
- 所有可用笔记类型的列表anki://note-types/all-with-schemas
- 所有笔记类型的详细结构信息anki://note-types/{modelName}
- 特定笔记类型的详细结构信息将服务器添加到您的 claude_desktop_config.json 文件中:
{
"mcpServers": {
"anki": {
"command": "npx",
"args": ["--yes","anki-mcp-server"]
}
}
}

在 VSCode 的设置文件 cline_mcp_settings.json 中添加服务器至 Cline MCP 设置:
{
"mcpServers": {
"anki": {
"command": "npx",
"args": ["--yes","anki-mcp-server"]
}
}
}

npm install
npm run build
npm run watch
运行测试套件:
npm test

这会执行以下方面的测试:
由于 MCP 服务器通过 stdio 进行通信,我们建议使用 MCP Inspector:
npm run inspector
它提供了基于浏览器的界面来:
Create a new Anki deck called "Programming"
Create an Anki card in the "Programming" deck with: Front: What is a closure in JavaScript? Back: A closure is the combination of a function and the lexical environment within which that function was declared.
Create a cloze card in the "Programming" deck with: Text: In JavaScript, {{c1::const}} declares a block-scoped variable that cannot be {{c2::reassigned}}.
npm test
图标来自 macOS Icons
MIT 许可证 - 详情请参阅 LICENSE 文件