Anki Connect MCP Server
Integrates with Anki via the AnkiConnect add-on to manage flashcards, decks, cards, tags, and GUI operations in Anki.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Anki Connect MCP ServerCreate a new card in my Japanese deck with front '犬' and back 'dog'."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Anki Connect MCP Server
A Model Context Protocol (MCP) server that provides seamless integration with Anki through the AnkiConnect add-on. This server enables AI assistants and other MCP clients to interact with your Anki flashcard collection programmatically.

What is Anki Connect?
AnkiConnect is a powerful Anki add-on that exposes Anki's functionality through a REST API. It allows external applications to:
Create, modify, and delete flashcards
Manage decks and their configurations
Control Anki's GUI programmatically
Search and retrieve card information
Manage tags and note types
Perform bulk operations on cards and notes
Related MCP server: Anki MCP Server
What is MCP (Model Context Protocol)?
The Model Context Protocol is a standardized way for AI assistants to connect to external data sources and tools. This MCP server acts as a bridge between MCP clients (like Claude Desktop) and AnkiConnect, allowing AI assistants to help you manage your Anki flashcards naturally through conversation.
Features
Every tool comes with a description, a title and MCP annotations (readOnlyHint / destructiveHint), so clients can auto-approve read-only tools and ask before destructive ones. On connect the server also sends instructions for the agent: Anki search syntax, note IDs vs card IDs, and the recommended flow for adding cards.
Errors are reported as tool errors (isError: true): AnkiConnect error: ... when Anki rejects a request, and Could not reach AnkiConnect at <url>... when Anki is not running.
Default tools
Notes:
add_note,add_notes,can_add_notes,update_note_fields,add_tags,remove_tags,find_notes,notes_infoCards:
find_cards,cards_info,cards_to_notes,suspend,unsuspend,are_suspended,are_due,get_intervalsDecks:
deck_names,deck_names_and_ids,get_decks,change_deck,delete_decks,get_deck_configModels:
model_names,model_names_and_ids,model_field_names,model_fields_on_templatesMisc:
version,get_tags
find_notes and find_cards return { ids, total, truncated } and accept an optional limit (default 100). cards_info strips the card CSS from the question and answer.
Optional tool groups
Group | Enabled by | Tools |
GUI |
|
|
Advanced |
|
|
Configuration
Variable | Default | Purpose |
|
| AnkiConnect address |
| – | Sent as |
| off |
|
| off |
|
Upgrading from 1.x
create_flashcardwas removed; useadd_notewithdeckName,modelNameandfields.GUI tools,
multi,upgradeand deck-config editing tools are hidden unless their group is enabled.Tool results contain only AnkiConnect's
result(no{result, error}envelope); errors come back as tool errors.find_notes/find_cardsreturn{ ids, total, truncated }instead of a plain array.Node.js 20 or newer is required.
Prerequisites
1. Install AnkiConnect Add-on
Open Anki
Go to Tools → Add-ons
Click Get Add-ons...
Enter the code:
2055492159Click OK and restart Anki
2. Configure AnkiConnect (Optional)
AnkiConnect works out of the box, but you can customize its settings:
Go to Tools → Add-ons
Select AnkiConnect and click Config
Modify settings if needed (default port is 8765)
Restart Anki after making changes
Installation
Clone this repository:
git clone https://github.com/spacholski1225/anki-connect-mcp.git
cd anki-connect-mcpInstall dependencies:
npm installBuild the project:
npm run buildMCP Client Configuration
Claude Desktop
To use this MCP server with Claude Desktop, add the following configuration to your MCP settings file:
Location of MCP configuration file:
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
Configuration Options:
Option 1: Using Node.js (Local Installation)
{
"mcpServers": {
"anki-connect-mcp": {
"command": "node",
"args": [
"dist/index.js"
],
"env": {},
"disabled": false,
"alwaysAllow": [
"deck_names",
"cards_info",
"deck_names_and_ids",
"find_notes"
]
}
}
}Option 2: Using npx (NPM Package)
Then configure your MCP client:
{
"mcpServers": {
"anki-connect": {
"command": "npx",
"args": [
"@spacholski1225/anki-connect-mcp"
],
"env": {},
"disabled": false,
"alwaysAllow": [
"deck_names",
"cards_info",
"deck_names_and_ids",
"find_notes"
]
}
}
}Option 3: Using Docker
{
"mcpServers": {
"anki-connect": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"--network=host",
"-e", "ANKI_CONNECT_URL=http://host.docker.internal:8765",
"spacholski/anki-connect-mcp:latest"
],
"env": {},
"disabled": false,
"alwaysAllow": [
"deck_names",
"cards_info",
"deck_names_and_ids",
"find_notes"
]
}
}
}Docker-Specific AnkiConnect Configuration:
When using the Docker option, you must configure AnkiConnect with specific settings to allow Docker container access:
Go to Tools → Add-ons in Anki
Select AnkiConnect and click Config
Update the configuration with the following settings:
{
"apiKey": null,
"apiLogPath": null,
"ignoreOriginList": [],
"webBindAddress": "0.0.0.0",
"webBindPort": 8765,
"webCorsOriginList": [
"http://localhost",
"http://host.docker.internal",
"http://host.docker.internal:3000"
]
}Key Docker Configuration Points:
webBindAddress: "0.0.0.0"- Allows AnkiConnect to accept connections from any IP address (required for Docker containers)webCorsOriginList- Must include"http://host.docker.internal"and related origins to allow cross-origin requests from Docker containersRestart Anki after making these configuration changes
Important Notes:
For Node.js option: Replace the path in
argswith the actual path to your builtindex.jsfileFor npx option: Uses the published NPM package
@spacholski1225/anki-connect-mcp- no local installation requiredFor Docker option: Uses the pre-built Docker image
spacholski/anki-connect-mcp:latestThe
alwaysAllowarray contains tools that won't require confirmation each timeMake sure Anki is running with AnkiConnect enabled before using the MCP server
For Docker option, the
--network=hostflag allows the container to access AnkiConnect on the host machine
Usage Examples
Once configured with an MCP client like Claude Desktop, you can interact with your Anki collection naturally:
"Create a flashcard about the capital of France in my Geography deck"
"Show me all my deck names"
"Find all cards tagged with 'vocabulary'"
"Suspend all cards in the 'Difficult Words' deck"
"Open the deck browser in Anki" (needs
ANKI_MCP_ENABLE_GUI=1)
Troubleshooting
Common Issues
Connection refused: Make sure Anki is running and AnkiConnect is installed
Port conflicts: Check if port 8765 is available or configure AnkiConnect to use a different port
Permission errors: Ensure the MCP server has proper file system permissions
Tool not found: Verify the MCP client configuration and restart the client
Development
npm run typecheck # type-check sources and tests
npm test # protocol-level tests against a fake AnkiConnect
npm run buildContributing
Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.
License
MIT License
References
This server cannot be deployed
Maintenance
Related MCP Connectors
Turn text, files, URLs, or photos into Anki flashcard decks from your AI assistant.
- FlipnemOAuthcom.flipnem
Build and study spaced-repetition flashcards with your agent.
- LexicaOAuthcom.uselexica
Language flashcards in your AI assistant: build decks, edit cards and review what's due in the chat.
Lets Claude, ChatGPT, and Muse read and update your beckett tasks, notes, calendar, and lists.
Related MCP Servers
- FlicenseNot gradedqualityNot gradedmaintenanceEnables AI assistants like Claude to interact with Anki flashcard decks through AnkiConnect. Supports creating and managing decks, basic and cloze deletion cards, searching existing cards, and organizing content with tags.-
- AlicenseNot gradedqualityCmaintenanceEnables interaction with the Anki desktop flashcard application through the Anki-Connect plugin. Supports managing decks, cards, notes, and models, allowing AI assistants to create and query flashcards through natural language.3 npm1ISC
- AlicenseAqualityDmaintenanceEnables AI assistants to manage Anki flashcard collections by creating, searching, and updating cards through a standardized interface. It supports media handling, batch operations, and review scheduling via the AnkiConnect add-on.62MIT
- AlicenseAqualityDmaintenanceEnables AI tools to manage Anki flashcards, including deck management, card search, creation, editing, deletion, and statistics.1045 npm3Apache 2.0