Anki MCP Server

Study, create and manage Anki flashcards from an AI client through the AnkiConnect add-on

By AnkiMCP.ai TypeScript Local · stdio Productivity

65 popularity score ★ 547 ↓ 1.1k/wk

Connect your client

Local (npm)

Add in one click

Opens the app, which asks before it adds the server.

Or add it by command or config

Claude CodeTerminal
claude mcp add anki -- npx -y @ankimcp/anki-mcp-server --stdio
Claude Desktopclaude_desktop_config.json
{
  "mcpServers": {
    "anki": {
      "command": "npx",
      "args": [
        "-y",
        "@ankimcp/anki-mcp-server",
        "--stdio"
      ]
    }
  }
}
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "anki": {
      "command": "npx",
      "args": [
        "-y",
        "@ankimcp/anki-mcp-server",
        "--stdio"
      ]
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "anki": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@ankimcp/anki-mcp-server",
        "--stdio"
      ]
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.anki]
command = "npx"
args = ["-y", "@ankimcp/anki-mcp-server", "--stdio"]
Gemini CLITerminal
gemini mcp add --scope user anki npx -- -y @ankimcp/anki-mcp-server --stdio
Local (from source)

Add in one click

Opens the app, which asks before it adds the server. Then replace each <NAME> in its settings with your value.

Or add it by command or config

FirstTerminal
git clone https://github.com/ankimcp/anki-mcp-server.git
cd anki-mcp-server
npm install
npm run build
Claude CodeTerminal
claude mcp add anki -- node '<ABSOLUTE_PATH_TO_CLONE>/dist/main-stdio.js'
Claude Desktopclaude_desktop_config.json
{
  "mcpServers": {
    "anki": {
      "command": "node",
      "args": [
        "<ABSOLUTE_PATH_TO_CLONE>/dist/main-stdio.js"
      ]
    }
  }
}
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "anki": {
      "command": "node",
      "args": [
        "<ABSOLUTE_PATH_TO_CLONE>/dist/main-stdio.js"
      ]
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "anki": {
      "type": "stdio",
      "command": "node",
      "args": [
        "<ABSOLUTE_PATH_TO_CLONE>/dist/main-stdio.js"
      ]
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.anki]
command = "node"
args = ["<ABSOLUTE_PATH_TO_CLONE>/dist/main-stdio.js"]
Gemini CLITerminal
gemini mcp add --scope user anki node -- '<ABSOLUTE_PATH_TO_CLONE>/dist/main-stdio.js'

Settings 12

ANKI_CONNECT_URL Optional: Address of AnkiConnect; http://localhost:8765 by default.
ANKI_CONNECT_API_KEY Optional: Key, if AnkiConnect is configured to require one.
ANKI_CONNECT_TIMEOUT Optional: AnkiConnect request timeout in ms; 5000 by default.
READ_ONLY Optional: true or 1 blocks content changes and manual rescheduling; rating, suspend and sync still work.
MEDIA_IMPORT_DIR Optional: Limit file-path media imports to this folder.
MEDIA_ALLOWED_TYPES Optional: Extra MIME types allowed for file-path imports, comma-separated.
MEDIA_ALLOWED_HOSTS Optional: Private network hosts allowed for URL imports, comma-separated.
PORT Optional: HTTP mode port; 3000 by default.
HOST Optional: HTTP mode bind address; 127.0.0.1 by default.
ALLOWED_HOSTS Optional: HTTP mode: extra Host header values to accept when bound beyond loopback.
TUNNEL_SERVER_URL Optional: Tunnel mode: WebSocket server; wss://tunnel.ankimcp.ai by default.
LOG_LEVEL Optional: debug, info, warn or error; info by default.

What it does

Anki MCP Server is a Node.js process that sits between an MCP client and a running copy of the Anki desktop app. It does not open the Anki collection file itself: every action goes as a request to the AnkiConnect add-on, which listens on http://localhost:8765 by default.

With it an assistant can run a review session (fetch due cards, show the front, record an Again/Hard/Good/Easy rating), add notes one at a time or up to 100 in one call, search notes with Anki's query syntax, edit fields, manage tags, decks and note types (fields, templates, CSS), store and fetch media, read deck and review statistics, and drive parts of the Anki window such as the card browser and the Add dialog.

It runs over stdio for desktop clients, as a local Streamable HTTP server (the default when no flag is given), or through a tunnel so a cloud-hosted assistant can reach the Anki on your machine. Its makers now point most users to their AnkiMCP add-on, which runs the server inside Anki; this npm package remains maintained and is the route for stdio clients and the Claude Desktop .mcpb bundle.

Beyond the 53 tools the README lists, version 0.27.0 also registers two MCP prompts (a review-session prompt and a twenty-rules prompt for writing cards) and a system-info resource (src/mcp/primitives/essential/index.ts). Its config schema also reads LOG_LEVEL (debug, info, warn or error; info by default) and a 5000 ms AnkiConnect timeout unless ANKI_CONNECT_TIMEOUT is set (src/config/config.schema.ts). The project is still pre-1.0 and its versioning note allows breaking changes in 0.x releases.

What it needs

RuntimeNode.js 22+

Node.js 22.12.0 or newer (npx comes with it). The Anki desktop app must be running with the AnkiConnect add-on installed; if AnkiConnect is set to require a key, pass it as ANKI_CONNECT_API_KEY. Tunnel mode needs a one-time browser sign-in (ankimcp --login) to the ankimcp.ai tunnel service; the --ngrok flag needs ngrok installed globally with an authtoken. Building from source needs git and npm.

Limits

Works only while Anki is open with AnkiConnect reachable. updateNoteFields fails silently if the note is open in Anki's browser window at the time, an AnkiConnect limitation its README names. createDeck accepts at most two levels (Parent::Child). Media imports by file path accept only image, audio and video types unless MEDIA_ALLOWED_TYPES adds more, and URL imports refuse private and loopback addresses unless MEDIA_ALLOWED_HOSTS lists them. Tunnel mode serves only the 2025 MCP protocol revision, so a client that speaks only 2026-07-28 must use stdio or HTTP. Without a TTY, --tunnel exits until you run --login first.

Who it suits

Suits Anki users who want an assistant to quiz them, write cards in bulk or tidy decks and note types, using a desktop client that starts servers over stdio (Claude Desktop, Cursor, Cline, Zed, opencode). It can change and delete collection content, so --read-only (READ_ONLY=true) is the safer start for exploring. If you only need HTTP or tunnel access for claude.ai or ChatGPT, its makers recommend their AnkiMCP add-on (github.com/ankimcp/anki-mcp-server-addon), which runs inside Anki and needs neither Node.js nor AnkiConnect.

Tools 53

sync
Sync the collection with AnkiWeb
get_due_cards
List cards due for review, optionally for one deck; answers hidden by default
get_cards
List cards filtered by state (due, new, learning, suspended, buried) and deck
present_card
Show the question side of a card for review
rate_card
Record an Again, Hard, Good or Easy rating and schedule the card
forgetCards
Reset cards to new without logging a review
setDueDate
Move cards' next due date without logging a review
areSuspended
Report whether cards are suspended
suspend
Suspend cards so review skips them
unsuspend
Return suspended cards to review
listDecks
List decks, with study-queue counts if asked
deckStats
Detailed statistics for one deck
createDeck
Create an empty deck, up to two levels deep
changeDeck
Move cards to another deck, creating it if missing
addNote
Create one note with fields and tags
addNotes
Create up to 100 notes in one deck and note type
findNotes
Search notes with Anki query syntax
notesInfo
Fetch fields, tags, note type and card IDs of notes
updateNoteFields
Edit the fields of an existing note, HTML allowed
deleteNotes
Delete notes and their cards; needs explicit confirmation
getTags
List every tag in the collection
addTags
Add tags to given notes
removeTags
Remove tags from given notes
replaceTags
Rename a tag on given notes
clearUnusedTags
Delete tags no note uses
getMediaFilesNames
List files in the media folder, optionally by pattern
retrieveMediaFile
Return a media file as base64
storeMediaFile
Add a media file from base64, a local path or a URL
deleteMediaFile
Delete a file from the media folder
modelNames
List note types
modelFieldNames
List the fields of a note type
modelStyling
Return a note type's CSS
modelTemplates
Return a note type's front and back templates
createModel
Create a note type with fields, templates and CSS
updateModelStyling
Replace a note type's CSS
updateModelTemplates
Replace a note type's card templates
addModelField
Add a field to a note type
removeModelField
Remove a field and its content from a note type; needs confirmation
renameModelField
Rename a field in a note type
repositionModelField
Change a field's position in a note type
collection_stats
Statistics across all decks with per-deck breakdown
review_stats
Review history: retention, streaks and time patterns
guiBrowse
Open Anki's card browser with a search
guiSelectCard
Select a card in the card browser
guiSelectedNotes
Return IDs of notes selected in the browser
guiAddCards
Open the Add dialog pre-filled with note details
guiEditNote
Open the editor for a note
guiDeckOverview
Open the overview screen of a deck
guiDeckBrowser
Open the deck list screen
guiCurrentCard
Return the card shown in review mode, answer included
guiShowQuestion
Show the question side of the current card
guiShowAnswer
Show the answer side of the current card
guiUndo
Undo the last action in Anki

Similar servers