Anki MCP Server
Provides programmatic access to Anki flashcard operations through the AnkiConnect API, allowing users to list and create decks and cards. It enables seamless management of flashcards directly from MCP-compatible clients like Claude Desktop.
README
Anki MCP Server
MCP server providing programmatic access to Anki flashcard operations via AnkiConnect API.
Features
- list_decks - List all Anki decks
- list_cards - List all flashcards in a specific deck
- create_deck - Create a new Anki deck
- create_card - Create a new flashcard in a deck
Prerequisites
Before using this MCP server, you must have:
- Anki desktop application installed and running
- AnkiConnect plugin installed in Anki
- Plugin ID: 2055492159
- Install from: https://ankiweb.net/shared/info/2055492159
- Or install via Anki: Tools → Add-ons → Get Add-ons → Enter code
2055492159
Verifying AnkiConnect Installation
After installing AnkiConnect, verify it's working:
curl http://localhost:8765 -X POST -d '{"action": "version", "version": 6}'
You should see a response like: {"result": 6, "error": null}
If you get a connection error, make sure Anki is running.
Installation
Using uv (recommended)
# Clone or navigate to the project directory
cd mcp-server-anki
# Install dependencies
uv pip install -e .
Using pip
cd mcp-server-anki
pip install -e .
Configuration
Add the server to your MCP client configuration (e.g., claude_desktop_config.json):
{
"mcpServers": {
"anki": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/mcp-server-anki",
"run",
"mcp-server-anki"
]
}
}
}
Replace /absolute/path/to/mcp-server-anki with the actual path to the project directory.
Alternative Configuration (without uv)
{
"mcpServers": {
"anki": {
"command": "python",
"args": [
"-m",
"mcp_server_anki.server"
]
}
}
}
Usage
List Decks
List all my Anki decks
Response:
{
"decks": ["Default", "Python", "System Design"]
}
Create Deck
Create a new Anki deck called "Machine Learning"
Response:
{
"deck_id": 1234567890123,
"message": "Deck 'Machine Learning' created successfully"
}
Create Card
Add a flashcard to the "Python" deck with front "What is a decorator?" and back "A function that modifies another function"
Response:
{
"note_id": 1234567890,
"message": "Card created successfully in deck 'Python'"
}
List Cards
Show me all cards in the "Python" deck
Response:
{
"cards": [
{
"note_id": 1234567890,
"fields": {
"Front": "What is a decorator?",
"Back": "A function that modifies another function"
},
"tags": ["python", "advanced"]
}
]
}
Example Workflow
Create a new Anki deck called 'System Design' and add a card with front 'What is CAP theorem?' and back 'Consistency, Availability, Partition Tolerance trade-off'
This will:
- Create the deck "System Design"
- Add the flashcard to the deck
- Confirm both operations succeeded
Error Handling
Anki Not Running
If Anki is not running or AnkiConnect is not installed:
Error: Could not connect to Anki. Is Anki running with AnkiConnect installed?
Solution: Start Anki and ensure AnkiConnect is installed.
Deck Not Found
If you try to list cards from a non-existent deck:
Error: Deck 'NonExistent' not found
Solution: Create the deck first or check the deck name spelling.
Card Creation Failed
If you try to create a card in a non-existent deck:
Error: AnkiConnect error: cannot create note because it is a duplicate
Solution: Ensure the deck exists or check for duplicate cards.
Limitations
- Only supports "Basic" note type (two-sided cards)
- No support for custom note types
- No card editing or deletion
- No deck editing or deletion
- No media attachments (images/audio)
- Only works with local Anki instance on localhost:8765
Development
Project Structure
mcp-server-anki/
├── mcp_server_anki/
│ ├── __init__.py
│ ├── server.py # MCP server and tool definitions
│ └── anki_client.py # AnkiConnect HTTP client
├── pyproject.toml
└── README.md
Running Tests Manually
- Start Anki with AnkiConnect installed
- Use the MCP client to test each operation:
- List existing decks
- Create a new deck
- Create a card in the deck
- List cards in the deck
- Test error conditions (Anki not running, deck not found)
Troubleshooting
"Could not connect to Anki"
- Verify Anki is running
- Verify AnkiConnect is installed (Tools → Add-ons)
- Test AnkiConnect with curl (see verification section above)
"Deck not found"
- Deck names are case-sensitive
- Check spelling and capitalization
- List all decks to see available names
"Cannot create note because it is a duplicate"
- Anki prevents duplicate cards by default
- Either use different content or allow duplicates in Anki settings
License
MIT
Links
- AnkiConnect: https://github.com/FooSoft/anki-connect
- Anki: https://apps.ankiweb.net/
- MCP: https://modelcontextprotocol.io/
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。