Anki闪卡服务器

一个轻量级的MCP服务器,通过AnkiConnect让Claude直接访问和管理Anki闪卡,支持自然语言交互创建、搜索和管理闪卡。

  • by andrew-roci
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 andrew-roci/anki-mcp-server

使用说明

Anki MCP服务器

一个轻量级的MCP服务器,让Claude(桌面和代码)通过以下方式直接访问您的Anki闪卡 AnkiConnect.

让克劳德制作抽认卡,搜索你的收藏,管理套牌——所有这些都是通过自然对话完成的。

设置

1.安装Anki

下载自 apps.ankiweb.net.

2.安装AnkiConnect插件

在安基: 工具→ 附加组件→ 获取附加组件。.. → 粘贴代码 2055492159 → 重新启动Anki。

安基一定在跑 只要你想让克劳德使用这些工具。

3.粘贴到克劳德

复制下面的块并将其粘贴到Claude(桌面或代码)。它将处理其余的工作——安装依赖关系、克隆仓库和配置MCP服务器。

Set up the anki-mcp-server MCP server for me. Here's what to do:

1. Check if `uv` is installed by running `uv --version`. If not installed, install it:
   - macOS/Linux: `curl -LsSf https://astral.sh/uv/install.sh | sh`
   - Windows: `powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"`

2. Ask me where I'd like to clone the repo (e.g. ~/Development, ~/Projects, ~/.local/share, etc.).
   Then clone it there:
   `git clone https://github.com/andrew-roci/anki-mcp-server.git <chosen-directory>/anki-mcp-server`
   (If the directory already exists, skip this step.)

3. Configure this MCP server:

   For Claude Code — run:
   `claude mcp add -s user anki -- uv --directory ~/Development/anki-mcp-server run anki_mcp_server.py`

   For Claude Desktop — add to the config file
   (macOS: ~/Library/Application Support/Claude/claude_desktop_config.json,
    Windows: %APPDATA%\Claude\claude_desktop_config.json):
   {
     "mcpServers": {
       "anki": {
         "command": "uv",
         "args": ["--directory", "/ABSOLUTE/PATH/TO/anki-mcp-server", "run", "anki_mcp_server.py"]
       }
     }
   }
   Replace /ABSOLUTE/PATH/TO/anki-mcp-server with the actual absolute path to the cloned repo.

4. Verify the setup works by listing my Anki decks.

用法示例

一旦设置好,自然地问克劳德:

  • “制作一张抽认卡:前面‘什么是间隔重复?’后面‘一种以越来越大的间隔复习材料的学习技巧’”
  • “从这篇关于光合作用的文章中制作10张抽认卡”
  • “在我的Anki上搜索标记为‘西班牙语’的卡片”
  • “我有什么甲板?”
  • “将此图添加到我的Anki介质中,并使用它创建一张卡”

运作原理

服务器是一个Python文件(anki_mcp_server.py)即:

  1. 通过显示工具 模型上下文协议
  2. 将工具调用翻译成 AnkiConnect API 请求 localhost:8765
  3. 将结果返回给Claude

依赖关系(mcp, httpx)由以下人员管理 uv 在一个孤立的虚拟环境中,没有任何东西是全局安装的。

许可证

麻省理工学院