About Anki MCP
Anki MCP is an MCP server published by ezynda3 in the Developer Tools category: anki MCP Server. It has been installed 0 times through Conduid.
The repository has 1 stars and 0 forks, with the last commit a year ago. Six months or more without a commit doesn't mean the server is broken, but check the open issues (0) before depending on it in production.
Install
npx anki-mcpThis server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.
Ask AI
Ask AI about Anki MCP
Powered by Claude · Grounded in docs
Security checks
- ·README presentNot checked yet.
- ·License declaredNot checked yet.
- ·Tests presentNot checked yet.
- ·Dependencies pinnedNot checked yet.
- ·No dynamic code executionNot checked yet.
- !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.
README
Anki MCP Server
A Model Context Protocol (MCP) server that provides tools for managing Anki flashcards through AnkiConnect. This server allows AI assistants to create, search, and manage Anki cards and decks programmatically.
Features
- Card Management: Create new flashcards with front/back content
- Deck Operations: List, create, and manage Anki decks
- Search Functionality: Search cards using Anki's powerful search syntax
- Media Support: Add images and audio files to cards
- Model Support: Work with different note types/models
- Sync Integration: Trigger AnkiWeb synchronization
- Configurable: Customizable AnkiConnect URL
Prerequisites
- Anki Desktop: Install Anki desktop application
- AnkiConnect: Install the AnkiConnect addon in Anki
- Go: Go 1.21 or later for building from source
Installation
From Source
git clone https://github.com/ezynda3/anki-mcp.git
cd anki-mcp
go build -o anki-mcp .
Using Go Install
go install github.com/ezynda3/anki-mcp@latest
Configuration
The server can be configured using environment variables:
ANKI_CONNECT_URL: AnkiConnect server URL (default:http://localhost:8765)
Usage
With Claude Desktop
Add the following to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"anki": {
"command": "/path/to/anki-mcp",
"env": {
"ANKI_CONNECT_URL": "http://localhost:8765"
}
}
}
}
With MCP Inspector
For development and testing:
# Install MCP Inspector
npm install -g @modelcontextprotocol/inspector
# Run with inspector
mcp-inspector /path/to/anki-mcp
Direct Usage
# Start the server
./anki-mcp
# The server communicates via stdio using the MCP protocol
Available Tools
ping
Check if AnkiConnect is available and responding.
Parameters: None
Example:
Use the ping tool to check if Anki is running.
list_decks
List all available Anki decks.
Parameters: None
Example:
Show me all my Anki decks.
create_deck
Create a new Anki deck.
Parameters:
deck_name(required): Name of the deck to create
Example:
Create a new deck called "Spanish Vocabulary".
create_card
Create a new flashcard in a specified deck.
Parameters:
deck_name(required): Name of the deck to add the card tofront(required): Front side content of the cardback(required): Back side content of the cardmodel_name(optional): Note type to use (default: "Basic")tags(optional): Array of tags to add to the card
Example:
Create a card in my "Spanish Vocabulary" deck with front "Hola" and back "Hello" with tags "greetings" and "basic".
search_cards
Search for cards using Anki's search syntax.
Parameters:
query(required): Search query using Anki search syntaxlimit(optional): Maximum number of results to return (default: 10)
Examples:
Search for cards in the "Spanish Vocabulary" deck.
Find cards tagged with "difficult".
Search for cards containing "hello" in any field.
Search Syntax Examples:
deck:"Spanish Vocabulary"- Cards in a specific decktag:difficult- Cards with a specific tagfront:hello- Cards with "hello" in the front fieldis:due- Cards that are due for reviewadded:1- Cards added in the last day
add_media
Add a media file to Anki's media collection.
Parameters:
filename(required): Name of the media filedata(required): Base64 encoded media file data
Example:
Add an audio file "pronunciation.mp3" to Anki's media collection.
create_card_with_media
Create a new flashcard with media attachments.
Parameters:
deck_name(required): Name of the deck to add the card tofront(required): Front side content of the cardback(required): Back side content of the cardmodel_name(optional): Note type to use (default: "Basic")tags(optional): Array of tags to add to the cardaudio_filename(optional): Audio filename to attachaudio_data(optional): Base64 encoded audio dataimage_filename(optional): Image filename to attachimage_data(optional): Base64 encoded image data
Example:
Create a card with an image showing a Spanish flag and audio pronunciation.
get_models
Get all available note types/models in Anki.
Parameters: None
Example:
Show me all available note types in Anki.
get_model_fields
Get field names for a specific note type/model.
Parameters:
model_name(required): Name of the model to get fields for
Example:
What fields are available for the "Cloze" note type?
sync
Trigger Anki to sync with AnkiWeb.
Parameters: None
Example:
Sync my Anki collection with AnkiWeb.
Error Handling
The server provides detailed error messages for common issues:
- AnkiConnect not available: Ensure Anki is running and AnkiConnect addon is installed
- Deck not found: Check deck name spelling and existence
- Invalid parameters: Verify required parameters are provided
- Media encoding errors: Ensure media data is properly base64 encoded
Development
Building
go build -v .
Testing
go test -v ./...
Code Structure
main.go: MCP server implementation and tool handlersankiconnect.go: AnkiConnect client wrappergo.mod: Go module dependencies
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.
Acknowledgments
- Built using MCP-Go
- Integrates with AnkiConnect
- Inspired by the go-anki-deck library
Troubleshooting
Common Issues
"AnkiConnect is not available"
- Ensure Anki desktop is running
- Verify AnkiConnect addon is installed and enabled
- Check that AnkiConnect is listening on the correct port (default: 8765)
"Failed to create deck/card"
- Verify deck names don't contain invalid characters
- Check that required fields are provided
- Ensure AnkiConnect permissions allow the operation
Media files not working
- Verify media data is properly base64 encoded
- Check file extensions are supported by Anki
- Ensure media files aren't too large
Debug Mode
Set environment variable for verbose logging:
export MCP_DEBUG=1
./anki-mcp
API Reference
For detailed information about the Model Context Protocol, see:
For AnkiConnect API details, see:
README mirrored from the source repository 4 months ago. The original is authoritative.