AndrewGEvans95/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.
Anki MCP Server is a Model Context Protocol server that facilitates the creation and management of Anki flashcards through the AnkiConnect add-on.
create_anki_note
Create a new Anki flashcard.
create_cloze_note
Create a cloze deletion card.
bulk_create_notes
Create multiple notes at once.
create_anki_deck
Create a new deck.
list_anki_decks
List all available decks.
list_anki_models
List all available note types/models.
get_anki_model_fields
Get field names for a specific model.
Anki MCP Server
A Model Context Protocol (MCP) server that enables AI assistants to create and manage Anki flashcards through the AnkiConnect add-on.
Features
- β Create individual Anki notes/flashcards
- β Create cloze deletion cards
- β Bulk create multiple notes at once
- β Create new decks
- β List available decks and note types
- β Get model field information
- β Support for tags and duplicate handling
Prerequisites
- Anki - Download and install from ankiweb.net
- AnkiConnect Add-on - Install the AnkiConnect add-on (code:
2055492159
)- In Anki: Tools β Add-ons β Get Add-ons β Enter code
2055492159
- Restart Anki after installation
- In Anki: Tools β Add-ons β Get Add-ons β Enter code
Installation
- Clone this repository:
git clone https://github.com/yourusername/anki-mcp-server.git
cd anki-mcp-server
- Install dependencies:
npm install
- Build the project:
npm run build
Usage
Running the Server
Start the MCP server:
npm start
Or for development:
npm run dev
Available Tools
create_anki_note
Create a new Anki flashcard.
Parameters:
deckName
(string, required): Name of the deckmodelName
(string, optional): Note type (default: "Basic")fields
(object, required): Field values (e.g.,{"Front": "Question", "Back": "Answer"}
)tags
(array, optional): Tags to addallowDuplicate
(boolean, optional): Allow duplicate cards
Example:
{
"deckName": "Spanish Vocabulary",
"fields": {
"Front": "ΒΏCΓ³mo estΓ‘s?",
"Back": "How are you?"
},
"tags": ["spanish", "greetings"]
}
create_cloze_note
Create a cloze deletion card.
Parameters:
deckName
(string, required): Name of the decktext
(string, required): Text with cloze deletions (e.g., "{{c1::Paris}} is the capital of France")extra
(string, optional): Additional informationtags
(array, optional): Tags to add
Example:
{
"deckName": "Geography",
"text": "{{c1::Paris}} is the capital of {{c2::France}}",
"tags": ["geography", "capitals"]
}
bulk_create_notes
Create multiple notes at once.
Parameters:
notes
(array, required): Array of note objects
Example:
{
"notes": [
{
"deckName": "Math",
"fields": {"Front": "2 + 2", "Back": "4"}
},
{
"deckName": "Math",
"fields": {"Front": "3 Γ 3", "Back": "9"}
}
]
}
create_anki_deck
Create a new deck.
Parameters:
deckName
(string, required): Name of the new deck
list_anki_decks
List all available decks.
list_anki_models
List all available note types/models.
get_anki_model_fields
Get field names for a specific model.
Parameters:
modelName
(string, required): Name of the model
Integration with AI Assistants
This MCP server can be integrated with AI assistants that support the Model Context Protocol. The assistant can then:
- Create flashcards from study materials
- Generate cloze deletion cards from text
- Convert questions and answers into Anki cards
- Organize cards into appropriate decks
- Bulk import flashcard sets
Configuration
The server connects to AnkiConnect on http://localhost:8765
by default. Make sure:
- Anki is running
- AnkiConnect add-on is installed and enabled
- No firewall is blocking the connection
Troubleshooting
"Failed to connect to AnkiConnect"
- Ensure Anki is running
- Verify AnkiConnect add-on is installed (code:
2055492159
) - Check that AnkiConnect is listening on port 8765
"AnkiConnect error: deck was not found"
- The specified deck doesn't exist
- Use
create_anki_deck
first orlist_anki_decks
to see available decks
"AnkiConnect error: model was not found"
- The specified note type doesn't exist
- Use
list_anki_models
to see available note types - Common types: "Basic", "Basic (and reversed card)", "Cloze"
Development
Project Structure
anki-mcp-server/
βββ src/
β βββ index.ts # Main server code
βββ dist/ # Compiled JavaScript
βββ package.json
βββ tsconfig.json
βββ README.md
Building
npm run build
Development Mode
npm run dev
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
MIT License - see LICENSE file for details.
Related Projects
- Anki - Spaced repetition flashcard program
- AnkiConnect - Anki add-on for external applications
- Model Context Protocol - Protocol for AI assistant integrations