Provides an MCP server that enables AI assistants to interact with Anki for notes, decks, and media management.
Configuration
View docs{
"mcpServers": {
"ankimcp-anki-mcp-server": {
"command": "npx",
"args": [
"-y",
"@ankimcp/anki-mcp-server",
"--stdio"
],
"env": {
"ANKI_CONNECT_URL": "http://localhost:8765",
"ANKI_CONNECT_API_KEY": "YOUR_API_KEY",
"ANKI_CONNECT_TIMEOUT": "5000",
"ANKI_CONNECT_API_VERSION": "6"
}
}
}
}You can connect AI assistants to Anki through a dedicated MCP server, enabling natural language interactions to manage notes, decks, and media. This server acts as a bridge between AnkiConnect-enabled Anki and MCP-powered assistants, so you can create, edit, search, and review content with conversational prompts.
Choose a transport mode based on how your AI assistant runs. Use STDIO for local desk-based assistants (recommended for Claude Desktop and similar clients) or HTTP for web-based assistants. Start by running the MCP server in one of the supported modes, then point your MCP client to the server using the provided configuration. You can perform actions like syncing with AnkiWeb, retrieving cards due for review, adding or updating notes, and managing media. For image handling, prefer file paths or URLs to keep transfers fast and token-efficient.
Prerequisites you need on your computer: a working Anki installation with AnkiConnect installed, and Node.js 20 or newer. Follow one of these options to get the MCP server running.
{
"mcpServers": {
"anki-mcp": {
"command": "npx",
"args": ["-y", "@ankimcp/anki-mcp-server", "--stdio"],
"env": {
"ANKI_CONNECT_URL": "http://localhost:8765"
}
}
}
}{
"mcpServers": {
"anki-mcp": {
"command": "ankimcp",
"args": ["--stdio"],
"env": {
"ANKI_CONNECT_URL": "http://localhost:8765"
}
}
}
}Best for Claude Desktop users. Download the latest .mcpb bundle, then install the extension in Claude Desktop via Settings > Extensions or Settings > Developer > Extensions.
Configure AnkiConnect if needed (defaults to http://localhost:8765) and restart Claude Desktop to start using the MCP server locally.
You can run the server from your terminal using npx or a global install, then connect your MCP client in STDIO mode.
Using npx (no installation):
{
"mcpServers": {
"anki-mcp": {
"command": "npx",
"args": ["-y", "@ankimcp/anki-mcp-server", "--stdio"],
"env": {
"ANKI_CONNECT_URL": "http://localhost:8765"
}
}
}
}Using a global installation:
{
"mcpServers": {
"anki-mcp": {
"command": "ankimcp",
"args": ["--stdio"],
"env": {
"ANKI_CONNECT_URL": "http://localhost:8765"
}
}
}
}If you want to connect web-based assistants like ChatGPT or Claude.ai, run the server in HTTP mode to expose an MCP endpoint that your assistant can reach. You can optionally enable an ngrok tunnel to create a public URL.
Common environment variable you will configure is ANKI_CONNECT_URL, which should point to your local AnkiConnect server. You can adjust the port and host for HTTP mode if you run the server directly, and you may enable an ngrok tunnel for public access when needed.
In Claude Desktop you can configure the MCP server by adding a mcpServers entry to the Claude desktop config. Use the STDIO entry with the appropriate command and arguments to start the server locally.
The following variables can be configured to customize behavior. Provide example values where shown. If a variable is not specified here, use the defaults described in the setup guide.
ANKI_CONNECT_URL=http://localhost:8765
ANKI_CONNECT_API_VERSION=6
ANKI_CONNECT_API_KEY=YOUR_API_KEY
ANKI_CONNECT_TIMEOUT=5000You can perform common actions like finding notes, updating fields, or deleting notes directly through natural language prompts. The server translates your requests into Anki actions via AnkiConnect, enabling a seamless learning workflow.
Be mindful of notes being updated while you view them in Anki’s browser; this can cause updates to fail. Always switch away from the note in the browser before applying updates. For web mode, ensure CORS settings allow the client you are using.
Build and run tasks include building TypeScript code, starting in different modes, and bundling into MCPB files for distribution. Use the following commands as needed in your development workflow.
Synchronize with AnkiWeb to ensure decks, notes, and media are up to date.
Retrieve cards that are due for review from selected decks.
Display a card for review in the current session.
Provide feedback on card performance to adapt future sessions.
List available decks in your Anki collection.
Create a new deck within Anki.
Create a new note in a specified deck with given fields.
Search notes using Anki query syntax.
Get detailed information about notes including fields, tags, and CSS.
Update existing note fields with HTML/CSS-aware support.
Delete notes and their associated cards, with explicit confirmation.
Manage media files including upload, retrieval, listing, and deletion.
Upload a media file from base64, a file path, or a URL.
Download a media file as base64.
List all media file names with optional pattern filtering.
Remove a media file from your collection.
List available note types (models) in your collection.
Get fields for a specific note type.
Retrieve CSS styling for a note type to ensure proper rendering.