freshcrate
Skin:/
Home > MCP Servers > anki-mcp-server-addon

anki-mcp-server-addon

An Anki addon that implements an MCP server, enabling AI assistants to interact with Anki, the spaced repetition flashcard application.

Why this rank:Strong adoptionRecent releaseHealthy release cadence

Description

An Anki addon that implements an MCP server, enabling AI assistants to interact with Anki, the spaced repetition flashcard application.

README

AnkiMCP Server (Addon)

An Anki addon that exposes your collection to AI assistants via the Model Context Protocol (MCP).

What is this?

AnkiMCP Server runs a local MCP server inside Anki, allowing AI assistants like Claude to interact with your flashcard collection. This enables AI-powered study sessions, card creation, and collection management.

Part of the ankimcp.ai project.

Note on First Run

On first run, this addon downloads pydantic_core (~2MB) from PyPI. This is required because pydantic_core contains platform-specific binaries (Windows/macOS/Linux) that cannot be bundled in a single addon file.

Features

  • Local HTTP server - Runs on http://127.0.0.1:3141/ by default
  • MCP protocol - Compatible with any MCP client (Claude Desktop, etc.)
  • Auto-start - Server starts automatically when Anki opens
  • Tunnel-friendly - Works with Cloudflare Tunnel, ngrok, etc.
  • Cross-platform - Works on macOS, Windows, and Linux (x64 and ARM)

Installation

From AnkiWeb (recommended)

  1. Open Anki and go to Tools โ†’ Add-ons โ†’ Get Add-ons...
  2. Enter code: 124672614
  3. Restart Anki

From GitHub Releases

  1. Download anki_mcp_server.ankiaddon from Releases
  2. Double-click to install, or use Tools โ†’ Add-ons โ†’ Install from file...
  3. Restart Anki

NixOS

With flakes (recommended)

Add the flake input and use the pre-built package:

# flake.nix
{
  inputs.anki-mcp.url = "github:ankimcp/anki-mcp-server-addon";

  outputs = { nixpkgs, anki-mcp, ... }: {
    # Option A: Standalone โ€” Anki with the addon pre-installed
    environment.systemPackages = [
      anki-mcp.packages.${system}.default
    ];

    # Option B: Composable with other addons via overlay
    nixpkgs.overlays = [ anki-mcp.overlays.default ];
    environment.systemPackages = [
      (pkgs.anki.withAddons [ pkgs.ankiAddons.anki-mcp-server ])
    ];
  };
}

Without flakes

# configuration.nix
{ pkgs, ... }:
let
  python3 = pkgs.python3;

  ankiMcpPythonDeps = python3.withPackages (ps: with ps; [
    mcp pydantic pydantic-settings starlette uvicorn anyio httpx websockets
  ]);

  anki-mcp-server = pkgs.anki-utils.buildAnkiAddon (finalAttrs: {
    pname = "anki-mcp-server";
    version = "0.13.0";
    src = pkgs.fetchFromGitHub {
      owner = "ankimcp";
      repo = "anki-mcp-server-addon";
      rev = "v${finalAttrs.version}";
      hash = ""; # nix will tell you the correct hash on first build
    };
    sourceRoot = "${finalAttrs.src.name}/anki_mcp_server";
  });

  ankiWithMcp = pkgs.anki.withAddons [ anki-mcp-server ];

  ankiWrapped = pkgs.symlinkJoin {
    name = "anki-with-mcp";
    paths = [ ankiWithMcp ];
    nativeBuildInputs = [ pkgs.makeWrapper ];
    postBuild = ''
      wrapProgram $out/bin/anki \
        --prefix PYTHONPATH ':' "${ankiMcpPythonDeps}/${python3.sitePackages}"
    '';
  };
in
{
  environment.systemPackages = [ ankiWrapped ];
}

Usage

The server starts automatically when you open Anki. Check status via Tools โ†’ AnkiMCP Server Settings...

Connect with Claude Desktop

Requires Node.js installed. Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "anki": {
      "command": "npx",
      "args": ["mcp-remote", "http://127.0.0.1:3141"]
    }
  }
}

