Integrate your Anki decks with your choice of AI through the Model Context Protocol (MCP).
AnkiMCP is an Anki addon that exposes your Anki collection data (decks, notes, cards, and review statistics) via an MCP server, allowing AI assistants to help you study, create cards, and analyze your learning progress.
- List all available decks with card counts
- Search notes using Anki's powerful search syntax
- Get detailed information about specific notes and cards
- View review statistics for decks or your entire collection
- Access card scheduling information and review history
- Create, update, and delete notes and decks
- Comprehensive permission system to control AI access
- Protect sensitive decks and notes from modification
- Download the addon from AnkiWeb or clone this repository
- Copy the
src/ankimcpfolder to your Anki addons directory (or run./install_addon.shto copy files and vendor themcpdependency) - Restart Anki
- The MCP server will start automatically when you open your profile
Use the helper script to generate a distributable .ankiaddon archive that
matches the AnkiWeb sharing requirements:
python package_for_ankiweb.py --version 1.0.0The resulting file is written to the dist/ directory (e.g.
dist/ankimcp-1.0.0-YYYYmmdd-HHMMSS.ankiaddon). The script reads metadata from
src/ankimcp/manifest.json, vendors the mcp runtime dependency into
vendor/, and filters out common build artifacts so the archive is ready to
upload to AnkiWeb. Use --skip-deps if you are packaging an already vendored
source tree.
# Clone the repository
git clone https://github.com/yourusername/ankimcp.git
cd ankimcp
# Install dependencies with Rye
rye sync
# Run the test server (with mock data)
rye run python -m ankimcpOnce installed, the MCP server runs automatically when Anki is open. You can then connect to it from any MCP-compatible AI assistant.
list_decks- List all available Anki decksget_deck_info- Get detailed information about a specific decksearch_notes- Search for notes using Anki's search syntaxget_note- Get detailed information about a specific noteget_cards_for_note- Get all cards associated with a noteget_review_stats- Get review statistics for a deck or overalllist_note_types- List all note types with their fields and templatescreate_deck- Create a new deckcreate_note_type- Create a new note type (card template)create_note- Create a new note in a deckupdate_note- Update an existing note's fields or tagsupdate_deck- Update a deck's name or descriptiondelete_note- Delete a note and all its cardsdelete_deck- Delete a deck and all its cardsget_permissions- View current permission settings
AnkiMCP includes a comprehensive permission system to control AI access to your collection. You can:
- Set global read/write/delete permissions
- Use allowlists or denylists for deck access
- Protect specific decks from modification
- Restrict access based on note tags
- Control which note types can be created
See PERMISSIONS.md for detailed configuration options.
Edit the addon configuration in Anki (Tools → Add-ons → AnkiMCP → Config):
{
"host": "localhost",
"port": 4473,
"permissions": {
"global": {
"read": true,
"write": true,
"delete": false
},
"mode": "denylist",
"deck_permissions": {
"denylist": ["Personal::*"]
},
"protected_decks": ["Default"]
}
}- Run
rye run testto exercise the automated suite. - COD-73 acceptance: packaged add-on bundles the
mcpruntime dependency (viapackage_for_ankiweb.pyorinstall_addon.sh) and the automated tests pass.
Visit https://ankimcp.com for more details and documentation.