Anki MCP Server

Anki MCP Server

Mirror of

MCP-Mirror

研究与数据
访问服务器

README

Anki MCP Server

An MCP (Model Context Protocol) server for Claude Desktop that connects to Anki via AnkiConnect and retrieves leech-tagged cards.

Features

  • Connects to Anki via AnkiConnect API
  • Retrieves cards with "leech" tags
  • Adds date-stamped review tags to cards
  • Provides comprehensive card data for analysis by Claude
  • Can be used with Claude Desktop

Prerequisites

  • Anki installed and running
  • AnkiConnect add-on installed in Anki
  • Node.js and npm

Installation

  1. Clone this repository:

    git clone https://github.com/yourusername/anki-mcp-server.git
    cd anki-mcp-server
    
  2. Install dependencies:

    npm install
    
  3. Build the project:

    npm run build
    

Configuration

The server can be configured using environment variables. Copy the provided example file to create your own configuration:

cp .env.example .env

Then edit the .env file to customize your settings:

Environment Variable Description Default Value
ANKI_CONNECT_URL The URL of the Anki Connect API http://localhost:8765
ANKI_CONNECT_VERSION The version of the Anki Connect API to use 6
ANKI_MOCK_MODE Enable mock mode for testing (true/false) false

If the environment variables are not set, the server will use the default values.

Finding Your Local IP Address for AnkiConnect

If connecting to localhost doesn't work, you'll need to use your computer's local IP address instead. Configure your .env file with:

ANKI_CONNECT_URL=http://YOUR_LOCAL_IP:8765

To find your local IP address:

  • macOS: Open Terminal and run ifconfig or ipconfig getifaddr en0 (for WiFi)
  • Windows: Open Command Prompt and run ipconfig
  • Linux: Open Terminal and run ip addr show or hostname -I

Look for IPv4 addresses like 192.168.x.x or 10.x.x.x in the output.

Test Configuration

For testing, a separate configuration file .env.test is provided:

cp .env.example .env.test

Edit .env.test to set test-specific values:

ANKI_CONNECT_URL=http://localhost:8765
ANKI_CONNECT_VERSION=6
ANKI_MOCK_MODE=true

To run in test mode:

npm run start:test

Usage

  1. Make sure Anki is running with AnkiConnect installed
  2. Run the MCP server:
    npm start
    

Configuring Claude Desktop

To use this MCP server with Claude Desktop:

  1. Open Claude Desktop

  2. Edit the Claude Desktop configuration file located at:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
    • Linux: ~/.config/Claude/claude_desktop_config.json
  3. Add the following configuration to the mcpServers section:

{
  "mcpServers": {
    "anki": {
      "command": "node",
      "args": ["path/to/anki-mcp-server/dist/index.js"]
    }
  }
}

Replace "path/to/anki-mcp-server" with the actual path to where you cloned this repository.

MCP Tool Usage

Once configured, you can use the following tools in Claude:

Example Usage

Could you analyze my Anki leech cards and suggest ways to improve my study?

Claude will use the MCP server to retrieve your leech cards and analyze them.

Available Tools

get_leech_cards

Retrieves cards tagged as leeches from Anki.

Parameters:

  • detailed (optional, boolean, default: true): Whether to return comprehensive card data or just IDs
  • count (optional, number): Number of random cards to return (defaults to all cards)

tag_reviewed_cards

Adds a date-stamped "reviewed" tag to specified cards. This allows you to track which cards you've reviewed with Claude.

Parameters:

  • card_ids (required, array of numbers): Array of card IDs to tag as reviewed
  • custom_tag_prefix (optional, string, default: "見直し"): Custom prefix for the tag

The tag will be in the format 見直し::YYYYMMDD (or your custom prefix if specified).

Example usage in Claude:

I've reviewed these cards, please tag them as reviewed: [1234567890, 1234567891]

Troubleshooting

  • "Could not connect to Anki" - Make sure Anki is running and AnkiConnect is properly installed
  • "No leech cards found" - You don't have any cards tagged as "leech" in Anki
  • Connection issues with localhost - If you're unable to connect using localhost:
    1. Find your local IP address as described in the Configuration section
    2. Update your .env file to use ANKI_CONNECT_URL=http://YOUR_LOCAL_IP:8765
    3. Make sure AnkiConnect is configured to allow connections from your IP address
    4. Restart the MCP server after making these changes
  • Tag not appearing - Make sure you're providing valid card IDs to the tag_reviewed_cards tool

Testing Mode

For testing without affecting actual Anki data, you can use the mock mode:

  1. Set ANKI_MOCK_MODE=true in your .env file or use the provided .env.test file
  2. Run the server with npm run start:test

In mock mode, the server will simulate all Anki operations without actually connecting to Anki. This is useful for testing Claude integrations without risking data changes.

Development

To run the server in development mode with hot reloading:

npm run dev

For development with mock mode enabled:

npm run dev:test

License

MIT

推荐服务器

Crypto Price & Market Analysis MCP Server

Crypto Price & Market Analysis MCP Server

一个模型上下文协议 (MCP) 服务器,它使用 CoinCap API 提供全面的加密货币分析。该服务器通过一个易于使用的界面提供实时价格数据、市场分析和历史趋势。 (Alternative, slightly more formal and technical translation): 一个模型上下文协议 (MCP) 服务器,利用 CoinCap API 提供全面的加密货币分析服务。该服务器通过用户友好的界面,提供实时价格数据、市场分析以及历史趋势数据。

精选
TypeScript
MCP PubMed Search

MCP PubMed Search

用于搜索 PubMed 的服务器(PubMed 是一个免费的在线数据库,用户可以在其中搜索生物医学和生命科学文献)。 我是在 MCP 发布当天创建的,但当时正在度假。 我看到有人在您的数据库中发布了类似的服务器,但还是决定发布我的。

精选
Python
mixpanel

mixpanel

连接到您的 Mixpanel 数据。从 Mixpanel 分析查询事件、留存和漏斗数据。

精选
TypeScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

这个服务器通过将复杂问题分解为顺序步骤来促进结构化的问题解决,支持修订,并通过完整的 MCP 集成来实现多条解决方案路径。

精选
Python
Nefino MCP Server

Nefino MCP Server

为大型语言模型提供访问德国可再生能源项目新闻和信息的能力,允许按地点、主题(太阳能、风能、氢能)和日期范围进行筛选。

官方
Python
Vectorize

Vectorize

将 MCP 服务器向量化以实现高级检索、私有深度研究、Anything-to-Markdown 文件提取和文本分块。

官方
JavaScript
kb-mcp-server

kb-mcp-server

一个 MCP 服务器,旨在实现便携性、本地化、简易性和便利性,以支持对 txtai “all in one” 嵌入数据库进行基于语义/图的检索。任何 tar.gz 格式的 txtai 嵌入数据库都可以被加载。

本地
Python
Research MCP Server

Research MCP Server

这个服务器用作 MCP 服务器,与 Notion 交互以检索和创建调查数据,并与 Claude Desktop Client 集成以进行和审查调查。

本地
Python
Cryo MCP Server

Cryo MCP Server

一个API服务器,实现了模型补全协议(MCP),用于Cryo区块链数据提取。它允许用户通过任何兼容MCP的客户端查询以太坊区块链数据。

本地
Python
Substack Reader

Substack Reader

允许从 Adam Mancini 在 Substack 上的 Trade Companion 获取和阅读仅限订阅者内容,使 Claude 能够访问和讨论最新的金融交易文章。

本地
Python