@lifeng688/anki-mcp

@lifeng688/anki-mcp

MCP stdio server for controlling local Anki via AnkiConnect. Enables LLMs to manage Anki decks and notes through a standardized tool interface.

Category
访问服务器

README

@lifeng688/anki-mcp

MCP stdio server for controlling local Anki via AnkiConnect. Enables LLMs (Claude, Cursor, Cline) to manage Anki decks and notes through a standardized tool interface.

v0.1.0 — Initial MVP release. Safety-first, read-heavy toolset with dryRun support for writes.

Quick Install

npm install @lifeng688/anki-mcp

Or try it instantly:

npx @lifeng688/anki-mcp

Prerequisites

  1. Anki desktop installed
  2. AnkiConnect add-on (code 2055492159) — install via Tools → Add-ons → Get Add-ons
  3. Node.js >= 18.0.0

Verify AnkiConnect is running:

curl -X POST http://127.0.0.1:8765 \
  -H "Content-Type: application/json" \
  -d '{"action":"version","version":6}'
# Expected: {"result":6,"error":null}

Core Features

  • Deck management — List and create decks (including hierarchical :: decks)
  • Note operations — Add, search, update, and inspect notes
  • Batch operations — Add multiple notes with per-item result tracking
  • Safety firstdryRun support for batch writes, duplicate prevention, field validation
  • Unified responses — Consistent success/error envelope across all tools
  • Security-focused — Localhost only, no DB access, no card content logging

Available Tools

Tool Description Side Effects
ping Server health check None
check_anki_connection Verify AnkiConnect reachable None
list_decks List all decks None
create_deck Create a new deck Creates deck
list_note_models List note models None
get_note_model_fields Get model fields None
add_note Add single note Creates note
add_notes Batch add notes Creates notes
search_notes Search notes None
get_notes_info Get note details None
update_note_fields Update note fields Modifies note

See Tool Schema Reference for full input/output specs.

MCP Client Configuration

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "anki": {
      "command": "node",
      "args": ["$(npm root)/@lifeng688/anki-mcp/dist/index.js"]
    }
  }
}

With environment variables:

{
  "mcpServers": {
    "anki": {
      "command": "node",
      "args": ["$(npm root)/@lifeng688/anki-mcp/dist/index.js"],
      "env": {
        "ANKI_CONNECT_URL": "http://127.0.0.1:8765",
        "ANKI_CONNECT_VERSION": "6",
        "ANKI_DEFAULT_DECK": "Default::MCP",
        "ANKI_DEFAULT_MODEL": "Basic",
        "ANKI_LOG_LEVEL": "warn"
      }
    }
  }
}

Note: Replace $(npm root)/@lifeng688/anki-mcp/dist/index.js with the actual resolved path. You can find it with:

npm root -g
# or
npm root

Cursor / Cline

Same JSON format — add to your MCP server configuration. Point args to the installed dist/index.js inside the @lifeng688/anki-mcp package directory.

Global Install

npm install -g @lifeng688/anki-mcp

Then configure your client to point to:

<global-npm-root>/@lifeng688/anki-mcp/dist/index.js

Environment Variables

Variable Default Description
ANKI_CONNECT_URL (none) Full AnkiConnect HTTP endpoint (highest priority). Overrides HOST:PORT.
ANKI_CONNECT_HOST 127.0.0.1 Host part, used when ANKI_CONNECT_URL is not set.
ANKI_CONNECT_PORT 8765 Port part, used when ANKI_CONNECT_URL is not set.
ANKI_CONNECT_VERSION 6 AnkiConnect API version
ANKI_CONNECT_KEY (empty) AnkiConnect API key (if configured)
ANKI_DEFAULT_DECK Default Default deck for note operations
ANKI_DEFAULT_MODEL Basic Default note model
ANKI_REQUEST_TIMEOUT_MS 10000 HTTP request timeout in milliseconds
ANKI_LOG_LEVEL info Log verbosity: error / warn / info / debug

URL Resolution Priority:

  1. ANKI_CONNECT_URL — if set, used as-is (must point to localhost)
  2. ANKI_CONNECT_HOST + ANKI_CONNECT_PORT — composed as http://{HOST}:{PORT}
  3. http://127.0.0.1:8765 — hardcoded default

Security

  • This server only connects to http://127.0.0.1:8765 (localhost)
  • It does not read/write Anki SQLite databases directly
  • It does not upload any data externally
  • ANKI_CONNECT_KEY is never logged
  • Dangerous operations (delete, sync, import, export) are not in v0.1.0

First-Time Setup

  1. Create a Test::MCP deck before making real changes
  2. Run ping and check_anki_connection to verify connectivity
  3. Use add_notes with dryRun: true to preview before writing
  4. Never expose port 8765 to the network

Documentation

License

MIT — See LICENSE for details.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选