anki-mcp-server

SilvaHerald/anki-mcp-server

3.3

If you are the rightful owner of anki-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

NestJS Anki MCP Server is a server built with NestJS that connects to AnkiConnect, enabling AI-assisted flashcard generation and management.

Tools
3
Resources
0
Prompts
0

๐Ÿ“š NestJS Anki MCP Server

An MCP server built with NestJS that connects to AnkiConnect and enables AI-assisted flashcard generation and management.

This project exposes:

  • MCP Prompts โ†’ generate effective cards (Basic & Cloze) using AI, following active recall & spaced repetition principles.
  • MCP Tools โ†’ create cards directly in Anki via AnkiConnect.

๐ŸŽฏ Goal: make vocabulary learning easier by combining local LLMs (via Ollama/DeepSeek/Qwen/etc.), MCP prompts, and Anki.


โœจ Features

  • ๐Ÿง  Prompt-based card generation

    • Define vocabulary words/phrases
    • Get structured Anki-ready JSON cards (Basic + Cloze)
    • Supports tagging & deck mapping (Words, Idioms, Collocations, Phrasal Verbs, Slangs)
  • ๐Ÿ›  MCP Tools

    • Create Anki cards programmatically
    • Supports Basic and Cloze models
    • Bulk note insertion via AnkiConnect
  • ๐Ÿ”— Seamless AI integration

    • Works with local LLMs via Ollama (deepseek-r1, qwen2.5, llama3.1, โ€ฆ)
    • Or swap in a cloud model (OpenAI, Anthropic, Gemini)
  • ๐Ÿงฉ NestJS + @rekog/mcp-nest

    • Strong typing with Zod schemas
    • Clean modular design (PromptsService, ToolsService, AnkiConnectService)

๐Ÿš€ Getting Started

1. Prerequisites

  • Anki desktop app
  • AnkiConnect plugin installed in Anki
  • Node.js โ‰ฅ 22
  • pnpm โ‰ฅ 9
  • (Optional) Ollama for local LLMs

2. Clone & install

git clone https://github.com/<your_username>/anki-mcp-server.git

cd anki-mcp-server

pnpm install

3. Run MCP server

pnpm run start:dev

This will start a NestJS MCP server exposing:

  • Prompts (e.g., get-effective-cards-prompt)
  • Tools (e.g., create-anki-cards)

4. Connect to a client

pnpm run mcp:inspect
  • Or connect via ChatGPT / Claude Desktop if you expose it as a Streamable HTTP MCP server.

5. Example usage

Generate cards via MCP Prompt

{
  "cards": [
    {
      "deck": "Languages::English::New Words",
      "model": "Basic",
      "fields": {
        "Front": "They burned the letter to hide the evidence.\nWhat does the word 'burn' mean here?",
        "Back": "Definition (EN): to set something on fire\nDefinition (vi): ฤ‘แป‘t\nExample: The chef burned the toast.\nSynonyms: ignite, scorch"
      },
      "tags": ["english", "new_word"]
    },
    {
      "deck": "Languages::English::New Words",
      "model": "Cloze",
      "fields": {
        "Text": "They {{c1::bur}}ned the letter to hide the evidence.",
        "BackExtra": "They burned the letter to hide the evidence."
      },
      "tags": ["english", "new_word"]
    }
  ]
}

Insert into Anki via MCP Tool

{
  "deck": "Languages::English::New Words",
  "front": "They burned the letter to hide the evidence.\n\nWhat does the word 'burn' mean here?",
  "back": "Definition (EN): ...",
  "tags": ["english", "new_word"]
}

๐Ÿ›  Project Structure

Read more at .

๐Ÿ”„ Architecture

Read more at

๐Ÿงช Development Notes

  • Always validate AI output with Zod schemas before sending to AnkiConnect.

  • Use temperature: 0 and structured JSON mode in Ollama/OpenAI for consistent results.

  • Supported Anki models:

    • Basic: fields โ†’ Front, Back

    • Cloze: fields โ†’ Text, Back Extra

๐Ÿค Contributing

PRs, issues, and discussions are welcome! Feel free to fork, adapt prompts/tools, or add support for more Anki models.

๐Ÿ“„ License

MIT โ€” free to use, modify, and distribute.

๐Ÿ™Œ Acknowledgements