Anki MCP

by arielbk

363 downloads
Not rated
GitHub

About

Anki MCP gives you conversational access to your Anki flashcards—quiz yourself, create cards, analyze progress, and manage your collection with natural language.

Details

Author
arielbk
Downloads
363
Categories
Other

- Full Anki integration via all 115 AnkiConnect API methods
- Conversational interface for natural language commands
- Bulk operations for managing thousands of cards
- Real-time study statistics and analytics
- Media support for images, audio, and more
- Complex search queries using Anki’s search syntax

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Anki MCP
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Install the package globally with npm install -g @arielbk/anki-mcp, then configure your MCP client (e.g., Claude Desktop) to run the server with the command anki-mcp. Ensure Anki is running with the AnkiConnect plugin installed. Alternatively, clone the repository for a development setup.

manage_flashcards

Create, update, delete, search, inspect, and tag Anki flashcards through one high-level note/card workflow. Use this for note lifecycle work and card lookup, not for deck structure, note-type schema changes, or study scheduling. Mutating operations change the local Anki collection immediately; searches are read-only. Choose `operation` first, then provide the operation-specific IDs, query, fields, tags, or pagination inputs described by the schema.

study_session

Find due cards and apply review-state actions such as answering, suspending, unsuspending, resetting, and relearning cards. Use this for scheduling and review flow, not for editing note content or reorganizing decks. Several operations mutate card state in Anki immediately; `find_due` and `check_status` are read-only. Select `operation`, then pass either `query`, `cardIds`, or `answers` as required for that action.

manage_decks

Create, delete, list, inspect, move cards between, and configure Anki decks. Use this for deck-level organization, not for editing flashcard fields, note types, or study answers. Create, delete, move, and config operations mutate the collection; list and stats/config reads do not. Set `operation` first and supply the matching deck names, card IDs, target deck, or config ID.

get_analytics

Read study analytics and review history for decks, the collection, or specific cards. Use this when the agent needs reporting or diagnostics, not when it needs to mutate Anki data. This tool is read-only but some scopes can return large payloads, so prefer the narrowest scope and explicit card IDs or timestamps when available. Choose `scope`, then provide the deck, cards, or review start timestamp required by that scope.

manage_models

List, create, and modify Anki note types, including fields, templates, and CSS styling. Use this for schema/template work, not for individual note content, decks, or review scheduling. All operations except `list` mutate the collection and can affect future rendering or compatibility of notes using that model. Pick `operation` first, then provide the model name plus the exact field, template, CSS, or creation inputs needed.

anki_operations

Run general Anki utility operations: sync, version lookup, package import/export, profile listing, and media storage or retrieval. Use this for cross-cutting maintenance tasks that do not belong to flashcard, deck, model, or study workflows. Import, export, sync, and media writes have external side effects; version and profile reads do not. Select `operation`, then provide the relevant deck name, file path, filename, media payload, URL, or pattern.

get_media_file

Retrieve one named Anki media file as base64 data and, for images, as MCP image content that compatible clients can inspect. Use this when an agent needs the actual contents of a referenced media asset, not when it only needs media names or storage operations; those belong in `anki_operations`. This tool is read-only and rejects path traversal. Pass a simple filename exactly as stored in Anki media.

gui_add_cards

gui_answer_card

gui_browse

gui_check_database

gui_current_card

gui_deck_browser

gui_deck_overview

gui_deck_review

gui_edit_note

gui_exit_anki

gui_import_file

gui_select_card

gui_select_note

gui_selected_notes

gui_show_answer

gui_show_question

gui_start_card_timer

gui_undo

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "anki mcp": {
            "anki-mcp": {
                "command": "npx",
                "args": [
                    "@arielbk/anki-mcp"
                ]
            }
        }
    }
}

McpServers

{
    "anki-mcp": {
        "command": "npx",
        "args": [
            "@arielbk/anki-mcp"
        ]
    }
}

🧠 Anki MCP

NPM Package yanki-connect
License: MIT

Transform your Anki flashcard experience with AI! This MCP (Model Context Protocol) server bridges your Anki flashcard collection with AI assistants like Claude, enabling natural conversations about your study materials.

🚀 What Can You Do?

Imagine having an AI tutor that knows your entire flashcard collection and can:

📚 Interactive Learning\\\\

- _"Quiz me on Japanese vocabulary I haven't seen in 3 days"_
- _"Test me on challenging cards from my medical deck"_
- _"Show me cards I've been struggling with recently"_

Smart Content Creation

- _"Create flashcards about photosynthesis with diagrams"_
- _"Turn this PDF chapter into spaced repetition cards"_
- _"Generate cloze deletion cards from my lecture notes"_

🔍 Powerful Analytics

- _"Which topics am I struggling with most?"_
- _"Show me my study patterns for the last month"_
- _"What's my retention rate for different card types?"_

🎯 Bulk Operations

