
MCP server for anki, mostly vibecoded with claude code.
概览
A FastMCP server for interacting with Anki through the Model Context Protocol (MCP). This server provides comprehensive tools for managing Anki decks, notes, and note types, with advanced features including AI-powered audio generation, bulk operations, and semantic similarity search. This project integrates with several external APIs to provide enhanced functionality: - : High-quality audio generation from text using Google's Chirp voices - : Generate pronunciation audio files for flashcards - : HD quality voices with natural pronunciation, especially excellent for Chinese - : Requires GOOGLE_CLOUD_API_KEY environment variable - : Interface with Anki desktop application - : All Anki operations (create/read/update notes, manage decks, etc.) - : Complete Anki functionality via HTTP API - : AnkiConnect add-on must be installed and Anki must be running 2.
README
以下为原文 README 节选,完整内容请查看原文。
Anki MCP Server
A FastMCP server for interacting with Anki through the Model Context Protocol (MCP). This server provides comprehensive tools for managing Anki decks, notes, and note types, with advanced features including AI-powered audio generation, bulk operations, and semantic similarity search.
External APIs Used
This project integrates with several external APIs to provide enhanced functionality:
Google Cloud Text-to-Speech API
- Purpose: High-quality audio generation from text using Google’s Chirp voices
- Use Case: Generate pronunciation audio files for flashcards
- Features: HD quality voices with natural pronunciation, especially excellent for Chinese
- Setup: Requires
GOOGLE_CLOUD_API_KEYenvironment variable
AnkiConnect API (Local)
- Purpose: Interface with Anki desktop application
- Use Case: All Anki operations (create/read/update notes, manage decks, etc.)
- Features: Complete Anki functionality via HTTP API
- Setup: AnkiConnect add-on must be installed and Anki must be running
Setup
-
Install dependencies using uv:
uv sync -
Make sure Anki is running with the AnkiConnect add-on installed:
- In Anki, go to Tools > Add-ons > Get Add-ons
- Enter code:
2055492159 - Restart Anki
-
(Optional) Set up API key for audio generation:
# For audio generation with Google Cloud TTS export GOOGLE_CLOUD_API_KEY='your-google-cloud-api-key-here' -
Run the server:
uv run server.py
Claude Desktop Integration
To use this MCP server with Claude Desktop, add the following configuration to your claude_desktop_config.json file:
Configuration Location
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Configuration Example
{
"mcpServers": {
"anki-mcp": {
"command": "uv",
"args": [
"--directory",
"/path/to/your/anki-mcp/",
"run",
"server.py"
],
"env": {
"GOOGLE_CLOUD_API_KEY": "your-google-cloud-api-key-here"
}
}
}
}
Setup Steps
- Ensure dependencies are installed: Make sure you’ve run
uv syncin your anki-mcp directory - Find your config file at the location above (create it if it doesn’t exist)
- Update the path: Replace
/path/to/your/anki-mcp/with the actual path to your anki-mcp directory - Add your API key:
- Replace
your-google-cloud-api-key-herewith your actual Google Cloud API key (for audio generation)
- Replace
- Restart Claude Desktop for the changes to take effect
Important Notes
- Make sure Anki is running with the AnkiConnect add-on before using the tools
- The
uvcommand will automatically handle the Python environment and dependencies - Make sure
uvis installed on your system (curl -LsSf https://astral.sh/uv/install.sh | sh)
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →配置
{
"mcpServers": {
"anki-mcp": {
"command": "uv",
"args": [
"--directory",
"/path/to/your/anki-mcp/",
"run",
"server.py"
],
"env": {
"GOOGLE_CLOUD_API_KEY": "your-google-cloud-api-key-here"
}
}
}
}