mcp-server-anki
Enables AI tools to manage Anki flashcards, including deck management, card search, creation, editing, deletion, and statistics.
README
MCP Server Anki
<div align="center"> <img src="./src/public/icons8-anki-480.png" alt="Anki Logo" width="120" height="120">
δΈζζζ‘£ | English </div>
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
π Prerequisites
- Anki Desktop - Download Anki
- AnkiConnect Plugin - Install in Anki (Code:
2055492159) - Node.js - Version 16 or higher
- MCP-compatible AI Tool - Such as:
- Claude Code
- Cline
- Zed AI
- Any other tool supporting MCP
π Quick Start
1. Install AnkiConnect
In Anki:
- Tools β Add-ons β Get Add-ons
- Enter code:
2055492159 - Restart 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 command
Option 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_deck_names |
Get all deck names | None |
get_cards_in_deck |
Get cards from a specific deck | deckName |
get_deck_stats |
Get deck statistics | deckName |
search_cards |
Search cards | query |
add_note |
Add new note | deckName, modelName, fields, tags |
update_note |
Update existing note fields | noteId, fields |
get_note_info |
Get detailed note information | noteId |
delete_notes |
Delete one or more notes | noteIds |
get_models |
Get all note types | None |
get_model_fields |
Get note type fields | modelName |
ποΈ 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 build
Architecture
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 build
To 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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.