Note: Claude Desktop doesn't natively support HTTP servers in its JSON config โ€” mcp-remote bridges the connection via stdio.

Connect with Claude Code

claude mcp add anki --transport http http://127.0.0.1:3141/

Configuration

Edit via Anki's Tools โ†’ Add-ons โ†’ AnkiMCP Server โ†’ Config:

{
  "mode": "http",
  "http_port": 3141,
  "http_host": "127.0.0.1",
  "http_path": "",
  "cors_origins": [],
  "cors_expose_headers": ["mcp-session-id", "mcp-protocol-version"],
  "auto_connect_on_startup": true,
  "disabled_tools": [],
  "media_import_dir": "",
  "media_allowed_types": [],
  "media_allowed_hosts": []
}

Disabling Tools

Hide specific tools or actions from AI clients to reduce token usage:

{
  "disabled_tools": [
    "sync",
    "card_management:bury",
    "card_management:unbury"
  ]
}
  • "tool_name" โ€” disables the entire tool
  • "tool_name:action" โ€” disables a specific action within a multi-action tool

Disabled tools are removed from the MCP schema entirely โ€” AI clients never see them. Typos in tool/action names will produce console warnings.

Custom Path

Set http_path to serve the MCP endpoint under a custom path. Useful when exposing Anki via a tunnel (Cloudflare, ngrok) to avoid a fully open endpoint:

{
  "http_path": "my-secret-path"
}

The server will be accessible at http://localhost:3141/my-secret-path/ instead of the root. Leave empty for default behavior.

CORS Configuration

To allow browser-based MCP clients (like web-hosted MCP Inspector), add allowed origins:

{
  "cors_origins": ["https://inspector.example.com", "http://localhost:5173"]
}

Use ["*"] to allow all origins (not recommended for production).

The cors_expose_headers setting controls which response headers browsers can read. The defaults (mcp-session-id, mcp-protocol-version) are required for the MCP Streamable HTTP protocol to work in browsers.

Media Security

Thanks to Hideaki Takahashi (Columbia University) for responsibly disclosing the media path traversal vulnerability.

The store_media_file tool validates all inputs to prevent path traversal and SSRF attacks:

  • File paths are restricted to media files only (images, audio, video) via MIME type checking
  • URLs must use http:// or https:// and cannot target private/internal networks
  • Filenames are sanitized to remove path traversal sequences

Optional hardening via config:

{
  "media_import_dir": "/Users/me/anki-media",
  "media_allowed_types": ["application/pdf"],
  "media_allowed_hosts": ["192.168.1.50", "my-nas.local"]
}
  • media_import_dir โ€” restrict file path imports to this directory tree (empty = no restriction)
  • media_allowed_types โ€” allow additional MIME types beyond image/audio/video
  • media_allowed_hosts โ€” allow specific hosts to bypass private network blocking

Available Tools

Essential Tools

Tool Description
sync Synchronize collection with AnkiWeb
list_decks List all decks in the collection
create_deck Create a new deck
find_notes Search for notes using Anki's search syntax
notes_info Get detailed information about notes
add_note Add a new note to a deck
add_notes Batch-add up to 100 notes sharing the same deck and model. Uses Anki's native batch API for atomic undo. Supports partial success โ€” individual failures don't affect others
card_management Manage cards with 9 actions: reposition (set learning order), change_deck (move between decks), bury/unbury (hide until tomorrow), suspend/unsuspend (indefinitely exclude from review), set_flag (color flags 0-7), set_due_date (reschedule with days DSL), forget_cards (reset to new)
tag_management Manage tags with 5 actions: add_tags/remove_tags (bulk add/remove on notes), replace_tags (swap one tag for another), get_tags (list all), clear_unused_tags (remove orphans)
filtered_deck Filtered deck lifecycle: create_or_update (create or modify filtered decks with search terms), rebuild (repopulate), empty (return cards to home decks), delete
update_note_fields Update fields of existing notes
delete_notes Delete notes from the collection
get_due_cards Get next due card for review (supports skip_images/skip_audio for voice mode)
present_card Get card content for review
rate_card Rate a card after review (Again/Hard/Good/Easy)
model_names List available note types
model_field_names Get field names and descriptions for a note type
model_styling Get CSS styling for a note type
update_model_styling Update CSS styling for a note type
create_model Create a new note type
store_media_file Store a media file (image/audio) via base64, file path, or URL. File paths are validated against a media-type allowlist; URLs are checked for SSRF
get_media_files_names List media files matching a pattern
delete_media_file Move a media file to Anki's trash (recoverable via Check Media)