- _"Tag all my chemistry cards with 'exam-prep'"_
- _"Move cards with low retention to an intensive review deck"_
- _"Find and fix duplicate cards across my decks"_

🎯 Features

- Full Anki Integration: Complete access to decks, cards, notes, and statistics via all 115 AnkiConnect API methods
- Conversational Interface: Natural language commands through your AI assistant
- Bulk Operations: Efficiently manage thousands of cards at once
- Real-time Statistics: Get insights into your learning progress
- Media Support: Handle images, audio, and other media in your cards
- Advanced Querying: Find cards using complex search criteria
- Type Safety: Fully typed API with comprehensive error handling

🛠 Technical Stack

- Node.js: Runtime environment (18+ required)
- TypeScript: Type safety and developer experience
- MCP SDK: Model Context Protocol implementation
- yanki-connect: 🙏 _Fully-typed, isomorphic AnkiConnect API client_
- tsup: Fast TypeScript bundler
- PNPM: Efficient package manager

_Special thanks to the yanki-connect library for providing the robust AnkiConnect interface that powers this integration!_

📋 Prerequisites

1. Install Anki

Download and install Anki if you haven't already.

2. Install AnkiConnect Plugin

1. Open Anki
2. Go to ToolsAdd-ons
3. Click Get Add-ons...
4. Enter code: 2055492159
5. Restart Anki

> 📋 Version Requirements: This server requires AnkiConnect version 25.2.25.0 or newer (released 2025-02-25) for full compatibility. Most features work with older versions, but we recommend updating for the best experience.

3. Configure AnkiConnect (Optional)

AnkiConnect works out of the box, but you can customize settings:

1. Go to ToolsAdd-ons
2. Select AnkiConnect and click Config
3. Default settings should work fine for most users

🚀 Quick Start

Option 1: Use with Claude Desktop (Recommended)

1. Install the package

   npm install -g @arielbk/anki-mcp
   

2. Configure Claude Desktop

Edit your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json

Add this configuration:

   {
     "mcpServers": {
       "anki": {
         "command": "anki-mcp",
         "args": []
       }
     }
   }
   

3. Restart Claude Desktop

4. Start using it!
- Make sure Anki is running with AnkiConnect enabled
- Ask Claude: _"Show me my Anki decks"_ or _"Quiz me with 5 cards"_

> 💡 Pro Tip: You can test your setup by asking Claude simple questions like _"How many Anki decks do I have?"_ or _"What's in my largest deck?"_

Option 2: Development Setup

1. Clone the repository

   git clone https://github.com/arielbk/anki-mcp.git
   cd anki-mcp
   

2. Install dependencies

   pnpm install
   

3. Build the project

   pnpm build
   

4. Test the server

   # Use the MCP inspector to test functionality
pnpm inspect

Option 3: Use with Other MCP Clients

This server works with any MCP-compatible client. You can also use it with:

- MCP Inspector: Interactive debugging tool
- Cline: VS Code extension for AI coding
- Custom MCP clients: Build your own using the MCP SDK

For stdio transport, run:

node dist/index.js

🎮 Usage Examples

Once configured with Claude Desktop, you can have natural conversations like:

📖 Study Sessions

You: "I have a Japanese exam tomorrow. Can you quiz me on Hiragana cards I haven't reviewed in a week?"

Claude: I'll find your Hiragana cards that need review and start a quiz session...

📝 Content Creation

You: "Create flashcards for the major battles of World War II with dates and significance"

Claude: I'll create comprehensive flashcards covering the key WWII battles...

📊 Study Analytics

You: "How am I doing with my medical terminology deck? Show me my weak areas."

Claude: Let me analyze your performance on the medical terminology deck...

🏷️ Organization

You: "Tag all cards about cardiovascular system with 'cardiology' and move them to my MCAT prep deck"

Claude: I'll help you organize those cards...

🔧 Available Tools & Resources

This MCP server provides comprehensive access to your Anki collection through these capabilities:

📚 Deck Management

- List all decks with statistics
- Create new decks
- Rename and delete decks
- Get deck configuration

🗂️ Card Operations

- Find cards by search criteria
- Answer cards (simulate reviews)
- Get card information and statistics
- Suspend/unsuspend cards
- Bulk card operations

📝 Note Management

- Add new notes with custom fields
- Update existing notes
- Delete notes
- Find notes by search query
- Bulk note operations

📊 Statistics & Analytics

- Deck statistics and performance metrics
- Card ease and interval data
- Review history and patterns
- Learning progress insights

🎨 Media & Models

- Access note types and field definitions
- Media file management
- Template customization support

🔍 Advanced Features

- Complex search queries using Anki's search syntax
- Batch operations for efficiency
- Real-time synchronization with Anki
- Error handling and validation
- Organized API methods grouped by functionality (cards, decks, notes, models, statistics, media, etc.)
- Direct access to all 115 AnkiConnect API methods with full type safety

🛠 Development

```bash

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.