Skip to main content

Anki MCP Connector

A Model Context Protocol (MCP) server that enables AI assistants to create Anki flashcards programmatically via AnkiConnect.

Overview

Anki MCP Connector provides a set of tools that allow MCP clients (like Claude Desktop) to interact with Anki, enabling automated flashcard creation and deck management. This makes it easy to create study materials directly from your conversations with AI assistants.

Features

  • 📚 List all Anki decks - Get all available decks in your Anki collection
  • 🎴 Get note type models - Discover available card templates (Basic, Cloze, etc.)
  • 🔍 Inspect model fields - See what fields are available for each note type
  • ➕ Create flashcards - Add notes with custom fields, tags, and content
  • 🏷️ Automatic tagging - All created cards are tagged with "Automatic" for easy filtering

Prerequisites

  1. Anki - Download and install from ankiweb.net
  2. AnkiConnect - Install the AnkiConnect add-on for Anki:
    • Open Anki
    • Go to Tools → Add-ons → Get Add-ons
    • Enter code: 2055492159
    • Restart Anki

AnkiConnect will run automatically whenever Anki is open, listening on http://127.0.0.1:8765.

Installation

pip install anki-mcp-connector

Usage

With Claude Desktop

Add this 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": "anki-mcp-connector"
    }
  }
}

Then restart Claude Desktop. With Anki running, you can now ask Claude to create flashcards!

Example Conversations

You: "Create a flashcard with 'What is MCP?' on the front and 'Model Context Protocol' on the back in my 'Programming' deck"

You: "Add 5 vocabulary cards for common Spanish greetings to my Spanish deck"

You: "Create a cloze deletion card about Python list comprehensions"

Available Tools

The MCP server exposes the following tools:

get_deck_list()

Returns a list of all deck names in your Anki collection.

get_model_names()

Returns available note type models (e.g., "Basic", "Basic (and reversed card)", "Cloze").

get_model_field_names(modelName: str)

Returns the field names for a specific model.

Example: For "Basic" model, returns ["Front", "Back"]

add_note(deckName: str, modelName: str, fields: dict, tags: list = None)

Creates a new flashcard in the specified deck.

Parameters:

  • deckName: Target deck name
  • modelName: Note type to use
  • fields: Dictionary mapping field names to content
  • tags: Optional list of tags (always includes "Automatic")

Example:

add_note(
    deckName="Japanese",
    modelName="Basic",
    fields={"Front": "こんにちは", "Back": "Hello"},
    tags=["greetings", "basic"]
)

Development

Setup

# Clone the repository
git clone https://github.com/yourusername/anki-mcp-connector.git
cd anki-mcp-connector

# Install in development mode
pip install -e .

Building

# Install build tools
pip install build twine

# Build the package
python -m build

# Upload to PyPI (requires credentials)
python -m twine upload dist/*

Troubleshooting

"Connection refused" errors

  • Make sure Anki is running
  • Verify AnkiConnect is installed (Tools → Add-ons)
  • Check that AnkiConnect is listening on port 8765

"Deck not found" errors

  • Use get_deck_list() to see exact deck names (case-sensitive)
  • Create the deck in Anki first if it doesn't exist

Duplicate cards

The server prevents duplicates by default. If a card with the same content exists, you'll get an error.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE file for details.


Note: This package requires Anki to be running with the AnkiConnect add-on installed. It communicates locally and does not send any data over the internet.

Metadata

Release files for anki-mcp-connector 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for anki-mcp-connector 0.1.8
File Size Uploaded Provenance Actions
anki_mcp_connector-0.1.8.tar.gz 9.5 kB Without provenance Details for anki_mcp_connector-0.1.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for anki-mcp-connector 0.1.8
File Interpreter ABI Platform Actions
anki_mcp_connector-0.1.8-py3-none-any.whl Python 3 none any Details for anki_mcp_connector-0.1.8-py3-none-any.whl

Total release size: 19.4 kB

Release files / anki_mcp_connector-0.1.8.tar.gz

Download URL anki_mcp_connector-0.1.8.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
896b0b79b68206ca2a5164ab4b911bbf05e1e3fa42cd1d4d1c75d9275b1be073
BLAKE2b-256 checksum
How to use checksums
7d0e2b876a93273c37395d61e123bb4e7f975d24aca5496ec83130b60b35a630
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.5

Release files / anki_mcp_connector-0.1.8-py3-none-any.whl

Download URL anki_mcp_connector-0.1.8-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
072af78ec873adc58b4c1863db73848f7be627a542d517b73f2473117efdc29e
BLAKE2b-256 checksum
How to use checksums
a4d4ee4e0d41aafb68c5f8945bba8ce70ab9f9e5c65f08f9aeb84791257489eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.5

Security for anki-mcp-connector 0.1.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page