FSRS Tools

Tool Description
get_fsrs_params Get FSRS scheduler parameters for deck presets
set_fsrs_params Update FSRS parameters (weights, desired retention, max interval)
get_card_memory_state Get FSRS memory state (stability, difficulty, retrievability) for cards
optimize_fsrs_params Run FSRS parameter optimization using Anki's built-in optimizer

GUI Tools

These tools interact with Anki's user interface:

Tool Description
gui_browse Open the card browser with a search query
gui_add_cards Open the Add Cards dialog
gui_edit_note Open the note editor for a specific note
gui_current_card Get info about the currently displayed card
gui_show_question Show the question side of current card
gui_show_answer Show the answer side of current card
gui_select_card Select a specific card in the reviewer
gui_deck_browser Navigate to deck browser
gui_undo Undo the last operation

Resources

Resource URI Description
system_info anki://system-info Anki version, profile, and scheduler info
query_syntax anki://query-syntax Anki search query syntax reference
schema anki://schema Data model documentation (entities, fields, relationships)
stats_today anki://stats/today Today's study statistics
stats_forecast anki://stats/forecast 30-day review forecast
stats_collection anki://stats/collection Overall collection statistics
fsrs_config anki://fsrs/config FSRS configuration summary and parameters

Prompts

Prompt Description
review_session Guided review session workflow (interactive, quick, or voice mode)

