anki-mcp

anki-mcp

Enables AI assistants to manage Anki flashcards, decks, note types, tags, and media via AnkiConnect. Supports operations like adding, editing, finding, and syncing cards through a local MCP server.

Category
访问服务器

README

anki-mcp

An MCP server that lets AI assistants (Claude Code, Claude Desktop, and other MCP clients) manage your Anki collection — decks, note types, notes, cards, tags and media — through the AnkiConnect add-on.

It is a thin, local wrapper: each MCP tool maps to one or more AnkiConnect actions over http://127.0.0.1:8765. Nothing leaves your machine and no telemetry is collected — requests are proxied straight to your local Anki.

Unofficial project. Not affiliated with, endorsed by, or sponsored by Anki / AnkiWeb. "Anki" is a trademark of its respective owner. AnkiConnect is a separate third-party add-on. See Prior art for similar tools.

Prerequisites (one-time)

  1. Install Anki Desktop — https://apps.ankiweb.net
  2. Install the AnkiConnect add-on: Anki → Tools → Add-ons → Get Add-ons… → paste code 2055492159 → OK → restart Anki.
  3. Keep Anki Desktop running whenever you use the tools.

AnkiConnect only talks to Anki Desktop. To get cards onto your phone, use the sync tool (or Anki's own sync) and pull them in AnkiDroid via AnkiWeb.

Install

Requires Python 3.10+.

git clone https://github.com/kazim4uk/anki-mcp.git
cd anki-mcp
python -m venv .venv

Install into the venv:

# Windows (PowerShell)
.venv\Scripts\python.exe -m pip install -e .

# macOS / Linux
.venv/bin/python -m pip install -e .

Smoke test (optional, verifies the connection)

With Anki running:

# Windows
.venv\Scripts\python.exe scripts\smoke_test.py
# macOS / Linux
.venv/bin/python scripts/smoke_test.py

Expected: AnkiConnect version: 6 and a list of your decks. With Anki closed you'll get a friendly "cannot reach AnkiConnect" message — that confirms the error handling works.

Register the server

Use the absolute path to the venv's console script (installed as anki-mcp). It works from any working directory.

  • Windows: <repo>\.venv\Scripts\anki-mcp.exe
  • macOS / Linux: <repo>/.venv/bin/anki-mcp

Claude Code

claude mcp add anki -s user -- "/absolute/path/to/anki-mcp/.venv/bin/anki-mcp"

Claude Desktop

Add to your claude_desktop_config.json (%APPDATA%\Claude\ on Windows, ~/Library/Application Support/Claude/ on macOS), then restart Claude Desktop:

{
  "mcpServers": {
    "anki": {
      "command": "/absolute/path/to/anki-mcp/.venv/bin/anki-mcp"
    }
  }
}

On Windows use the .exe and escaped backslashes, e.g. "C:\\path\\to\\anki-mcp\\.venv\\Scripts\\anki-mcp.exe".

Tools

Tool What it does
anki_version Health check — is AnkiConnect reachable?
list_decks List all deck names
create_deck Create a deck (A::B = nested)
delete_deck Delete a deck (optionally keep its cards)
deck_stats Review stats for given decks
list_note_types List note type (model) names
note_type_fields Field names of a note type
add_note Add one note
add_notes Add many notes at once
find_notes Search notes → IDs + field data
update_note_fields Edit fields of an existing note
delete_notes Delete notes (and their cards)
list_tags List all tags
add_tags / remove_tags Tag / untag notes
find_cards Search cards → IDs + card info
suspend_cards / unsuspend_cards Suspend / unsuspend cards
store_media_file Add image/audio to the media folder
cards_reviewed_today Count of today's reviews
sync Sync with AnkiWeb

Search syntax

find_notes / find_cards use Anki's native search syntax, e.g.:

  • deck:Default
  • tag:new -is:suspended
  • deck:"My Deck" front:*hello*

Configuration

Environment variables (see .env.example) — all optional:

Variable Default Purpose
ANKI_CONNECT_URL http://127.0.0.1:8765 AnkiConnect endpoint
ANKI_CONNECT_API_KEY (none) Only if you set an apiKey in the add-on config
ANKI_CONNECT_TIMEOUT 15 Request timeout (seconds)

Troubleshooting

  • "Cannot reach AnkiConnect" — Anki Desktop isn't running, or the add-on isn't installed. Start Anki; verify 2055492159 is under Tools → Add-ons.
  • Tool calls hang / time out — Anki is showing a modal dialog (e.g. a sync prompt). Dismiss it in Anki.
  • duplicate error on add_note — pass allow_duplicate=true, or change a field so the first field is unique.

Prior art

Several other open-source Anki MCP servers exist — worth a look if you want different trade-offs (TypeScript, read-only, extra features): ankimcp/anki-mcp-server, nailuoGG/anki-mcp-server, CamdenClark/anki-mcp-server.

Credits

Built on AnkiConnect and the Model Context Protocol.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选