Get the FREE Ultimate OpenClaw Setup Guide →

anki

MCP server for anki

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio nietus-anki-mcp node build/client.js \
  --env AZURE_API_KEY="<your-azure-speech-api-key>" \
  --env ANKI_MEDIA_DIR="<path-to-your-anki-collection.media-folder>"

How to use

This MCP server provides programmatic interaction with Anki via MCP. It exposes a set of tools to manage flashcards, decks, and the review process by interfacing with AnkiConnect through the MCP protocol. Key capabilities include creating new cards with add_card and add_card_with_audio, updating existing cards (including audio) with update_card_with_audio and update_card_with_audio, and retrieving cards due or new for study via get_due_cards and get_new_cards. You can also query deck structures with get_deck_names and perform flexible searches with find_cards. For audio features, you must provide an Azure Speech API key and point the server to your Anki media directory via ANKI_MEDIA_DIR; this enables generation and storage of audio files in Anki's collection.media directory. The server is designed to run locally (since AnkiConnect is typically localhost-bound) and can be integrated with desktop MCP clients like Msty Studio or Claude Desktop through MCP bundles or direct node execution. When using Cursor or Claude, configure the server start command to launch the built client (build/client.js).

How to install

Prerequisites:

  • Node.js and npm installed
  • AnkiConnect plugin installed and running in Anki
  • For audio features: Azure API key and Anki media directory (ANKI_MEDIA_DIR)
  1. Clone the repository git clone https://github.com/nietus/anki-mcp cd anki-mcp

  2. Install dependencies npm install

  3. Build the project npm run build

  4. Prepare environment variables (for audio features) Create a .env file in the project root (optional if you will set env vars in your launcher):

    AZURE_API_KEY=your_azure_api_key_here ANKI_MEDIA_DIR=/path/to/your/anki/collection.media

  5. Run the MCP server locally (example using Node) npm run start

    Or run the built client directly via MCP tooling which uses build/client.js

  6. Integrate with clients

    • For Cursor: configure the Windows/macOS/Linux start commands to execute node build/client.js (adjust path to your clone)
    • For Claude Desktop: package as an MCP bundle per README and install; provide AZURE_API_KEY and ANKI_MEDIA_DIR when prompted.

Additional notes

Notes and tips:

  • The server expects AnkiConnect to be available locally. Ensure Anki is running and AnkiConnect is enabled.
  • Audio features require a valid Azure Speech API key and a writable ANKI_MEDIA_DIR where generated audio files will be saved.
  • When using the add_card family of tools, provide HTML-formatted content for fields and specify the modelName (note type) and optional deckName and tags.
  • For integration in desktop clients, you can package as an MCP bundle (.mcpb) to simplify deployment; Claude Desktop will launch the server on demand.
  • If you encounter path or permission issues on Windows, ensure the working directory aligns with your build output (build/client.js) and that Node has permission to read/write the Anki media folder.
  • The server is recommended to run locally due to AnkiConnect constraints; remote execution will require proper tunneling and security considerations.

Related MCP Servers

Sponsor this space

Reach thousands of developers