anki-mcp
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., "@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.
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_add_tags/anki_remove_tags— tag or untag notes by idanki_suspend— suspend (or unsuspend) every card matching a search queryanki_sync— sync the collection with AnkiWeb
Related MCP server: Zettelkasten MCP Server
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=30Run it:
uv run anki-mcpCheck it can reach Anki:
uv run python scripts/smoke_client.pyUse 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-mcpThis 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:mcpSecurity
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
Available Tools
11 toolsanki_add_noteA
Add a single note to a deck.
Field values are HTML and are sent verbatim — do not escape them. Write the markup you want rendered on the card:
fields={
"Text": 'The GIL is released during <b>I/O</b>, so '
'{{c1::threads}} still help for network-bound work.',
"Back Extra": '<pre><code>'
'<span class="hljs-keyword">async def</span> '
'<span class="hljs-title">main</span>(): ...'
'</code></pre>',
}Cloze deletions use {{c1::hidden text}} and require the "Cloze" model
(or another cloze-type note type) — the syntax is inert on "Basic".
Inputs: fields (required), deck_name (required), model_name (required), tags, +2 more. Returns: result
anki_add_notesA
Add several notes at once, sharing one deck and note type.
Field values are HTML and are sent verbatim — do not escape them.
See anki_add_note for the field/cloze conventions; they apply per item.
Inputs: notes (required), deck_name (required), model_name (required), tags, +2 more. Returns: result
anki_check_connectionARead-only
Check that Anki is running and AnkiConnect is reachable.
Call this first when any other Anki tool fails — it distinguishes "Anki is closed" from "the request itself was wrong".
Returns the AnkiConnect API version (6) on success.
Inputs: response_format. Returns: result
anki_create_deckA
Create a deck, if it does not already exist.
Inputs: deck (required), response_format. Returns: result
anki_find_notesARead-only
Find note ids matching an Anki search query.
Uses Anki's own search syntax, the same one as the browser's search bar:
deck:Python notes in a deck (and its subdecks)
deck:Python::Asyncio a specific subdeck
tag:python::asyncio by tag ("tag:none" = untagged)
note:Cloze by note type
"front:*GIL*" wildcard match on a named field
added:7 added in the last 7 days
is:due -is:suspended combine terms; "-" negatesQuote any term containing spaces. Returns ids only — pass them to
anki_get_notes_info to see the actual content.
Inputs: query (required), response_format. Returns: result
anki_get_model_fieldsARead-only
List a note type's field names, in template order.
These are the exact keys anki_add_note expects in its fields dict —
they are case-sensitive and space-sensitive ("Back Extra", not
"back_extra").
Inputs: model_name (required), response_format. Returns: result
anki_get_notes_infoARead-only
Fetch full details for the given note ids.
Returns each note's model, tags, field contents (as stored — i.e. HTML), and the ids of the cards generated from it. Unknown ids come back as empty entries rather than an error.
Markdown output truncates field values for readability; use
response_format="json" to get the untouched HTML.
Inputs: notes (required), response_format. Returns: result
anki_list_decksARead-only
List every deck in the collection.
Nested decks are returned with :: as the separator, e.g.
"Python::Asyncio" is the "Asyncio" subdeck of "Python".
Inputs: response_format. Returns: result
anki_list_modelsARead-only
List every note type (model) in the collection.
Typical built-ins: "Basic", "Basic (and reversed card)", "Cloze".
Use anki_get_model_fields next to learn a model's field names before
adding a note with it.
Inputs: response_format. Returns: result
anki_syncA
Sync the local collection with AnkiWeb.
Requires AnkiWeb credentials already configured in Anki — this cannot log in for you. The action returns nothing on success; a sync conflict opens a modal dialog in Anki, which blocks AnkiConnect until you resolve it (the call will then time out).
Inputs: response_format. Returns: result
anki_update_note_fieldsADestructive
Overwrite fields of an existing note.
Field values are HTML and are sent verbatim — do not escape them.
Each named field is replaced wholesale, not merged; fields left out of
fields keep their current content. Fetch the current values with
anki_get_notes_info (response_format="json") before a partial edit.
⚠️ This silently does nothing if the note is open in Anki's Browse window. Anki refuses the edit to avoid clobbering what you are typing, but AnkiConnect still reports success — no error is raised, and the fields are simply unchanged. If an update seems to have no effect, close the Browse window (or click away from that note) and run it again.
Inputs: fields (required), note_id (required), response_format. Returns: result
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 targets a distinct resource and action, from connection checking to note updates. The only near-overlap is add_note vs add_notes, but their batch semantics are clear from names and descriptions. All other tools are unambiguously separated.
All tools share the 'anki_' prefix and use snake_case with a verb_noun structure (e.g., list_decks, add_note, get_notes_info). The sole deviation is anki_sync, which is a single verb but still follows the same prefix and case convention.
11 tools is a well-scoped set for an Anki MCP server, covering connection health, sync, deck and model introspection, note creation (single and batch), search, retrieval, and field updates. Each tool earns its place without redundancy.
The set covers the core note lifecycle well: create, read, search, and update fields. Minor gaps exist—no delete for notes or decks, and no model creation—but these can be worked around via Anki's GUI, making the surface largely complete for typical flashcard workflows.
Maintenance
Related MCP Connectors
Lets Claude, ChatGPT, and Muse read and update your beckett tasks, notes, calendar, and lists.
Persistent memory layer for AI tools. Save and recall notes across Claude and other MCP clients.
Search, read, and write your Apple Notes from ChatGPT/Claude via a local Mac agent + MCP relay.
MCP-native notes and memory for ChatGPT, Claude, and other AI tools.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables managing notes through a simple MCP server, providing tools to add, retrieve, update, delete, and list notes for use with Claude Desktop.MIT
- FlicenseNot gradedqualityAmaintenanceEnables users to create, link, search, explore, and synthesize atomic notes through Claude and other MCP-compatible clients, using Markdown files backed by a SQLite index.-
- FlicenseNot gradedqualityAmaintenanceEnables Claude and other MCP-compatible clients to create, link, explore, and synthesize atomic notes with semantic relationships, tags, search, and a Markdown-backed knowledge graph.-
- FlicenseNot gradedqualityAmaintenanceEnables Claude and other MCP-compatible clients to create, link, search, explore, and synthesize atomic notes in a bidirectional knowledge graph. Supports tags, note types, semantic link types, and dual Markdown/SQLite storage for AI-assisted knowledge management.-