Anki add-on: Anki MCP Server

✅ Migration complete ankimcp.ai is back up, and a lot of new functionality shipped along the way. We're still actively monitoring, so tunnel connections may be occasionally unstable over the next few days — please report anything broken . Local use ( http://127.0.0.1:3141 ) is unaffected and needs no account. Updated documentation covering the new features is on its way and will land within the next few days. __________________________________________ Seamlessly integrate Anki with AI assistants through the Model Context Protocol Note: 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. 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. The local HTTP server is protected against DNS rebinding by default — it only accepts loopback Host / Origin requests, so ordinary local use needs no setup. Part of the ankimcp.ai project. Features Local HTTP server - Runs on http://127.0.0.1:3141/ by default Remote tunnel - Optional public HTTPS URL via the AnkiMCP tunnel relay, for reaching your collection from anywhere (requires an ankimcp.ai account) 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. DNS-rebinding protection - The HTTP server validates Host / Origin headers against a loopback allowlist by default; extend it via http_allowed_hosts / http_allowed_origins for tunnel/reverse-proxy exposure Optional API key - Require an Authorization: Bearer token on the HTTP transport via http_api_key (AnkiConnect-style; empty = disabled) Cross-platform - Works on macOS, Windows, and Linux (x64 and ARM) Tool filtering - Disable specific tools or actions to reduce token usage CORS support - Configurable origins for browser-based MCP clients Toolbar status indicator - A ● AnkiMCP item in the top toolbar shows tunnel connection state at a glance (opt out via show_toolbar_indicator ) Diagnostic logging - Opt-in log_to_file writes a rotating, secret-redacted log to user_files/ankimcp.log , and the settings dialog adds "Open log folder" / "Copy diagnostics" buttons to make troubleshooting easy Field management - Add, rename, and reposition note-type fields from AI clients via the model_fields tool (with an opt-in destructive remove) Bulk card stats - The read-only cards_stats tool returns compact per-card scheduling metrics (type, queue, interval, tags, dueToday ) for a whole deck including subdecks, FSRS-independent — a lean bulk read for analytics What's New in v0.26.0 Event-driven request dispatch - The MCP request pipeline no longer polls Anki's main thread 40 times a second waiting for work. Requests are now handed off the instant they arrive, which removes all idle-time wakeups (lower background CPU use when nothing is happening) and trims per-request latency (no up-to-25ms wait for the next poll tick). Purely internal — no configuration or client-visible behavior change ( #65 ) What's New in v0.25.x Hideable Tools-menu item - New show_settings_menu_item config flag (default true ): set it to false to hide the AnkiMCP Server Settings... entry in Anki's Tools menu, useful for locked-down or kiosk-style setups. The settings dialog stays reachable via the toolbar indicator (takes effect after an Anki restart) Deck-scoped tag listing - The tag_management tool's get_tags action gains an optional deck parameter: pass a deck name to get just the distinct tags on notes with a card in that deck (subdecks included), instead of every tag in the collection. This lets an AI client discover which tags actually apply to a given deck in one lean call, rather than paging through per-card stats and de-duping by hand. Omit the parameter for the original all-collection behavior ( #63 ) Bulk card stats with cards_stats - New read-only cards_stats tool returns compact per-card scheduling metrics — type, queue, interval, the note's tags, and a computed dueToday flag — for a whole deck (subdecks included), paginated. It's FSRS-independent (works whether or not FSRS is enabled), so one lean call can replace a find_notes + notes_info + get_card_memory_state sequence when you only need scheduling data ( #62 ) Asynchronous sync - The sync tool moves to a non-blocking job model: sync() starts a sync and returns a job id, sync(job_id) polls its status, and sync(job_id, resolve=...) resolves a full-sync conflict — so a long sync no longer blocks the MCP call ( #62 ) What's New in v0.24.0 Preview bulk edits with dry_run - update_notes gains a dry_run=true option that runs the full validation pass (field names, note existence, ID validity) and reports which notes would be updated — without writing anything — so you can safely preview a large bulk edit before committing it. Mirrors the existing delete_notes dry run ( #59 ) delete_notes respects max_notes_per_batch - delete_notes no longer caps at a hardcoded 100 notes; it now honors the max_notes_per_batch config like the other batch tools, so raising that limit applies to deletes too ( #59 ) Fix: startup crash when another add-on bundles an old packaging - On Anki 26.05+ (Python 3.13), if another add-on (for example AMBOSS) had already loaded an older packaging into the shared Python process, AnkiMCP's first-run pydantic_core download failed with No module named 'distutils' . AnkiMCP now forces its own bundled packaging when selecting the download, regardless of what other add-ons have loaded, so the download succeeds; already-affected installs self-heal on the next launch ( #61 ) Docs: connecting via Opencode - Added setup instructions for the Opencode terminal AI agent ( #60 ) What's New in v0.23.0 Manage note-type fields - New model_fields tool adds, renames, and repositions fields on an existing note type, so AI clients can reshape a note type without opening the Fields dialog by hand. A fourth action, remove , permanently deletes a field and all its content, so it's treated as destructive: hidden from MCP clients by default and revealed only when you opt in via enabled_destructive_tools . Every action changes the note-type schema, so each result warns that the next sync will be a one-way full sync (overwriting AnkiWeb and your other devices); renames also flag that {{Field}} references in card templates aren't rewritten automatically ( #57 ) What's New in v0.22.0 Diagnostic file logging - New opt-in log_to_file setting writes a rotating log to user_files/ankimcp.log with secrets (API keys, tokens) redacted. The settings dialog gains "Open log folder" and "Copy diagnostics" buttons, so when the add-on can't start (for example a blocked pydantic_core download) you can capture and share the real cause instead of a cryptic error More resilient first-run dependency download - The runtime pydantic_core download is hardened: it retries transient file locks, uses an atomic cache swap so a flaky re-download never destroys a working install, and reports the real failure reason (network, DNS, SSL, etc.) instead of a generic "not available" Clearer dependency-conflict diagnostics - When another add-on has already loaded a shared library, the startup warning now reports the actual version and file path of the conflicting copy, making cross-add-on issues easier to pin down Older releases (v0.21.x and earlier) are listed on the GitHub releases page . Installation From AnkiWeb (recommended) Go to Tools → Add-ons → Get Add-ons... Enter code: 124672614 Restart Anki From GitHub Releases Download from Releases Double-click to install, or use Tools → Add-ons → Install from file Restart Anki Connect with Claude Desktop Requires Node.js . 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"] } } } Connect with Claude Code claude mcp add anki --transport http http://127.0.0.1:3141/ Available Tools Essential Tools sync - Synchronize collection with AnkiWeb (asynchronous job: start a sync, poll its status, resolve full-sync conflicts) list_decks - List all decks with review counts create_deck - Create a new deck find_notes - Search for notes using Anki's search syntax notes_info - Get detailed information about notes (supports include_fields / exclude_fields for response filtering) add_note - Add a new note to a deck add_notes - Batch-add up to max_notes_per_batch notes (default 100) with atomic undo and partial success update_note_fields - Update fields of existing notes update_notes - Batch-update fields of multiple notes in one atomic undo step (validates every entry first; partial success) delete_notes - Delete notes from the collection get_due_cards - Get cards due for review (supports voice mode) cards_stats - Bulk per-card scheduling stats for a deck (subdecks included): type, queue, interval, tags, and a computed dueToday flag, paginated. FSRS-independent 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 for a note type model_styling - Get CSS styling for a note type update_model_styling - Update CSS styling for a note type model_templates - Read the Front/Back HTML templates for each card type update_model_templates - Update Front/Back template HTML (rejects unrecognized keys) create_model - Create a new note type store_media_file - Store a media file (image/audio) via base64, file path, or URL. Validates media type and blocks 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) Multi-Action Tools card_management - 9 actions: reposition, change_deck, bury, unbury, suspend, unsuspend, set_flag, set_due_date, forget_cards tag_management - 6 actions: add_tags, remove_tags, replace_tags, get_tags, clear_unused_tags, batch_tags filtered_deck - 5 actions: create_or_update, rebuild, empty, delete, get_info model_fields - Manage note-type fields: add, rename, reposition (plus an opt-in destructive remove). Each action triggers a one-way full sync on the next sync FSRS Tools get_fsrs_params - Get FSRS scheduler parameters for deck presets set_fsrs_params - Update FSRS parameters (weights, retention, max interval) get_card_memory_state - Get FSRS memory state (stability, difficulty, retrievability) optimize_fsrs_params - Run FSRS parameter optimization GUI Tools 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 system_info - Anki version, profile, and scheduler info query_syntax - Anki search query syntax reference schema - Data model documentation (entities, fields, relationships) stats_today - Today's study statistics stats_forecast - 30-day review forecast stats_collection - Overall collection statistics fsrs_config - FSRS configuration and parameters Prompts review_session - Guided review session (interactive, quick, or voice mode) Configuration Edit via Anki's Tools → Add-ons → AnkiMCP Server → Config: { "http_enabled": true, "http_port": 3141, "http_host": "127.0.0.1", "http_path": "", "http_allowed_hosts": [], "http_allowed_origins": [], "http_api_key": "", "cors_origins": [], "cors_expose_headers": ["mcp-protocol-version"], "disabled_tools": [], "enabled_destructive_tools": [], "max_notes_per_batch": 100, "tunnel_server_url": "wss://tunnel.ankimcp.ai", "tunnel_client_id": "ankimcp-cli", "media_import_dir": "", "media_allowed_types": [], "media_allowed_hosts": [], "show_toolbar_indicator": true, "log_to_file": false } Use disabled_tools to hide tools or actions from AI clients: "sync" — disables the entire tool "card_management:bury" — disables a specific action Use enabled_destructive_tools to opt in to high-risk actions that are hidden by default, e.g. "model_fields:remove" to expose the destructive field-removal action. Requirements Anki 25.07 or later (Python 3.13). Earlier versions ship Python 3.9 which is not supported. 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. License AGPL-3.0-or-later Links ankimcp.ai - Project homepage GitHub - Source code & issues MCP Protocol - Model Context Protocol specification

GitHub repository: ankimcp/anki-mcp-server-addon
Repository description: An Anki addon that implements an MCP server, enabling AI assistants to interact with Anki, the spaced repetition flashcard application.
Languages: Python, HTML, Shell, Makefile, Nix
Topics: ai, anki-addon, anki-mcp, mcp