Back to MCP directory
publicPublicdnsLocal runtime

anki-mcp-server

Anki-MCP服务器实现,提供卡片复习与创建功能

article

README

🚀 Anki MCP 服务器

Anki MCP 服务器可连接到本地运行的 Anki 实例,借助 MCP(模型上下文协议),为用户提供卡片复习与创建等实用功能。该服务器专为 Anki 桌面应用程序Anki-Connect 插件设计,使用前请确保已安装此插件。

🚀 快速开始

在使用 Anki MCP 服务器前,请先完成以下步骤:

安装依赖项

npm install

构建服务器

npm run build

带自动重建开发

npm run watch

📚 详细文档

🔍 资源

  • anki://search/deckcurrent
    • 返回当前牌组中的所有卡片,相当于 Anki 中的 deck:current
  • anki://search/isdue
    • 返回等待复习的学习卡片,相当于 Anki 中的 is:due
  • anki://search/isnew
    • 返回所有未见卡片,相当于 Anki 中的 is:new

⚙️ 工具

update_cards

  • 功能:标记具有指定卡 ID 的卡片为已回答,并给出 1(再看)到 4(简单)之间的难度评分。
  • 输入:
    • answers (数组):包含 cardId (数字) 和 ease (数字) 字段的对象数组。

add_card

  • 功能:在默认 Anki 置顶创建一张新卡片。
  • 输入:
    • front (字符串):卡片的正面。
    • back (字符串):卡片的背面。

get_due_cards

  • 功能:返回当前待复习的 n 张卡片。
  • 输入:
    • num (数字):卡片数量。

get_new_cards

  • 功能:返回从新卡中获取的 n 张卡片。
  • 输入:
    • num (数字):卡片数量。

⚙️ 配置

要与 Claude Desktop 一起使用,请添加以下配置:

  • 在 MacOS 上:~/Library/Application Support/Claude/claude_desktop_config.json
  • 在 Windows 上:%APPDATA%/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "anki-mcp-server": {
      "command": "/path/to/anki-mcp-server/build/index.js"
    }
  }
}

🐞 调试

由于 MCP 服务器通过 stdio 通信,调试可能具有挑战性。我们建议使用 MCP Inspector,它作为包脚本可用:

npm run inspector

Inspector 将提供一个可在浏览器中访问调试工具的 URL。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client