anki-mcp
Enables 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.
README
anki-mcp
An MCP server that exposes your local Anki collection to MCP clients such as Claude Desktop and VS Code, through the AnkiConnect add-on.
Note fields are HTML and are passed through verbatim, so cards can be generated with cloze deletions, bold/italic, and highlight.js-styled code blocks.
Tools
Read
anki_check_connection— verify Anki is running and AnkiConnect is reachableanki_list_decks— every deck (::denotes nesting)anki_list_models— every note typeanki_get_model_fields— a note type's field names, in template orderanki_find_notes— note ids matching an Anki search queryanki_get_notes_info— full note details: model, tags, fields, cards
Write
anki_create_deck— create a deck, including missing parentsanki_add_note— add one note (fields are HTML, sent unescaped)anki_add_notes— add a batch sharing one deck and note typeanki_update_note_fields— overwrite fields of an existing noteanki_sync— sync the collection with AnkiWeb
Requirements
- uv
- Anki, running — the server talks to the live application, not the collection file
- The AnkiConnect add-on: Anki → Tools → Add-ons → Get Add-ons → code
2055492159, then restart Anki
Setup
uv sync
cp .env.example .env
.env (all optional — the defaults work for a standard local Anki):
ANKI_CONNECT_URL=http://localhost:8765
ANKI_TIMEOUT=30
Run it:
uv run anki-mcp
Check it can reach Anki:
uv run python scripts/smoke_client.py
Use with Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"anki": {
"command": "uv",
"args": ["run", "--directory", "/absolute/path/to/anki-mcp", "anki-mcp"]
}
}
}
No secrets to pass — AnkiConnect is unauthenticated and local.
Remote (HTTP) hosting
Set MCP_TRANSPORT=http to serve over streamable-http (endpoint /mcp):
MCP_TRANSPORT=http HOST=0.0.0.0 PORT=8000 uv run anki-mcp
This is of limited use here. AnkiConnect binds to localhost on the machine where Anki runs, so a remotely hosted instance of this server has nothing to connect to — every tool would fail. The transport toggle exists for structural parity with a normal MCP server; making it genuinely useful would need a tunnel back to the desktop (a WebSocket relay or similar), which is out of scope. Run it locally over stdio.
Conventions
- Fields are HTML. Values in
fieldsare sent to Anki byte for byte — no escaping, no sanitizing."<b>x</b>"renders as a bold x; to show a literal<, send<. - Cloze deletions use
{{c1::...}}and require a cloze note type; the syntax is inert on"Basic". - Field names are case- and space-sensitive (
"Back Extra"). Check them withanki_get_model_fieldsbefore adding notes. - Duplicates:
anki_add_notefails on a duplicate first field;anki_add_notesskips the offending note and reports its index. Both acceptallow_duplicate=True. anki_update_note_fieldssilently does nothing if the note is open in Anki's Browse window — Anki refuses the edit but reports success. Close the browser and retry.- Tool output is Markdown by default; pass
response_format="json"for the raw payload (and for untruncated field HTML). - Anki must stay open, and it stops serving requests while a modal dialog is up.
Development
uv sync --extra dev
uv run pytest # tests (HTTP mocked, no network, no real Anki)
uv run ruff check . # lint
uv run ruff check --fix .
uv run fastmcp inspect src/anki_mcp/server.py:mcp
Security
AnkiConnect has no authentication: anything that can reach port 8765 can read and modify your collection. That is acceptable because it listens on localhost only — do not expose that port, and do not run this server on an untrusted machine. .env is gitignored, though it holds no secrets by default.
This server can create, overwrite, and sync notes. Back up your collection (Anki → File → Export) before letting an agent make bulk changes.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。