Anki Leech Cards

by captain-blue210

Not rated
GitHub

About

Connects Claude Desktop to Anki via AnkiConnect API, enabling retrieval and analysis of 'leech' cards to improve spaced repetition study habits.

Details

Author
captain-blue210
Repository
captain-blue210/anki-mcp-server
License
MIT License
Categories
Productivity, Other, Knowledge Base, AI, Design, Developer Tools, API, Infrastructure, Frontend

- Connects to Anki via AnkiConnect API
- Retrieves cards with "leech" tags
- Adds date-stamped review tags to cards
- Provides comprehensive card data for analysis by Claude
- Can be used with Claude Desktop

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 Leech Cards
    Command (node, npx, python, etc.) npx
    Arguments
    • Argument 1 -y
    • Argument 2 @highlight/mcp-server

    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

1. Make sure Anki is running with AnkiConnect installed
2. Run the MCP server:

   npm start

For testing, a separate configuration file .env.test is provided:

cp .env.example .env.test

Edit .env.test to set test-specific values:

ANKI_CONNECT_URL=http://localhost:8765
ANKI_CONNECT_VERSION=6
ANKI_MOCK_MODE=true

To run in test mode:

npm run start:test

To use this MCP server with Claude Desktop:

1. Open Claude Desktop
2. Edit the Claude Desktop configuration file located at:
- macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
- Windows: %APPDATA%\Claude\claude_desktop_config.json
- Linux: ~/.config/Claude/claude_desktop_config.json

3. Add the following configuration to the mcpServers section:

{
  "mcpServers": {
    "anki": {
      "command": "node",
      "args": ["path/to/anki-mcp-server/dist/index.js"]
    }
  }
}

Replace "path/to/anki-mcp-server" with the actual path to where you cloned this repository.

Once configured, you can use the following tools in Claude:

Could you analyze my Anki leech cards and suggest ways to improve my study?

Claude will use the MCP server to retrieve your leech cards and analyze them.

get_leech_cards

Retrieves cards tagged as leeches from Anki. Parameters: detailed (optional, boolean, default: true), count (optional, number): Number of random cards to return (defaults to all cards)

tag_reviewed_cards

Adds a date-stamped 'reviewed' tag to specified cards. Parameters: card_ids (required, array of numbers): Array of card IDs to tag as reviewed, custom_tag_prefix (optional, string, default: '見直し'): Custom prefix for the tag

Claude Desktop / Cursor

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

{
    "mcpServers": {
        "anki leech cards": {
            "env": {},
            "args": [
                "-y",
                "@highlight/mcp-server"
            ],
            "command": "npx"
        }
    }
}

Linux

{
    "env": [],
    "args": [
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "npx"
}

Macos

{
    "env": [],
    "args": [
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "npx"
}

Windows

{
    "env": [],
    "args": [
        "/c",
        "npx",
        "-y",
        "@highlight/mcp-server"
    ],
    "command": "cmd"
}

Connects to Anki via AnkiConnect to retrieve leech-tagged flashcards for use in Claude Desktop.

An MCP (Model Context Protocol) server for Claude Desktop that connects to Anki via AnkiConnect and retrieves leech-tagged cards.

- Connects to Anki via AnkiConnect API
- Retrieves cards with "leech" tags
- Adds date-stamped review tags to cards
- Provides comprehensive card data for analysis by Claude
- Can be used with Claude Desktop

- Ankiinstalled and running
-
AnkiConnectadd-on installed in Anki
- Node.js and npm

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

The server can be configured using environment variables. Copy the provided example file to create your own configuration:

Then edit the.envfile to customize your settings:

If the environment variables are not set, the server will use the default values.

Finding Your Local IP Address for AnkiConnect

If connecting tolocalhostdoesn't work, you'll need to use your computer's local IP address instead. Configure your.envfile with:

ANKI_CONNECT_URL=http://YOUR_LOCAL_IP:8765

- macOS: Open Terminal and runifconfigoripconfig getifaddr en0(for WiFi)
- Windows: Open Command Prompt and runipconfig
- Linux: Open Terminal and runip addr showorhostname -I

Look for IPv4 addresses like192.168.x.xor10.x.x.xin the output.

For testing, a separate configuration file.env.testis provided:

Edit.env.testto set test-specific values:

ANKI_CONNECT_URL=http://localhost:8765 ANKI_CONNECT_VERSION=6 ANKI_MOCK_MODE=true

- Make sure Anki is running with AnkiConnect installed
- Run the MCP server:

npm start

To use this MCP server with Claude Desktop:

Edit the Claude Desktop configuration file located at:

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

Add the following configuration to themcpServerssection:

{ "mcpServers": { "anki": { "command": "node", "args": ["path/to/anki-mcp-server/dist/index.js"] } } }

Replace"path/to/anki-mcp-server"with the actual path to where you cloned this repository.

Once configured, you can use the following tools in Claude:

Could you analyze my Anki leech cards and suggest ways to improve my study?

Claude will use the MCP server to retrieve your leech cards and analyze them.

Retrieves cards tagged as leeches from Anki.

- detailed(optional, boolean, default: true): Whether to return comprehensive card data or just IDs
- count(optional, number): Number of random cards to return (defaults to all cards)

Adds a date-stamped "reviewed" tag to specified cards. This allows you to track which cards you've reviewed with Claude.

- card_ids(required, array of numbers): Array of card IDs to tag as reviewed
- custom_tag_prefix(optional, string, default: "見直し"): Custom prefix for the tag

The tag will be in the format見直し::YYYYMMDD(or your custom prefix if specified).

I've reviewed these cards, please tag them as reviewed: [1234567890, 1234567891]

- "Could not connect to Anki"- Make sure Anki is running and AnkiConnect is properly installed
- "No leech cards found"- You don't have any cards tagged as "leech" in Anki
- Connection issues with localhost- If you're unable to connect usinglocalhost:
- Find your local IP address as described in the Configuration section
- Update your.envfile to useANKI_CONNECT_URL=http://YOUR_LOCAL_IP:8765
- Make sure AnkiConnect is configured to allow connections from your IP address
- Restart the MCP server after making these changes

For testing without affecting actual Anki data, you can use the mock mode:
- SetANKI_MOCK_MODE=truein your.envfile or use the provided.env.testfile
- Run the server withnpm run start:test

In mock mode, the server will simulate all Anki operations without actually connecting to Anki. This is useful for testing Claude integrations without risking data changes.

To run the server in development mode with hot reloading:

Manage Anki flashcards and decks via the AnkiConnect plugin.

Connect Claude with AnkiConnect to create and review flashcards using natural language.

Enables AI assistants to interact with Anki flashcard decks via the AnkiConnect plugin.

Interactive flashcards, quizzes, and cloze cards with FSRS spaced repetition, rendered inline in Claude Desktop as an MCP App.

A MCP server that enables AI assistants to interact with Anki, the spaced repetition flashcard application.

Create spaced repetition flashcards in Rember to remember anything you learn in your chats

Manage Anki flashcards and decks using the Anki-Connect plugin.

A Model Context Protocol (MCP) server that provides seamless integration with Anki, enabling AI assistants to interact with your flashcard collection. Create, read, update, and manage Anki cards programmatically through a standardized interface.

Create Anki flashcards using natural language by connecting to the AnkiConnect add-on.

Interact with the Anki flashcard app via the AnkiConnect add-on. Supports audio generation and similarity search.

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.