anki-mcp
Enables safe, review-first Anki authoring with tools to inspect structure, create note types, add notes, preview renderings, and manage cards via AnkiConnect.
README
anki-mcp
MCP server for safe, review-first Anki authoring built on official Anki concepts: profile, deck, note type, note, card, tag, and media.
It is designed for agents that need to inspect existing Anki structure, create or revise note types, add notes, preview the real Anki rendering, and only then release cards into study.
The package was renamed from anki-mcps to @yama662607/anki-mcp. The CLI command is now anki-mcp.
Why this exists
- avoid custom abstractions on top of Anki's own data model
- keep note creation review-first by suspending new cards until they are accepted
- let agents learn from existing decks and note types before writing new content
- keep note type changes additive-safe and validate them before apply
Features
- deck and note discovery for example-driven authoring
- additive-safe note type authoring with
dryRun=trueby default - lightweight note type linting with structured
errorsandwarningsbefore apply - direct note creation with
modelName,deckName,fields, andtags - review-first isolation by suspending new cards until the user keeps them
- optimistic conflict detection for
update_note - batch add/delete note operations with stable per-item outcomes
- local media import for audio and image fields
- frozen v1 contract resource at
anki://contracts/v1/tools
Requirements
- Node.js 22+
- Anki with AnkiConnect enabled
- optional: the
anki-connect-extensionadd-on for read-only native preview instead of edit-dialog fallback
Quick start
- Install
@yama662607/anki-mcpfrom npm. - Start Anki with AnkiConnect enabled.
- Add the MCP server to your client.
- Ask the agent to run
get_runtime_statusfirst. - Use the review-first flow:
add_note->open_note_preview->update_noteorset_note_cards_suspended(false).
For a first-time setup guide, see 5-minute quick start.
Dependency model
AnkiConnectis required for real Anki usageanki-connect-extensionis optional and provides a read-only native preview path- without the extension,
open_note_previewfalls back to opening the edit dialog - in
ANKI_GATEWAY_MODE=memory, neither dependency is required because the server is running in test mode
Installation
From npm
npm install -g @yama662607/anki-mcp
From source
npm install
npm run build
Running
As a local command
anki-mcp
From source
npm run dev
MCP client setup
Codex
Official Codex setup is codex mcp add or ~/.codex/config.toml.
Add the server with the CLI:
codex mcp add anki-mcp \
--env ANKI_CONNECT_URL=http://127.0.0.1:8765 \
--env ANKI_ACTIVE_PROFILE=default \
-- anki-mcp
Equivalent ~/.codex/config.toml entry:
[mcp_servers.anki-mcp]
command = "anki-mcp"
[mcp_servers.anki-mcp.env]
ANKI_ACTIVE_PROFILE = "default"
ANKI_CONNECT_URL = "http://127.0.0.1:8765"
Claude-style clients
Some MCP clients use mcpServers JSON instead.
{
"mcpServers": {
"anki-mcp": {
"command": "anki-mcp",
"env": {
"ANKI_CONNECT_URL": "http://127.0.0.1:8765",
"ANKI_ACTIVE_PROFILE": "default"
}
}
}
}
Environment
ANKI_CONNECT_URLdefault:http://127.0.0.1:8765ANKI_ACTIVE_PROFILEoptional fallback for read toolsANKI_MCP_DB_PATHdefault: user state directory (~/Library/Application Support/anki-mcp/anki-mcp.sqliteon macOS,%LOCALAPPDATA%\anki-mcp\anki-mcp.sqliteon Windows,$XDG_STATE_HOME/anki-mcp/anki-mcp.sqliteor~/.local/state/anki-mcp/anki-mcp.sqliteon Linux)ANKI_GATEWAY_MODE=memoryfor deterministic local tests without Anki
ANKI_MCP_DB_PATH is the internal SQLite path used for idempotency and operational metadata. DRAFT_DB_PATH is still accepted as a backward-compatible fallback.
Core workflow
- Verify setup with
get_runtime_status. - Discover existing structure with
list_decks,list_note_types,get_note_type_schema,search_notes, andget_notes. - Create missing decks with
ensure_deck. - Create or revise note types with
upsert_note_type(dryRun=true)and inspectresult.validation. - Add review-pending content with
add_noteoradd_notes_batch. - Inspect the real Anki rendering with
open_note_preview(the extension path uses a read-only native previewer, not a live editor dialog). - After user feedback, call
update_note,delete_note, orset_note_cards_suspended(suspended=false).
Media workflow
import_media_asset- Insert returned
asset.fieldValueinto the target note field add_noteorupdate_noteopen_note_preview
Main docs
- 5-minute quick start
- Operating model
- Contracts and tool surface
- Note type authoring
- Real Anki E2E
- Migration from pack/card-type APIs
- Public release checklist
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 模型以安全和受控的方式获取实时的网络信息。