Overview
AnkiMCP is an Anki addon that bridges your flashcard collection with AI assistants through the Model Context Protocol (MCP). Unlike traditional REST APIs, MCP provides a standardized way for AI tools to access and interact with your data safely and efficiently.
AnkiMCP vs AnkiConnect
AnkiMCP Advantages
- Built for AI assistant integration
- MCP protocol standardization
- Fine-grained permission system
- Automatic server lifecycle management
- Type-safe tool definitions
AnkiConnect Use Cases
- Browser extensions (Yomichan, etc.)
- Direct HTTP API integration
- Legacy application support
- Custom automation scripts
Installation
Method 1: AnkiWeb (Recommended)
- Open Anki and go to
Tools → Add-ons → Get Add-ons... - Enter the addon code:
1513864660 - Click OK and restart Anki
- The MCP server will start automatically when you open a profile
Tip: You can also browse the addon listing at ankiweb.net/shared/info/1513864660 to verify the code before installing.
Method 2: Manual Installation
- Download the latest release from GitHub
- Extract the archive
- Copy the
src/ankimcpfolder to your Anki addons directory:- Windows:
%APPDATA%\\Anki2\\addons21\\ - macOS:
~/Library/Application Support/Anki2/addons21/ - Linux:
~/.local/share/Anki2/addons21/
- Windows:
- Restart Anki
Configuration
Anki Addon Settings
Configure AnkiMCP through Anki's addon configuration:
- Go to
Tools → Add-ons - Select AnkiMCP and click
Config - Modify settings as needed
Configuration Options
{
"host": "localhost",
"port": 8765,
"global_permissions": {
"read": true,
"write": true,
"delete": false
},
"deck_permissions": {
"MyPrivateDeck": {
"read": false,
"write": false,
"delete": false
}
},
"protected_decks": ["ImportantDeck", "ExamPrep"]
}
MCP Host Configuration
Configure your MCP host to connect to AnkiMCP:
Claude Desktop
Edit ~/.config/claude-desktop/claude_desktop_config.json:
{
"mcpServers": {
"ankimcp": {
"command": "python",
"args": ["-m", "ankimcp"],
"env": {
"ANKIMCP_HOST": "localhost",
"ANKIMCP_PORT": "8765"
}
}
}
}
Other MCP Hosts
For custom MCP implementations, connect to:
- Host:
localhost(or configured host) - Port:
8765(or configured port) - Protocol: MCP over stdio/HTTP
Capabilities
AnkiMCP provides comprehensive access to your Anki collection through these MCP tools:
Deck Management
list_decks- Get all available deckscreate_deck- Create new decksdelete_deck- Remove decks (with protection)get_deck_stats- Retrieve deck statistics
Note Operations
search_notes- Search using Anki syntaxget_note_info- Detailed note informationcreate_note- Add new notes/cardsupdate_note- Modify existing notesdelete_notes- Remove notes (with protection)
Card Information
get_card_info- Individual card detailsfind_cards- Search for specific cardsget_card_reviews- Review historysuspend_cards- Suspend/unsuspend cards
Statistics & Analysis
get_collection_stats- Overall collection metricsget_review_stats- Learning progress dataget_due_cards- Cards scheduled for reviewget_learning_stats- Performance analytics
API Reference
Detailed reference for each MCP tool available in AnkiMCP:
list_decks
Returns all available decks with their IDs and configuration status.
Response Example:
[
{
"id": 1234567890,
"name": "Japanese::Vocabulary",
"newCount": 45,
"reviewCount": 12,
"totalCount": 892
}
]
search_notes
Search notes using Anki's powerful search syntax.
Parameters:
query(string) - Anki search query (e.g., "deck:Japanese tag:vocabulary")limit(number, optional) - Maximum results to return
Response Example:
[
{
"noteId": 1234567890,
"fields": {
"Front": "こんにちは",
"Back": "Hello"
},
"tags": ["vocabulary", "greetings"],
"modelName": "Basic"
}
]
create_note
Create a new note in the specified deck.
Parameters:
deckName(string) - Target deck namemodelName(string) - Note type/model namefields(object) - Field values as key-value pairstags(array, optional) - Tags to add to the note
Security & Permissions
AnkiMCP includes comprehensive security features to protect your Anki collection:
Global Permissions
Set default permissions for all operations:
- Read: Allow viewing decks, notes, and statistics
- Write: Allow creating and updating notes/decks
- Delete: Allow removing notes and decks
Deck-Specific Controls
Override permissions for individual decks:
"deck_permissions": {
"PersonalDiary": {
"read": false, // Completely hidden
"write": false,
"delete": false
},
"WorkNotes": {
"read": true, // Read-only access
"write": false,
"delete": false
}
}
Protected Decks
Add an extra layer of protection against accidental deletion:
"protected_decks": [
"MedicalSchool",
"PhD Research",
"CertificationExam"
]
Protected decks cannot be deleted even if delete permissions are enabled.
Troubleshooting
MCP Server Not Starting
Symptoms: AI assistant can't connect to AnkiMCP
Solutions:
- Ensure Anki is running with a profile loaded
- Check that the addon is enabled in Tools → Add-ons
- Verify port 8765 is not blocked by firewall
- Restart Anki and try again
Permission Denied Errors
Symptoms: "Permission denied" when AI tries to create/modify content
Solutions:
- Check addon configuration for global permissions
- Verify deck-specific permissions are not too restrictive
- Ensure the target deck isn't in the protected list
Connection Refused
Symptoms: MCP host can't connect to localhost:8765
Solutions:
- Check if another application is using port 8765
- Try changing the port in addon configuration
- Verify localhost DNS resolution works
- Check system firewall settings
Getting Help
If you're still experiencing issues:
- Check the GitHub issues for similar problems
- Create a new issue with detailed error messages and your configuration
- Include your Anki version and operating system