anki-mcp

anki-mcp

A Model Context Protocol server that enables interaction with Anki flashcards through AnkiConnect, providing organized tools for managing decks, notes, cards, models, and media files.

Category
Visit Server

Tools

deck_deleteDecks

Deletes decks with the given names. The 'cardsToo' argument must be specified and set to true.

deck_changeDeck

Moves cards with the given IDs to a different deck, creating the deck if it doesn't exist yet.

deck_saveDeckConfig

Saves the given configuration group. Returns true on success, false otherwise.

note_updateNote

Modifies the fields and/or tags of an existing note.

card_suspend

Suspends the specified cards. Returns true on success.

model_modelFieldAdd

Adds a new field to an existing model.

media_retrieveMediaFile

Retrieves the base64-encoded contents of the specified media file. Returns the base64 string or false if not found.

media_getMediaFilesNames

Gets the names of media files matching the glob pattern. Returns a list of filenames.

deck_createDeck

Creates a new empty deck. Will not overwrite an existing deck with the same name. Returns the ID of the created deck.

deck_deckNamesAndIds

Gets the complete list of deck names and their respective IDs. Returns a dictionary mapping deck names to their IDs.

deck_getDeckConfig

Gets the configuration group object for the given deck name. Returns the deck configuration object.

deck_deckNames

Gets the complete list of deck names for the current user. Returns a list of deck names.

note_findNotes

Returns an array of note IDs for a given Anki search query.

note_notesInfo

Returns a list of objects containing information for each note ID provided.

note_getNoteTags

Gets the tags for a specific note ID. Returns a list of tags.

note_addNote

Creates a new note using the given deck, model, fields, and tags. Returns the ID of the created note or null if the note could not be created.

note_updateNoteFields

Modifies the fields of an existing note.

media_storeMediaFile

Stores a media file in Anki's media folder. Provide one of 'data' (base64), 'path', or 'url'. Returns the stored filename or false on error.

note_deleteNotes

Deletes notes with the given IDs.

note_addNotes

Creates multiple notes. See 'addNote' for the structure of each note object in the list. Returns a list of new note IDs, or null for notes that couldn't be created.

note_addTags

Adds tags to the specified notes.

note_removeTags

Removes tags from the specified notes.

card_findCards

Returns an array of card IDs for a given Anki search query.

card_cardsInfo

Returns a list of objects containing information for each card ID provided.

card_cardsToNotes

Returns an unordered array of note IDs for the given card IDs.

card_areSuspended

Returns an array indicating whether each given card is suspended. Each item is boolean or null if the card doesn't exist.

card_cardsModTime

Returns modification time for each card ID provided. Result is a list of objects with 'cardId' and 'modTime' (timestamp).

card_suspended

Checks if a single card is suspended by its ID. Returns true if suspended, false otherwise.

card_unsuspend

Unsuspends the specified cards. Returns true on success.

card_setSpecificValueOfCard

Sets specific values of a single card. Use with caution. Returns list of booleans indicating success for each key.

model_modelNamesAndIds

Gets the complete list of model (note type) names and their IDs. Returns a dictionary mapping model names to IDs.

model_findModelsByName

Gets a list of model definitions for the provided model names.

model_modelFieldNames

Gets the list of field names for the provided model name.

model_modelTemplates

Returns an object indicating the template content for each card of the specified model.

model_modelStyling

Gets the CSS styling for the provided model name. Returns an object containing the 'css' field.

model_createModel

Creates a new model (note type). Returns the created model object.

model_updateModelTemplates

Modifies the templates of an existing model by name.

model_updateModelStyling

Modifies the CSS styling of an existing model by name.

model_modelFieldRemove

Removes a field from an existing model.

media_deleteMediaFile

Deletes the specified file from Anki's media folder.

README

anki-mcp

A Model Context Protocol (MCP) server for interacting with Anki flashcards via the AnkiConnect add-on. This server exposes AnkiConnect actions as MCP tools, organized into logical services.

<a href="https://glama.ai/mcp/servers/@ujisati/anki-mcp"> <img width="380" height="200" src="https://glama.ai/mcp/servers/@ujisati/anki-mcp/badge" alt="anki-mcp MCP server" /> </a>

