home / mcp / anki mcp server

Anki MCP Server

FastMCP server for managing Anki decks, notes, and note types with bulk operations and audio features.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "amidvidy-anki-mcp": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/your/anki-mcp/",
        "run",
        "server.py"
      ],
      "env": {
        "GOOGLE_CLOUD_API_KEY": "YOUR_GOOGLE_CLOUD_API_KEY"
      }
    }
  }
}

You run a FastMCP server that talks to Anki through AnkiConnect and can generate AI-assisted audio, perform bulk actions, and search notes by text. This MCP server exposes practical tools to manage decks, notes, media, and audio, helping you automate and streamline your Anki workflow from any MCP-enabled client.

How to use

You interact with the Anki MCP server through an MCP client. Start the local server, then connect your MCP client to it to list decks, read and create notes, update content, and manage media. Use the tools to perform common tasks in batch, generate audio, and find notes by text. The server communicates with Anki through AnkiConnect, so Anki must be running with the AnkiConnect add-on installed.

How to install

Prerequisites: install the FastMCP runtime tooling and ensure Python is installed on your system. You will also need Anki running with the AnkiConnect add-on.

Step 1: Install the runtime tooling for MCP development and execution.

Step 2: Make sure Anki is running with AnkiConnect enabled. In Anki: Tools > Add-ons > Get Add-ons, enter 2055492159, then restart Anki.

Step 3: (Optional) Set up an API key for audio generation. You can provide a Google Cloud API key via an environment variable named GOOGLE_CLOUD_API_KEY.

Step 4: Start the MCP server locally.

Additional sections

Configuration is driven by an MCP configuration that runs the server locally via a command like uv run server.py. You can place the server into a directory of your choice and reference that path in your client configuration.

Security and keys: protect your Google Cloud API key and only expose the local MCP endpoint to trusted clients. Use environment variables for sensitive values, and avoid hardcoding keys in scripts.

Notes on troubleshooting: ensure Anki is running and AnkiConnect is installed, verify that the server process is active, and check that the environment variable GOOGLE_CLOUD_API_KEY is set if you intend to generate audio.

Examples of typical usage include listing decks, creating notes in bulk with optional audio generation, updating existing notes, and finding notes that contain a search string across fields.

Configuration example for Claude Desktop integration

{
  "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"
      }
    }
  }
}

Available tools

list_decks

List all available Anki decks with their card counts.

get_deck_notes

Fetch all notes from a specified deck with detailed fields.

get_deck_sample

Retrieve a random sample of notes from a deck to understand structure.

get_deck_note_types

Identify note types (models) used in a deck and their fields.

create_note

Create a new note in a specified deck with a given model and fields.

update_note

Update specific fields of an existing note while preserving other content.

create_deck_with_note_type

Create a new deck and optionally a new note type with specified fields.

list_note_types

List all available note types with fields, templates, and styling.

generate_audio

Generate high-quality audio from text using Google Cloud TTS with Chirp voices.

save_media_file

Save base64-encoded media data to Anki's media collection.

generate_and_save_audio

Generate audio from text and save it directly to Anki's media collection.

create_notes_bulk

Create multiple notes in one batch, with optional automatic audio generation and duplicate handling.

update_notes_bulk

Update multiple notes in a single batch operation.

find_similar_notes

Find notes containing the search text as a substring in any field with configurable case sensitivity.