mcp-server-anki
Provides tools for managing Anki flashcard decks, cards, and notes, including creating, updating, deleting, searching, and retrieving statistics.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-server-anki Show me the learning progress for my 'English Vocabulary' deck"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Server Anki
δΈζζζ‘£ | English
A Model Context Protocol (MCP) server that bridges Anki with AI tools, enabling intelligent flashcard management and learning assistance.
π‘ Compatibility: This server works with any MCP-compatible AI tool including Claude Code, Cline, Zed AI, and more. We use Claude Code as an example in this documentation, but the setup process is similar for other tools.
π Features
π Deck Management: Get deck lists, view deck statistics
π Card Search: Search cards using Anki's advanced query syntax
β Smart Creation: Create and manage Anki cards with AI assistance
βοΈ Card Editing: Update existing card fields and content
ποΈ Card Deletion: Delete unwanted cards and notes
π Data Analysis: Get learning statistics and progress information
π§ Template Management: View and use different note types
Related MCP server: Anki MCP Server
π Prerequisites
Anki Desktop - Download Anki
AnkiConnect Plugin - Install in Anki (Code:
2055492159)Node.js - Version 16 or higher
MCP-compatible AI Tool - Such as:
Any other tool supporting MCP
π Quick Start
1. Install AnkiConnect
In Anki:
Tools β Add-ons β Get Add-ons
Enter code:
2055492159Restart Anki
2. Configure Your MCP Client
The following examples use Claude Code, but the configuration is similar for other MCP-compatible tools.
Option A: Using Command Line
# For Claude Code
claude mcp add anki -- npx mcp-server-anki
# For other tools, consult their documentation for the equivalent commandOption B: Manual Configuration
Add the server to your MCP client's configuration file:
{
"mcp": {
"servers": {
"anki": {
"command": "npx",
"args": ["mcp-server-anki"]
}
}
}
}π Usage Guide
Basic Workflow
Start Anki - Ensure Anki is running with AnkiConnect enabled
Start MCP Server - Automatically started by Claude Code
Use AI Tools - Interact with Anki through Claude Code
Example Conversations
User: Show me the learning progress for my "English Vocabulary" deck
Claude: I'll check the statistics for your "English Vocabulary" deck...
[Calls get_deck_stats tool]
User: Create a new English word card for "ephemeral"
Claude: I'll create this word card for you...
[Calls add_note tool]π οΈ Available Tools
Tool Name | Description | Parameters |
| Get all deck names | None |
| Get cards from a specific deck |
|
| Get deck statistics |
|
| Search cards |
|
| Add new note |
|
| Update existing note fields |
|
| Get detailed note information |
|
| Delete one or more notes |
|
| Get all note types | None |
| Get note type fields |
|
ποΈ Project Structure
mcp-server-anki/
βββ src/
β βββ index.ts # MCP server entry point
β βββ ankiConnect.ts # AnkiConnect API client
β βββ tools/ # MCP tool definitions
β βββ deckTools.ts # Deck-related tools
β βββ cardTools.ts # Card-related tools
β βββ noteTools.ts # Note-related tools
βββ dist/ # Compiled JavaScript
βββ package.json
βββ tsconfig.json
βββ README.mdπ§ Development
Build Commands
# Development mode (watch for changes)
npm run dev
# Production build
npm run buildArchitecture
Claude Code (MCP Client) ββ Anki MCP Server ββ AnkiConnect ββ Anki Desktopπ API Documentation
get_deck_names
Get a list of all deck names.
Returns:
["Default", "English Vocabulary", "Programming"]search_cards(query)
Search cards using Anki query syntax.
Parameters:
query: Anki query string (e.g.,deck:English is:due)
Query Syntax Examples:
deck:DeckName- Specific decktag:TagName- By tagis:due- Due cardsis:new- New cardsadded:7- Cards added in last 7 days
add_note
Add a new note to Anki.
Parameters:
deckName: Target deck namemodelName: Note type (e.g., "Basic", "Cloze")fields: Field content objecttags: Tag array (optional)
Example:
{
"deckName": "English Vocabulary",
"modelName": "Basic",
"fields": {
"Front": "ephemeral",
"Back": "lasting for a very short time"
},
"tags": ["vocabulary", "adjective"]
}update_note
Update fields of an existing note.
Parameters:
noteId: The ID of the note to updatefields: Object with field names and new values
Example:
{
"noteId": 1234567890,
"fields": {
"Back": "lasting for an extremely short time"
}
}get_note_info
Get detailed information about a specific note.
Parameters:
noteId: The ID of the note to query
Returns:
{
"noteId": 1234567890,
"modelName": "Basic",
"fields": {
"Front": "ephemeral",
"Back": "lasting for a very short time"
},
"tags": ["vocabulary", "adjective"]
}delete_notes
Delete one or more notes.
Parameters:
noteIds: Array of note IDs to delete
Example:
{
"noteIds": [1234567890, 9876543210]
}π§ Building from Source
If you want to contribute or customize the server:
# Clone the repository
git clone https://github.com/here-tunan/mcp-server-anki.git
cd mcp-server-anki
# Install dependencies
npm install
# Build TypeScript
npm run buildTo use your local build with Claude Code, configure it with:
{
"mcp": {
"servers": {
"anki": {
"command": "node",
"args": ["/path/to/mcp-server-anki/dist/index.js"]
}
}
}
}π€ Contributing
Issues and Pull Requests are welcome!
π License
Apache License
π Links
β FAQ
Q: AnkiConnect connection failed?
A: Ensure Anki is running and AnkiConnect plugin is installed and enabled. Default port is 8765.
Q: How to customize note types?
A: After creating custom note types in Anki, use get_models and get_model_fields tools to view available fields.
Q: Mobile support?
A: Currently only supports desktop Anki due to AnkiConnect dependency.
Made with β€οΈ for Anki learners and AI enthusiasts
Available Tools
10 toolsadd_noteB
Add a new note (card) to Anki
Inputs: deckName (required), fields (required), modelName, tags.
delete_notesC
Delete one or more notes by their IDs
Inputs: noteIds (required).
get_cards_in_deckC
Get cards from a specific deck
Inputs: deck (required), limit.
get_deck_namesA
Get all deck names from Anki
Inputs: no named parameters.
get_deck_statsB
Get statistics for a specific deck
Inputs: deck (required).
get_model_fieldsB
Get field names for a specific note type
Inputs: modelName (required).
get_modelsA
Get all available note types (models)
Inputs: no named parameters.
get_note_infoC
Get detailed information about a specific note
Inputs: noteId (required).
search_cardsC
Search for cards using Anki query syntax
Inputs: query (required), limit.
update_noteC
Update fields of an existing note
Inputs: noteId (required), fields (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 10 tools
Each tool targets a distinct operation: note creation/deletion/update/retrieval, deck listing/stats, card search, and model fields. No two tools could be confused for the same purpose.
All tools follow a consistent snake_case verb_noun pattern (e.g., add_note, get_deck_names, search_cards), making the set predictable and easy to navigate.
With 10 tools, the server covers the essential operations for Anki note and deck management without bloat. Each tool serves a clear and necessary role.
The set provides full CRUD for notes and query capabilities for decks and models. Missing deck creation or deletion, but these are less critical for typical note management workflows.
Maintenance
Related MCP Connectors
Turn text, files, URLs, or photos into Anki flashcard decks from your AI assistant.
Language flashcards in your AI assistant: build decks, edit cards and review what's due in the chat.
Spaced-repetition flashcards in Markdown: create cards, manage decks and study with FSRS.
Build and study spaced-repetition flashcards with your agent.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables AI assistants to manage Anki flashcard decks and cards through natural language, supporting deck creation, card additions (basic and cloze types), and review queue management.69 npm2MIT
- AlicenseNot gradedqualityDmaintenanceEnables interaction with the Anki desktop flashcard application through the Anki-Connect plugin. Supports managing decks, cards, notes, and models, allowing AI assistants to create and query flashcards through natural language.10 npm1ISC
- AlicenseAqualityCmaintenanceEnables AI assistants to interact with Anki flashcard collections through the AnkiConnect add-on, allowing creation, modification, searching, and management of flashcards and decks.3332 npm27MIT
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to interact with Anki flashcard collections, including deck management, note search, viewing contents, and editing fields.18 npmMIT