Prerequisites

  • Anki desktop application
  • AnkiConnect add-on installed and configured in Anki
  • Python 3.8+
  • uv (for running and installing dependencies, optional but recommended)

Installation

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

# Install dependencies (using uv)
uv pip install -e .

Usage

To run the MCP server:

uv run anki-mcp

The server will start and listen for MCP requests, typically interfacing with AnkiConnect at http://127.0.0.1:8765.

Inspecting the Server

You can use the MCP Inspector to view the available tools:

npx @modelcontextprotocol/inspector uv run anki-mcp

Configuration for MCP Clients

If you're integrating this with an MCP client (like an AI assistant framework), you'll need to configure it to find this server. Here's an example configuration snippet:

{
    "mcpServers": {
        "anki": {
            "command": "uv",
            "args": [
                "run", // uv will find anki-mcp if run from project root
                "anki-mcp"
            ],
            // If running from outside the project directory, specify the path:
            // "args": [
            //     "--directory",
            //     "/ABSOLUTE/PATH/TO/anki-mcp", // Replace with actual path
            //     "run",
            //     "anki-mcp"
            // ]
        }
    }
}

Available MCP Tools

This MCP server provides access to Anki functionality through tools grouped by services. The tool names correspond directly to AnkiConnect actions.

Deck Service (deck.*)

  • deck.deckNamesAndIds: Gets the complete list of deck names and their respective IDs.
  • deck.getDeckConfig: Gets the configuration group object for a given deck name.
  • deck.deckNames: Gets the complete list of deck names for the current user.
  • deck.createDeck: Creates a new empty deck.
  • deck.deleteDecks: Deletes specified decks.
  • deck.changeDeck: Moves cards to a different deck.
  • deck.saveDeckConfig: Saves a deck configuration group.

Note Service (note.*)

  • note.findNotes: Returns note IDs for a given Anki search query.
  • note.notesInfo: Returns information for specified note IDs.
  • note.getNoteTags: Gets the tags for a specific note ID.
  • note.addNote: Creates a new note.
  • note.updateNoteFields: Modifies the fields of an existing note.
  • note.deleteNotes: Deletes specified notes.
  • note.addNotes: Creates multiple notes.
  • note.addTags: Adds tags to specified notes.
  • note.removeTags: Removes tags from specified notes.
  • note.updateNote: Modifies the fields and/or tags of an existing note.

Card Service (card.*)

  • card.findCards: Returns card IDs for a given Anki search query.
  • card.cardsInfo: Returns information for specified card IDs.
  • card.cardsToNotes: Returns note IDs for given card IDs.
  • card.areSuspended: Checks if specified cards are suspended.
  • card.cardsModTime: Returns modification time for specified card IDs.
  • card.suspended: Checks if a single card is suspended.
  • card.suspend: Suspends specified cards.
  • card.unsuspend: Unsuspends specified cards.
  • card.setSpecificValueOfCard: Sets specific values of a single card (use with caution).

Model Service (model.*) (Note Types)

  • model.modelNamesAndIds: Gets the complete list of model (note type) names and their IDs.
  • model.findModelsByName: Gets model definitions for provided model names.
  • model.modelFieldNames: Gets field names for a given model name.
  • model.modelTemplates: Gets template content for each card of a specified model.
  • model.modelStyling: Gets CSS styling for a given model name.
  • model.createModel: Creates a new model (note type).
  • model.updateModelTemplates: Modifies templates of an existing model.
  • model.updateModelStyling: Modifies CSS styling of an existing model.
  • model.modelFieldAdd: Adds a new field to an existing model.
  • model.modelFieldRemove: Removes a field from an existing model.

Media Service (media.*)

  • media.retrieveMediaFile: Retrieves the base64-encoded contents of a media file.
  • media.getMediaFilesNames: Gets names of media files matching a glob pattern.
  • media.storeMediaFile: Stores a media file (from base64, path, or URL).
  • media.deleteMediaFile: Deletes a specified media file.

Development

To set up for development:

uv sync
source .venv/bin/activate

uv pip install -e .

Running Tests

pytest

Todo

  • [ ] Finish adding all AnkiConnect tools

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
anki-mcp