@lifeng688/anki-mcp
This MCP server enables LLMs to control a local Anki instance via AnkiConnect, providing comprehensive deck and note management with safety-first design.
Health & Connectivity
ping: Check if the MCP server is runningcheck_anki_connection: Verify AnkiConnect/Anki is reachable
Deck Management
list_decks: Retrieve all available deckscreate_deck: Create new decks, including hierarchical ones using::syntax (e.g.,Parent::Child)
Note Model Inspection
list_note_models: List all available note/card typesget_note_model_fields: Get field names for a specific note model
Note Operations
add_note: Add a single flashcard with fields and optional tagsadd_notes: Batch-add multiple flashcards (supportsdryRunpreview)search_notes: Search notes using Anki's native query syntaxget_notes_info: Retrieve detailed info about specific notes by IDupdate_note_fields: Modify fields of an existing notedelete_notes: Delete notes by ID or search query (requiresconfirm="DELETE_NOTES")
Tag Management
add_tags/remove_tags: Add or remove tags from notes individually or by search query (both default to dry-run)
Sync
sync_anki: Trigger AnkiCloud synchronization (requiresconfirm="SYNC_ANKI")
Safety Features
All mutation operations default to
dryRun=true, allowing changes to be previewed before being appliedDestructive operations require explicit confirmation strings
Duplicate prevention enabled by default
Localhost-only communication — no external data exposure or direct database access
Allows managing Anki decks and notes via AnkiConnect, including adding, updating, searching notes, and deck management.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@@lifeng688/anki-mcp list all my decks"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
@lifeng688/anki-mcp
MCP stdio server for controlling local Anki via AnkiConnect. Enables LLMs (Claude, Cursor, Cline) to manage Anki decks and notes through a standardized tool interface.
v0.2.0 — Controlled write operations with safe defaults (dryRun), tag management, and explicit sync confirmation.
Quick Install
npm install @lifeng688/anki-mcpOr try it instantly:
npx @lifeng688/anki-mcpRelated MCP server: TalkToAnki
Prerequisites
Anki desktop installed
AnkiConnect add-on (code
2055492159) — install via Tools → Add-ons → Get Add-onsNode.js >= 18.0.0
Verify AnkiConnect is running:
curl -X POST http://127.0.0.1:8765 \
-H "Content-Type: application/json" \
-d '{"action":"version","version":6}'
# Expected: {"result":6,"error":null}Core Features
Deck management — List and create decks (including hierarchical
::decks)Note operations — Add, search, update, delete, and inspect notes
Tag management — Add and remove tags on notes by ID or search query
Batch operations — Add multiple notes with per-item result tracking
Safe note deletion — Delete notes with
dryRunpreview and explicit confirmationExplicit sync — Trigger AnkiCloud sync with confirmation guard
Controlled writes — All mutation tools default to
dryRun=trueSafety first —
dryRunsupport for batch writes, duplicate prevention, field validationUnified responses — Consistent success/error envelope across all tools
Security-focused — Localhost only, no DB access, no card content logging
Available Tools
Tool | Description | Side Effects |
| Server health check | None |
| Verify AnkiConnect reachable | None |
| List all decks | None |
| Create a new deck | Creates deck |
| List note models | None |
| Get model fields | None |
| Add single note | Creates note |
| Batch add notes | Creates notes |
| Search notes | None |
| Get note details | None |
| Update note fields | Modifies note |
| Delete notes by ID or query | Deletes notes (requires confirm) |
| Add tags to notes | Modifies note tags |
| Remove tags from notes | Modifies note tags |
| Trigger AnkiCloud sync | Triggers network sync (requires confirm) |
See Tool Schema Reference for full input/output specs.
MCP Client Configuration
Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"anki": {
"command": "node",
"args": ["$(npm root)/@lifeng688/anki-mcp/dist/index.js"]
}
}
}With environment variables:
{
"mcpServers": {
"anki": {
"command": "node",
"args": ["$(npm root)/@lifeng688/anki-mcp/dist/index.js"],
"env": {
"ANKI_CONNECT_URL": "http://127.0.0.1:8765",
"ANKI_CONNECT_VERSION": "6",
"ANKI_DEFAULT_DECK": "Default::MCP",
"ANKI_DEFAULT_MODEL": "Basic",
"ANKI_LOG_LEVEL": "warn"
}
}
}
}Note: Replace
$(npm root)/@lifeng688/anki-mcp/dist/index.jswith the actual resolved path. You can find it with:npm root -g # or npm root
Cursor / Cline
Same JSON format — add to your MCP server configuration. Point args to the installed dist/index.js inside the @lifeng688/anki-mcp package directory.
Global Install
npm install -g @lifeng688/anki-mcpThen configure your client to point to:
<global-npm-root>/@lifeng688/anki-mcp/dist/index.jsEnvironment Variables
Variable | Default | Description |
| (none) | Full AnkiConnect HTTP endpoint (highest priority). Overrides HOST:PORT. |
|
| Host part, used when |
|
| Port part, used when |
|
| AnkiConnect API version |
| (empty) | AnkiConnect API key (if configured) |
|
| Default deck for note operations |
|
| Default note model |
|
| HTTP request timeout in milliseconds |
|
| Log verbosity: |
URL Resolution Priority:
ANKI_CONNECT_URL— if set, used as-is (must point to localhost)ANKI_CONNECT_HOST+ANKI_CONNECT_PORT— composed ashttp://{HOST}:{PORT}http://127.0.0.1:8765— hardcoded default
Security
This server only connects to
http://127.0.0.1:8765(localhost)It does not read/write Anki SQLite databases directly
It does not upload any data externally
ANKI_CONNECT_KEYis never loggeddelete_notes defaults to
dryRun=true; real deletion requiresconfirm="DELETE_NOTES"sync_anki defaults to
dryRun=true; real sync requiresconfirm="SYNC_ANKI"add_tags / remove_tags default to
dryRun=trueimport/export are not in v0.2.0
First-Time Setup
Create a
Test::MCPdeck before making real changesRun
pingandcheck_anki_connectionto verify connectivityUse
add_noteswithdryRun: trueto preview before writingBefore deleting notes, always run
delete_noteswithdryRun: truefirstBefore batch tag operations, run
add_tags/remove_tagswithdryRun: truefirstsync_anki requires explicit
confirm="SYNC_ANKI"for real syncNever expose port 8765 to the network
Documentation
Installation & Configuration — Full setup guide
Tool Schema Reference — All tools: input/output/examples/errors
Roadmap — Feature progression plan (v0.1 → v0.6)
Security Guide — Boundaries, risks, safety policies
Conversation Quality Guide — How LLMs should create cards
Testing Guide — How to run the test suite
License
MIT — See LICENSE for details.
Available Tools
11 toolsadd_noteA
Add a single note (flashcard) to Anki.
Inputs: deckName (required), modelName (required), fields (required), tags, +1 more.
add_notesB
Batch add multiple notes to Anki. Supports dryRun for preview.
Inputs: deckName (required), modelName (required), notes (required), allowDuplicate, +1 more.
check_anki_connectionA
Check if AnkiConnect is reachable and return the connection status.
Inputs: no named parameters.
create_deckB
Create a new Anki deck. Supports hierarchical decks using :: separator.
Inputs: deckName (required).
get_note_model_fieldsB
Get the field names for a specific note model.
Inputs: modelName (required).
get_notes_infoB
Get detailed information about specific notes by their IDs.
Inputs: noteIds (required).
list_decksA
List all available Anki decks.
Inputs: no named parameters.
list_note_modelsA
List all available note models (card types).
Inputs: no named parameters.
pingA
Health check for the MCP server. Returns server metadata without requiring Anki to be running.
Inputs: no named parameters.
search_notesB
Search for notes in Anki using Anki search syntax.
Inputs: query (required), limit.
update_note_fieldsB
Update specific fields of an existing note. Supports dryRun.
Inputs: noteId (required), fields (required), dryRun.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 11 tools
Each tool has a clearly distinct purpose: single vs batch note addition, deck vs model listing, search vs info retrieval, etc. No overlapping responsibilities.
All tools follow a consistent snake_case verb_noun pattern (e.g., add_note, list_decks, search_notes). No deviations or mixed conventions.
11 tools provide a well-scoped set for Anki interaction—covering deck creation, note operations, search, and health checks—without being excessive or insufficient.
The set covers core note and deck operations, but lacks delete functionality (delete_note, delete_deck) and update deck operations, leaving some lifecycle gaps.
Maintenance
Related MCP Connectors
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Remote MCP server for supportsheep: run AI interviews and manage support content for your blog.
Remote MCP server for supportsheep: run AI interviews and manage support content for your blog.
MCP server for Clipkit — gives AI agents a video toolbox via the Clipkit schema.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceAn MCP server that enables AI assistants to interact with the Anki flashcard application for studying, deck management, and note creation. It supports natural language interaction for reviewing cards, searching content, and managing media files across local and remote environments.981 npm556MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that enables AI assistants to seamlessly manage Anki flashcards, decks, and templates through the AnkiConnect API. It supports intelligent querying, batch note creation, and detailed study progress analysis using natural language.4MIT
- AlicenseAqualityDmaintenanceThe simplest and most stable MCP server for Anki, enabling LLMs to perform core Anki operations (CRUD) directly without addons.1317MIT
- AlicenseAqualityDmaintenanceMCP server for Anki via AnkiConnect, enabling creation, search, and management of flashcards directly from Claude Code or any MCP client.11MIT