Skip to main content

Standalone MCP server that enables LLMs like Claude to interact with Anki flashcard collections using Anki's Python library

Project description

The simplest and most stable Anki MCP Server.

Selectively commit what you learn in conversation with an LLM to memory using Anki - a flashcard learning system.

Python 3.10+ MCP License: MIT

API Documentation

Features

  • Supports a minimal set of core anki operations, (CRUD & search flashcards and collections).
  • Zero dependencies, works directly with anki's fairly stable pylib api.
  • Doesn't require any addons, works with a basic anki installation.
  • Good documentation.

Installation

Prerequisites

  • Python 3.10 or higher
  • UV package manager (recommended) or pip
  • Anki 2.1.50+ installed.
  • Note: Anki application should be closed when using the MCP server.

Usage

Claude Code (CLI)

  1. Add the MCP server with user scope (available globally):

    claude mcp add --transport stdio --scope user anki -- uvx mousetail
    

    Flags explained:

    • --transport stdio: Specifies stdio communication
    • --scope user: Makes the server available in all Claude Code sessions (not just current project)
    • anki: The name you want to give this MCP server
    • --: Separates Claude Code flags from the server command
    • uvx mousetail: Runs the mousetail package from PyPI using uvx
  2. Verify it's configured:

    claude mcp list
    
  3. Start using it in any Claude Code session:

    "List my Anki decks"
    "Create a flashcard in my Spanish deck"
    

That's it! Claude Code will now have access to your Anki collections across all sessions.

Note: If you prefer to use pip instead of uvx, you can install with pip install mousetail and then add the server with:

claude mcp add --transport stdio --scope user anki -- python -m mousetail.mcp.stdio_server

Claude Desktop (GUI App)

For the Claude Desktop application:

  1. Edit your Claude Desktop configuration file:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
    • Linux: ~/.config/Claude/claude_desktop_config.json
  2. Add the MCP server configuration:

    {
      "mcpServers": {
        "anki": {
          "command": "uvx",
          "args": ["mousetail"]
        }
      }
    }
    
  3. Restart Claude Desktop

    Close and reopen Claude Desktop for the changes to take effect.

  4. Start Using!

    You can now ask Claude to interact with your Anki:

    "List my Anki decks"
    "Create a flashcard in my Spanish deck with 'Hola' on the front and 'Hello' on the back"
    "Search for all cards in my Physics deck that are tagged 'formulas'"
    

Important Notes

Anki Must Be Closed

The MCP server and Anki application both access the same SQLite database files directly. Because SQLite uses file-based locking, you must close Anki before using the MCP server. Attempting to use both simultaneously will result in "Collection is locked" errors.

How Collections Are Accessed

The MCP server finds Anki collections at their standard locations:

  • macOS: ~/Library/Application Support/Anki2/[Profile]/collection.anki2
  • Linux: ~/.local/share/Anki2/[Profile]/collection.anki2
  • Windows: %APPDATA%\Anki2\[Profile]\collection.anki2

You don't need to configure paths - the server automatically discovers available collections.

Configuration

Edit config.json to customize settings:

{
  "collection": {
    "auto_open_default": true,
    "default_path": null
  },
  "logging": {
    "level": "INFO",
    "file": null
  }
}

Development

Building Documentation

The project uses Sphinx with the Furo theme to generate documentation from Python docstrings.

  1. Install documentation dependencies:

    uv pip install ".[docs]"
    
  2. Build the documentation:

    uv run python -m sphinx -b html docs docs/_build/html
    
  3. View the documentation:

    open docs/_build/html/index.html  # macOS
    xdg-open docs/_build/html/index.html  # Linux
    start docs/_build/html/index.html  # Windows
    

The documentation is automatically built and deployed to GitHub Pages on every push to the main branch.

License

MIT License - see LICENSE file for details.

Acknowledgments

  • Anki - The amazing spaced repetition software
  • MCP - Model Context Protocol by Anthropic

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mousetail-0.1.1.tar.gz (97.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mousetail-0.1.1-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file mousetail-0.1.1.tar.gz.

File metadata

  • Download URL: mousetail-0.1.1.tar.gz
  • Upload date:
  • Size: 97.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mousetail-0.1.1.tar.gz
Algorithm Hash digest
SHA256 988db455cdde2f87d04642c3b4d61410710924f53ecded2c4ec01c2e630fda8a
MD5 ac7272374dbcc536be253306332bf25b
BLAKE2b-256 f8460639077fb5d75509f6b6cc9e934696690f9c76c1fe1cd5635fd49eb71c6f

See more details on using hashes here.

Provenance

The following attestation bundles were made for mousetail-0.1.1.tar.gz:

Publisher: publish.yml on listfold/mousetail

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mousetail-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mousetail-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mousetail-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c04fe44f7a8f109d65000420594f5d97f8e1415eadb0412a6a8f005ec3b9418f
MD5 2c14ee9131551d8f9b7ed8838e622d2b
BLAKE2b-256 f4cfea3fe9bb624060bd68bf349df3c3bf65615c533732e6003555a35187576b

See more details on using hashes here.

Provenance

The following attestation bundles were made for mousetail-0.1.1-py3-none-any.whl:

Publisher: publish.yml on listfold/mousetail

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page