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

📚 View Full Documentation - Interactive tool reference with all MCP tools and parameters

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
  • Anki 2.1.50+ installed.
  • Note: Anki application should be closed when using the MCP server.

Setup

  1. Clone the repository:
git clone https://github.com/listfold/mousetail.git
cd mousetail
  1. Install dependencies:
uv sync
  1. Run
run python -m mousetail.mcp.stdio_server

Usage

Claude Code (CLI)

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

    claude mcp add --transport stdio --scope user anki -- uv --directory /absolute/path/to/mousetail run python -m mousetail.mcp.stdio_server
    

    Replace /absolute/path/to/mousetail with the actual path to this directory.

    Flags explained:

    • --transport stdio: Specifies stdio communication
    • --scope user: Makes the server available in all Claude Code sessions (not just current project)
    • --: Separates Claude Code flags from the server command
  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.

Option 2: Claude Desktop (GUI App)

For the Claude Desktop application:

  1. Configure Claude Desktop

    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": "uv",
          "args": [
            "run",
            "python",
            "-m",
            "mousetail.mcp.stdio_server"
          ],
          "cwd": "/absolute/path/to/mousetail"
        }
      }
    }
    

    Replace /absolute/path/to/mousetail with the actual path to this directory.

  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.0.tar.gz (96.4 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.0-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mousetail-0.1.0.tar.gz
  • Upload date:
  • Size: 96.4 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.0.tar.gz
Algorithm Hash digest
SHA256 2954eb5d778bcde7072ff039de9973781bf5b5ae4a3ad170b415270a3ff75366
MD5 8a8dabf8c25730317a813517148b33c0
BLAKE2b-256 4383c4377e43751ceca53002bc82a86d6a9649d067903e53d1b9ecd552a57189

See more details on using hashes here.

Provenance

The following attestation bundles were made for mousetail-0.1.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: mousetail-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.0 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb6791e64a4258fc6464f7ceafb390670693b197d8ed6710fc7c02c1c6092d33
MD5 ebdde76d21d2ab68e64efea1fec0a924
BLAKE2b-256 6f486d21d4610f73a799eb40bd3ba2368cc8968ebbcb56fecaac972ed650814b

See more details on using hashes here.

Provenance

The following attestation bundles were made for mousetail-0.1.0-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