Requirements

  • Anki 25.07 or later (ships Python 3.13)
  • Anki 25.02 and earlier ship Python 3.9, which is not supported โ€” the MCP SDK requires Python 3.10+ (#8)

Architecture

The addon runs an MCP server in a background thread with HTTP transport (FastMCP + uvicorn). All Anki operations are bridged to the main Qt thread via a queue system, following the same proven pattern as AnkiConnect.

For details, see Anki Add-on Development Documentation.

Development

Running E2E Tests

E2E tests run against a real Anki instance in Docker using headless-anki.

# Install test dependencies
python -m venv .venv
source .venv/bin/activate
pip install -r requirements-dev.txt

# Build the addon
./package.sh

# Start Anki container
cd .docker && docker compose up -d && cd ..

# Run tests (waits for server automatically)
pytest tests/e2e/ -v

# Stop container
cd .docker && docker compose down

Or use the Makefile shortcuts:

make e2e        # Build, start container, run tests, stop
make e2e-up     # Just start container
make e2e-test   # Just run tests
make e2e-down   # Just stop container

CI

E2E tests run automatically on push to any branch and on PRs to main. See .github/workflows/e2e.yml.

License

AGPL-3.0-or-later

Links

Release History

VersionChangesUrgencyDate
v0.18.0## What's New ### โ— Toolbar status indicator A persistent **`โ— AnkiMCP`** item now sits in Anki's top toolbar and shows the tunnel connection state at a glance: - **grey** โ€” tunnel off / disconnected - **amber** โ€” connecting or reconnecting - **green** โ€” connected Click it to open *AnkiMCP Server Settings*. Shown by default; hide it with the new `show_toolbar_indicator` config option (set `false`, then restart Anki). ### Cleaner tunnel disconnect Disconnecting the tunnel now reliably logs **"High6/5/2026
v0.16.0**Minor release: server now runs in stateless HTTP mode, aligning with the upcoming MCP 2026-07-28 protocol direction.** ## โœจ Features - **Stateless HTTP transport** ([#43](https://github.com/ankimcp/anki-mcp-server-addon/pull/43), closes [#42](https://github.com/ankimcp/anki-mcp-server-addon/issues/42)) โ€” The MCP server no longer emits or requires the `mcp-session-id` header on Streamable HTTP requests. Passes `stateless_http=True` to FastMCP, so each HTTP request gets a fresh transport. ThisHigh5/27/2026
v0.15.1**Patch release with two fixes since v0.15.0.** ## ๐Ÿ› Fixes - **Distro-packaged Anki compatibility** ([#41](https://github.com/ankimcp/anki-mcp-server-addon/pull/41), fixes [#40](https://github.com/ankimcp/anki-mcp-server-addon/issues/40)) โ€” On Arch, Fedora, and other distros where Anki uses system Python with a system-installed `pydantic-core`, the addon previously crashed at startup if that version differed from what our vendored `pydantic` required (`SystemError: incompatible pydantic-core High5/13/2026
v0.15.0## What's new - **Server identity**: addon now exposes its icon and website URL via the MCP protocol (`serverInfo.icons` + `websiteUrl` in the `initialize` response). Spec-aware MCP clients render the branding; claude.ai's connector UI ignores these fields today (tracked upstream as anthropics/claude-ai-mcp#152). - **MCP registry**: ships with `server.json` for publication to the official registry under `ai.ankimcp/anki-mcp-server-addon`. ## Internals - Tightened `mcp` dependency constraint tHigh4/23/2026
v0.14.0## Security Fix: Media Path Traversal & SSRF Prevention Thanks to **[Hideaki Takahashi](https://github.com/Koukyosyumei)** (Columbia University) for responsibly disclosing the media path traversal vulnerability. ### What was fixed - **Path traversal in `store_media_file`** โ€” the `path` parameter accepted arbitrary file paths without validation, allowing reading any file on the system (SSH keys, `.env`, credentials). Now restricted to media MIME types only (image/audio/video) - **SSRF via `stoHigh4/9/2026
v0.13.0## NixOS & Source Install Support This release adds first-class NixOS support and graceful handling for source-based installs. ### What's New - **NixOS support** โ€” Ships a `flake.nix` for one-line NixOS installs. Symlinks nixpkgs Python packages into `vendor/shared/` so the addon works natively with `anki.withAddons`. - **Source install fallback** โ€” When `vendor/` is missing (Nix, pip from source, Guix), the addon detects system-provided packages and uses them instead of crashing. Clear errorMedium4/9/2026
v0.12.0## What's Changed ### New: `get_info` action for `filtered_deck` ([#35](https://github.com/ankimcp/anki-mcp-server-addon/pull/35)) Inspect filtered deck configuration without modifying anything. Retrieves search terms, sort order, card count, and reschedule settings for up to 50 decks at once. ```json {"action": "get_info", "deck_ids": [1234567890]} ``` Returns per-deck details including: - `search_terms` โ€” each term's search query, card limit, and sort order (human-readable, e.g. "random" iMedium4/4/2026
v0.11.0## What's Changed ### New: Dry-run deletions ([#33](https://github.com/ankimcp/anki-mcp-server-addon/pull/33)) `delete_notes` now supports `dry_run=true` to preview what would be deleted without actually deleting anything. Returns the same response shape (deletedCount, cardsDeleted, notFoundCount) so you can inspect before committing. ```json {"notes": [1234, 5678], "confirmDeletion": true, "dry_run": true} ``` The `confirmDeletion` safeguard is ignored during dry runs โ€” no confirmation needMedium3/28/2026
v0.10.0## What's Changed ### Fix: Multi-session response routing ([#21](https://github.com/ankimcp/anki-mcp-server-addon/issues/21)) Multiple concurrent MCP sessions (e.g., Claude Code + Claude Desktop, or multi-agent workflows) now work correctly. Previously, the shared response queue could misroute responses between sessions. The fix replaces the shared `response_queue` with per-request response routing โ€” each request gets its own private queue keyed by `request_id`. Community-tested with **29 conMedium3/26/2026
v0.9.0## What's Changed ### New: `add_notes` batch tool ([#24](https://github.com/ankimcp/anki-mcp-server-addon/issues/24)) Add up to 100 notes in a single call, sharing the same deck and model. Uses Anki's native batch API for a single backend call with atomic undo. ```json { "deck_name": "Spanish", "model_name": "Basic", "tags": ["vocab"], "notes": [ {"fields": {"Front": "hola", "Back": "hello"}}, {"fields": {"Front": "adiรณs", "Back": "goodbye"}, "tags": ["farewell"]}, {"fieldLow3/14/2026
v0.8.0## What's Changed ### New: `setDueDate` action in `card_management` tool ([#22](https://github.com/ankimcp/anki-mcp-server-addon/issues/22)) Reschedule cards by setting their due date. Supports Anki's flexible day string format: ```json {"params": {"action": "setDueDate", "card_ids": [123], "days": "5"}} ``` | Format | Meaning | |--------|---------| | `"0"` | Due now | | `"5"` | Due in 5 days | | `"5-7"` | Random range (5-7 days) | | `"5!"` | Due in 5 days + reset interval | New/learning caLow3/10/2026
v0.7.0## What's Changed ### New: `setFlag` action in `card_management` tool Set or remove colored flags on cards. Flag values: 0=none/remove, 1=red, 2=orange, 3=green, 4=blue, 5-7=custom user flags. ```json {"params": {"action": "setFlag", "card_ids": [123], "flag": 1}} ``` Setting `flag: 0` removes the flag from cards. ### Fix: `updateNoteFields` parameter schema (#19) AI clients couldn't discover `updateNoteFields` parameters because the tool used an opaque `dict[str, Any]` parameter that producLow3/6/2026
v0.6.0## What's Changed ### New: `filtered_deck` tool Multi-action tool for managing filtered (cram) decks โ€” the full lifecycle in one tool: - **create_or_update**: Create a new filtered deck or update an existing one. Supports 1-2 search terms, configurable card order (11 options matching Anki GUI), reschedule toggle, and allow_empty flag. - **rebuild**: Empty and re-pull cards matching the deck's search terms. - **empty**: Return all borrowed cards to their original decks (scheduling preserved). -Low3/2/2026
v0.5.1## What's Changed ### New: `twenty_rules` prompt Added a new MCP prompt based on Dr. Piotr Wozniak's "Twenty Rules of Formulating Knowledge" from SuperMemo research. When invoked, it guides the AI through creating effective flashcards โ€” applying principles like minimum information, cloze deletion, and avoiding sets/enumerations. Closes #16 (thanks @hoclun-rigsep for the report!) ### Other improvements - Updated CLAUDE.md with accurate auto-discovery docs and E2E test writing guide - Added proLow2/25/2026
v0.5.0## What's Changed * feat: Add FSRS parameter tools and resource by @chrislongros in https://github.com/ankimcp/anki-mcp-server-addon/pull/14 ## New Contributors * @chrislongros made their first contribution in https://github.com/ankimcp/anki-mcp-server-addon/pull/14 **Full Changelog**: https://github.com/ankimcp/anki-mcp-server-addon/compare/v0.4.1...v0.5.0Low2/23/2026
v0.4.1## What's Changed ### Improved Settings Dialog (#9) The *Tools โ†’ AnkiMCP Server Settings...* dialog has been upgraded from a plain text popup to a proper Qt dialog: - **Copy URL button** โ€” full server URL (including `http_path` if configured) with one-click copy to clipboard - **Clickable links** โ€” Website and GitHub links open in your browser - Clean layout with status, auto-connect setting, and server URL at a glance **Full Changelog**: https://github.com/ankimcp/anki-mcp-server-addon/compLow2/9/2026
v0.4.0## What's Changed ### Voice-Friendly Review & Media Skip Fix (#10) **Problem**: When using `get_due_cards` with `skip_images` or `skip_audio`, skipped cards remained in the scheduler queue. Attempting to `rate_card` on the next card failed with "not at top of queue" because the Anki V3 scheduler enforces strict queue ordering. **Solution**: Skipped media cards are now automatically buried (temporarily hidden), keeping the scheduler queue clean. This enables voice-only review sessions where imLow2/8/2026
v0.3.4## What's Changed ### Python 3.9 Compatibility Fix (#8) Users on Anki 25.02 and earlier (Python 3.9) now see a clear "Please upgrade Anki" dialog instead of a cryptic traceback. Uses Anki's `AbortAddonImport` API for a clean user experience โ€” no misleading "Add-on Startup Failed" dialog. ### Requirements Updated - **Minimum: Anki 25.07 or later** (ships Python 3.13) - Anki 25.02 and earlier ship Python 3.9, which is not supported โ€” the MCP SDK requires Python 3.10+ **Full Changelog**: httpsLow2/6/2026
v0.3.3## Refactor ### Reverted to relative imports (#7) Replaced all absolute imports with relative imports throughout the codebase, matching the Anki addon ecosystem standard. **Why:** Absolute imports (`from anki_mcp_server.config`) depend on the directory being named `anki_mcp_server`. AnkiWeb installs use the addon ID (`124672614/`) as the directory name, which broke loading. The v0.3.2 `sys.modules` workaround fixed it, but relative imports are the proper solution - they work regardless of dirLow2/5/2026
v0.3.2## Bug Fix ### Addon failed to load when installed from AnkiWeb Fixed `ModuleNotFoundError: No module named 'anki_mcp_server'` when the addon is installed from AnkiWeb (code `124672614`). **Root cause:** AnkiWeb installs use the addon ID as the directory name (`addons21/124672614/`), while `.ankiaddon` file installs use the package name (`addons21/anki_mcp_server/`). Our absolute imports (`from anki_mcp_server.config import Config`) only worked with the latter. **Fix:** Added `sys.modules` aLow2/5/2026
v0.3.1## Bug Fix ### `list_decks` stats were always showing 0 Fixed `list_decks` tool returning zero counts for all deck statistics when `include_stats=true`. **Root cause:** The code used `counts_for_deck_today()` which doesn't exist in modern Anki, plus raw SQL for card counts that was silently failing. **Fix:** Now uses Anki's `scheduler.deck_due_tree()` API (same pattern as AnkiConnect), which provides: - `new_count`, `learn_count`, `review_count` - cards due for study - `total_in_deck` - totaLow2/5/2026
v0.3.0## What's New ### New Features - **Card Management Tool** (#5) - New `card_management` tool with two actions: - `reposition`: Set learning order for NEW cards in the review queue - `changeDeck`: Move cards to a different deck (creates deck if needed) - **True Scheduler Order** (#2) - `get_due_cards` now returns cards in Anki's actual scheduler order, respecting interleaving of new/review/learning cards - **Voice-Mode Review Support** (#3) - New `skip_images` and `skip_audio` parameters fLow2/5/2026
v0.2.0**Full Changelog**: https://github.com/ankimcp/anki-mcp-server-addon/compare/v0.1.1...v0.2.0Low1/11/2026
v0.1.1**Full Changelog**: https://github.com/ankimcp/anki-mcp-server-addon/compare/v0.1.0...v0.1.1Low1/7/2026
v0.1.0**Full Changelog**: https://github.com/ankimcp/anki-mcp-server-addon/commits/v0.1.0Low12/5/2025

Dependencies & License Audit

Loading dependencies...

Similar Packages

PlanExeCreate a plan from a description in minutesmain@2026-06-07
aiA productive AI coworker that learns, self-improves, and ships work.main@2026-06-06
pipulateLocal First AI SEO Software on Nix, FastHTML & HTMXmain@2026-06-06
mcp-scannerScan MCP servers for potential threats & security findings.4.7.3
discord.py-self-mcpcomprehensive Discord selfbot MCP server using discord.py-selfv1.3.0

More from ankimcp

anki-mcp-serverA Model Context Protocol (MCP) server that enables AI assistants to interact with Anki, the spaced repetition flashcard application.

More in MCP Servers

agentroveYour own Claude Code UI, sandbox, in-browser VS Code, terminal, multi-provider support (Anthropic, OpenAI, GitHub Copilot, OpenRouter), custom skills, and MCP servers.
ProxmoxMCP-PlusEnhanced Proxmox MCP server with advanced virtualization management and full OpenAPI integration.
node9-proxyThe Execution Security Layer for the Agentic Era. Providing deterministic "Sudo" governance and audit logs for autonomous AI agents.
mcp-compressorAn MCP server wrapper for reducing tokens consumed by MCP tools.