Anki MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
uv sync
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add anki-mcp -- node "<FULL_PATH_TO_ANKI_MCP>/dist/index.js"

Replace <FULL_PATH_TO_ANKI_MCP>/dist/index.js with the actual folder you prepared in step 1.

README.md

Manage Anki decks, notes, and note types via the Model Context Protocol.

Anki MCP Server

A FastMCP server for interacting with Anki through the Model Context Protocol (MCP). This server provides comprehensive tools for managing Anki decks, notes, and note types, with advanced features including AI-powered audio generation, bulk operations, and semantic similarity search.

External APIs Used

This project integrates with several external APIs to provide enhanced functionality:

Google Cloud Text-to-Speech API

  • Purpose: High-quality audio generation from text using Google's Chirp voices
  • Use Case: Generate pronunciation audio files for flashcards
  • Features: HD quality voices with natural pronunciation, especially excellent for Chinese
  • Setup: Requires GOOGLE_CLOUD_API_KEY environment variable

AnkiConnect API (Local)

  • Purpose: Interface with Anki desktop application
  • Use Case: All Anki operations (create/read/update notes, manage decks, etc.)
  • Features: Complete Anki functionality via HTTP API
  • Setup: AnkiConnect add-on must be installed and Anki must be running

Setup

  1. Install dependencies using uv:

    uv sync
    
  2. Make sure Anki is running with the AnkiConnect add-on installed:

    • In Anki, go to Tools > Add-ons > Get Add-ons
    • Enter code: 2055492159
    • Restart Anki
  3. (Optional) Set up API key for audio generation:

    # For audio generation with Google Cloud TTS
    export GOOGLE_CLOUD_API_KEY='your-google-cloud-api-key-here'
    
  4. Run the server:

    uv run server.py
    

Claude Desktop Integration

To use this MCP server with Claude Desktop, add the following configuration to your claude_desktop_config.json file:

Configuration Location

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

Configuration Example

{
  "mcpServers": {
    "anki-mcp": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/your/anki-mcp/",
        "run",
        "server.py"
      ],
      "env": {
        "GOOGLE_CLOUD_API_KEY": "your-google-cloud-api-key-here"
      }
    }
  }
}

Setup Steps

  1. Ensure dependencies are installed: Make sure you've run uv sync in your anki-mcp directory
  2. Find your config file at the location above (create it if it doesn't exist)
  3. Update the path: Replace /path/to/your/anki-mcp/ with the actual path to your anki-mcp directory
  4. Add your API key:
    • Replace your-google-cloud-api-key-here with your actual Google Cloud API key (for audio generation)
  5. Restart Claude Desktop for the changes to take effect

Important Notes

  • Make sure Anki is running with the AnkiConnect add-on before using the tools
  • The uv command will automatically handle the Python environment and dependencies
  • Make sure uv is installed on your system (curl -LsSf https://astral.sh/uv/install.sh | sh)

Alternative: Using Environment Variables

If you prefer to keep your API key in your shell environment, you can omit the env section:

{
  "mcpServers": {
    "anki-mcp": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/your/anki-mcp/",
        "run",
        "server.py"
      ]
    }
  }
}

Then set the environment variable in your shell:

export GOOGLE_CLOUD_API_KEY='your-google-cloud-api-key-here'

Verification

Once configured, restart Claude Desktop and you should see the Anki MCP tools available in your conversations. You can verify by asking Claude to list your Anki decks or try any of the available tools.

Available Tools

`list_decks`

Lists all available Anki decks with count.

Parameters: None

Returns: Formatted string with all deck names and total count

`get_deck_notes`

Retrieves all notes/cards from a specific deck with detailed information.

Parameters:

  • deck_name (str): Name of the Anki deck to retrieve notes from

Returns: Detailed information about all notes including model name, tags, and field values

`get_deck_sample`

Gets a random sample of notes from a deck to understand typical note structure.

Parameters:

  • deck_name (str): Name of the Anki deck to sample notes from
  • sample_size (int, optional): Number of notes to sample (1-50, default: 5)

Returns: Detailed information about sampled notes

`get_deck_note_types`

Analyzes a deck to identify all note types (models) and their field definitions.

Parameters:

  • deck_name (str): Name of the Anki deck to analyze

Returns: All unique note types used in the deck with their field names

`create_note`

Creates a new note in the specified deck.

Parameters:

  • deck_name (str): Name of the Anki deck to add the note to
  • model_name (str): Name of the note type/model to use
  • fields (dict): Dictionary mapping field names to values (e.g., {'Front': 'Question', 'Back': 'Answer'})
  • tags (list, optional)

Tools (5)

list_decksLists all available Anki decks with count.
get_deck_notesRetrieves all notes/cards from a specific deck with detailed information.
get_deck_sampleGets a random sample of notes from a deck to understand typical note structure.
get_deck_note_typesAnalyzes a deck to identify all note types and their field definitions.
create_noteCreates a new note in the specified deck.

Environment Variables

GOOGLE_CLOUD_API_KEYAPI key for Google Cloud Text-to-Speech audio generation

Configuration

claude_desktop_config.json
{"mcpServers": {"anki-mcp": {"command": "uv", "args": ["--directory", "/path/to/your/anki-mcp/", "run", "server.py"], "env": {"GOOGLE_CLOUD_API_KEY": "your-google-cloud-api-key-here"}}}}

Try it

List all my current Anki decks and their card counts.
Show me a sample of 5 notes from my 'Japanese Vocabulary' deck.
Create a new note in the 'English' deck using the 'Basic' model with Front set to 'Hello' and Back set to 'Bonjour'.
Analyze the 'Medical Terms' deck and tell me what fields are used in its note types.

Frequently Asked Questions

What are the key features of Anki MCP Server?

Comprehensive management of Anki decks, notes, and note types. AI-powered audio generation using Google Cloud Text-to-Speech. Bulk note creation and management capabilities. Semantic similarity search for flashcard content. Integration with AnkiConnect for local Anki desktop control.

What can I use Anki MCP Server for?

Automating the creation of flashcards from study notes or articles. Generating high-quality pronunciation audio for language learning cards. Auditing and organizing large Anki collections using AI analysis. Batch importing structured data into Anki decks.

How do I install Anki MCP Server?

Install Anki MCP Server by running: uv sync

What MCP clients work with Anki MCP Server?

Anki MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Anki MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare