MCP HubMCP Hub
CamdenClark

anki-mcp-server

by: CamdenClark

A model context protocol server that connects to Anki through AnkiConnect

37created 02/12/2024
Visit
AnkiConnect
protocol

📌Overview

Purpose: To enable integration with Anki through the AnkiConnect plugin, facilitating enhanced interactions with Anki's note-taking and flashcard functionalities.

Overview: The Anki MCP Server is a TypeScript-based framework that integrates with Anki, leveraging the AnkiConnect API to manage decks and notes effectively. It illustrates core MCP (Model Context Protocol) principles by providing resources and tools for seamless interaction with Anki's data structure.

Key Features:

  • Resources: Integrate with Anki decks and note models by accessing them via specific URIs, allowing for structured JSON representations of various Anki objects.

  • Tools: A set of functionalities to interact with Anki, including:

    • listDecks: Retrieve names of all available decks.
    • listModels: Obtain names of all note models.
    • getModel: Access detailed information about a specified note model.
    • addNote: Create a single note while specifying necessary parameters like deck name and fields.
    • addNotes: Efficiently add multiple notes in bulk to streamline content creation.

anki-mcp MCP Server

A TypeScript-based MCP server that integrates with Anki via the AnkiConnect plugin. It demonstrates core MCP concepts by providing:

  • Resources representing Anki decks and note models with URIs
  • Tools for creating and managing Anki notes
  • Integration with AnkiConnect API

Features

Resources

  • List and access Anki decks via anki://decks/{id} URIs
  • List and access note models via anki://models/{id} URIs
  • JSON representation of Anki objects

Tools

  • listDecks - Get names of all decks
  • listModels - Get names of all note models
  • getModel - Get details of a specific note model
  • addNote - Create a single note
    • Specify deck name, model name, fields, and tags
  • addNotes - Create multiple notes in bulk
    • Create many notes with specified parameters

Development

Install dependencies:

npm install

Build the server:

npm run build

For development with auto-rebuild:

npm run watch

Installation

To use with Claude Desktop, add the server config:

  • On MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • On Windows: %APPDATA%/Claude/claude_desktop_config.json

Example configuration:

{
  "mcpServers": {
    "anki-mcp": {
      "command": "node",
      "args": ["d:\\anki-mcp-server\\build\\index.js"]
    }
  }
}

Debugging

Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the MCP Inspector, which is available as a package script:

npm run inspector

The Inspector will provide a URL to access debugging tools in your browser.