SilvaHerald/anki-mcp-server
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.
๐ 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)
- Works with local LLMs via Ollama (
-
๐งฉ 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
- Use the MCP Inspector to test
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
- Model Context Protocol (MCP)
- NestJS
- MCP-Nest
- Anki + AnkiConnect
- Ollama and open-source LLMs (DeepSeek, Qwen, LLaMA, ...etc)