anki-mcp
anki-mcp
一个轻量 Model Context Protocol (MCP) 适配器,让 AI 助手(Claude Code、Hermes Agent 等)可以通过 AnkiConnect 直接创建和管理 Anki 卡片。
无需定制 AI 应用。AI 仍然承担智能层,这个服务器只是连接 Anki 的桥梁。
Claude Code / Hermes / ChatGPT
│ MCP (stdio)
▼
anki-mcp server
│ AnkiConnect HTTP (localhost:8765)
▼
Anki Desktop + AnkiConnect add-on
│ sync
▼
AnkiWeb ──► Anki mobile (iOS/Android)功能
工具 | 描述 |
| 列出所有牌组及卡片数量 |
| 创建牌组(如果不存在) |
| 基础正面/背面卡片 |
| 创建挖空填空卡片( |
| 批量创建多张卡片 |
| 全文搜索(Anki 查询语法) |
| 按笔记 ID 更新卡片的正面/背面 |
| 按笔记 ID 删除卡片 |
Related MCP server: Anki MCP Server
环境搭建
1. 安装 Anki Desktop
从 https://apps.ankiweb.net/ 下载并安装。启动一次 Anki,并用你的 AnkiWeb 账号同步一次,这样移动端同步才能正常工作。
2. 安装 AnkiConnect 插件
AnkiConnect 通过本地 HTTP API 在 localhost:8765 上暴露 Anki 接口。
选项 A — 使用 Anki 插件浏览器(最简单):
在 Anki 中:工具 → 插件 → 获取插件…
输入代码
2055492159并安装。
选项 B — 手动(Git):
cd "$APPDATA/Anki2/addons21" # Windows
# or: ~/.local/share/Anki2/addons21 (Linux)
# or: ~/Library/Application Support/Anki2/addons21 (macOS)
git clone --depth 1 https://github.com/FooSoft/anki-connect.git 2055492159
cd 2055492159
cp plugin/*.py plugin/*.json plugin/*.md .
rm -rf plugin tests .git 2>/dev/null重启 Anki,确认其运行正常:
curl -s http://127.0.0.1:8765 -X POST -d '{"action":"version","version":6}'
# → {"result": 6, "error": null}3. 运行 MCP 服务器
pip install mcp
python server.py该服务器通过 stdio 使用 MCP 协议进行通信。要让工具正常工作,Anki Desktop 必须处于运行状态(且已加载 AnkiConnect)。
在客户端中配置
Hermes Agent
将配置添加到 ~/.hermes/config.yaml(Windows 上为 %USERPROFILE%\AppData\Local\hermes\config.yaml):
mcp_servers:
anki:
command: python
args:
- /absolute/path/to/server.py
timeout: 60
connect_timeout: 30然后,在会话中重新加载 MCP(/reload-mcp)或重启。工具会以 mcp_anki_* 的形式出现。
Claude Code
claude mcp add anki -- python /absolute/path/to/server.py用法
连接配置好后,只需告诉 AI 你想要什么:
"在我的 System Design 牌组中添加一张卡片:front = '为什么一致性哈希需要虚拟节点?',back = '为了让键分布更均匀。'"
"把我们刚才讨论的重要概念做成 Anki 卡片。"
卡片生成规则(把这些规则加入 AI 的系统提示中)
每张卡片聚焦一个概念。
优先使用需要回忆的设问方式。
避免过长的答案。
不要为琐碎的事实创建卡片。
适当使用挖空填空(cloze)卡片。
添加来源/主题标签。
同步到移动端
通过 MCP 创建的卡片会一直保存在 Anki Desktop 中,直到你执行同步。触发同步:
手动同步:Anki → 同步(或按
Y),或通过 AnkiConnect:
curl -s http://127.0.0.1:8765 -X POST -d '{"action":"sync","version":6}'
然后同步 Anki 移动应用,即可拉取新卡片。
系统要求
Python 3.10+
mcp包(pip install mcp)Anki Desktop(已运行)
AnkiConnect 插件
许可证
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseNot gradedqualityNot gradedmaintenanceEnables AI assistants like Claude to interact with Anki flashcard decks through AnkiConnect. Supports creating and managing decks, basic and cloze deletion cards, searching existing cards, and organizing content with tags.
- AlicenseNot gradedqualityCmaintenanceEnables interaction with the Anki desktop flashcard application through the Anki-Connect plugin. Supports managing decks, cards, notes, and models, allowing AI assistants to create and query flashcards through natural language.101ISC
- AlicenseAqualityDmaintenanceEnables AI assistants to manage Anki flashcard collections by creating, searching, and updating cards through a standardized interface. It supports media handling, batch operations, and review scheduling via the AnkiConnect add-on.62MIT
- AlicenseAqualityDmaintenanceEnables AI tools to manage Anki flashcards, including deck management, card search, creation, editing, deletion, and statistics.10353Apache 2.0
Related MCP Connectors
AI-powered YouTube to flashcards with spaced repetition and Anki export
Free: turn your AI chats into spaced-repetition vocabulary. 13 tools, reads and writes.
Voice-led, FSRS-scheduled flashcards from YouTube, PDFs, web, or text. Auto-graded quizzes.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Looseling/anki-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server