AA

本页由 AI 翻译,技术细节请以原文为准。 查看原文

7 stars 5 forks 质量 49 趋势 15

MCP server for anki, mostly vibecoded with claude code.

概览

A FastMCP server for interacting with Anki through the Model Context Protocol (MCP). This server provides comprehensive tools for managing Anki decks, notes, and note types, with advanced features including AI-powered audio generation, bulk operations, and semantic similarity search. This project integrates with several external APIs to provide enhanced functionality: - : High-quality audio generation from text using Google's Chirp voices - : Generate pronunciation audio files for flashcards - : HD quality voices with natural pronunciation, especially excellent for Chinese - : Requires GOOGLE_CLOUD_API_KEY environment variable - : Interface with Anki desktop application - : All Anki operations (create/read/update notes, manage decks, etc.) - : Complete Anki functionality via HTTP API - : AnkiConnect add-on must be installed and Anki must be running 2.

README

以下为原文 README 节选,完整内容请查看原文。

Anki MCP Server

A FastMCP server for interacting with Anki through the Model Context Protocol (MCP). This server provides comprehensive tools for managing Anki decks, notes, and note types, with advanced features including AI-powered audio generation, bulk operations, and semantic similarity search.

External APIs Used

This project integrates with several external APIs to provide enhanced functionality:

Google Cloud Text-to-Speech API

  • Purpose: High-quality audio generation from text using Google’s Chirp voices
  • Use Case: Generate pronunciation audio files for flashcards
  • Features: HD quality voices with natural pronunciation, especially excellent for Chinese
  • Setup: Requires GOOGLE_CLOUD_API_KEY environment variable

AnkiConnect API (Local)

  • Purpose: Interface with Anki desktop application
  • Use Case: All Anki operations (create/read/update notes, manage decks, etc.)
  • Features: Complete Anki functionality via HTTP API
  • Setup: AnkiConnect add-on must be installed and Anki must be running

Setup

  1. Install dependencies using uv:

    uv sync
    
  2. Make sure Anki is running with the AnkiConnect add-on installed:

    • In Anki, go to Tools > Add-ons > Get Add-ons
    • Enter code: 2055492159
    • Restart Anki
  3. (Optional) Set up API key for audio generation:

    # For audio generation with Google Cloud TTS
    export GOOGLE_CLOUD_API_KEY='your-google-cloud-api-key-here'
    
  4. Run the server:

    uv run server.py
    

Claude Desktop Integration

To use this MCP server with Claude Desktop, add the following configuration to your claude_desktop_config.json file:

Configuration Location

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Configuration Example

{
  "mcpServers": {
    "anki-mcp": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/your/anki-mcp/",
        "run",
        "server.py"
      ],
      "env": {
        "GOOGLE_CLOUD_API_KEY": "your-google-cloud-api-key-here"
      }
    }
  }
}

Setup Steps

  1. Ensure dependencies are installed: Make sure you’ve run uv sync in your anki-mcp directory
  2. Find your config file at the location above (create it if it doesn’t exist)
  3. Update the path: Replace /path/to/your/anki-mcp/ with the actual path to your anki-mcp directory
  4. Add your API key:
    • Replace your-google-cloud-api-key-here with your actual Google Cloud API key (for audio generation)
  5. Restart Claude Desktop for the changes to take effect

Important Notes

  • Make sure Anki is running with the AnkiConnect add-on before using the tools
  • The uv command will automatically handle the Python environment and dependencies
  • Make sure uv is installed on your system (curl -LsSf https://astral.sh/uv/install.sh | sh)
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "anki-mcp": { "command": "uv", "args": [ "--directory", "/path/to/your/anki-mcp/", "run", "server.py" ], "env": { "GOOGLE_CLOUD_API_KEY": "your-google-cloud-api-key-here" } } } }