
本页由 AI 翻译,技术细节请以原文为准。 查看原文
ankimcp/anki-mcp-server-addon 是从 https://github.com/ankimcp/anki-mcp-server-addon. 导入的 MCP 服务器候选
概览
ankimcp/anki-mcp-server-addon 是从 https://github.com/ankimcp/anki-mcp-server-addon. 导入的 MCP 服务器候选
概述(AI 翻译)
通过模型上下文协议,将Anki与AI助手无缝集成
这是一个通过模型上下文协议(MCP)向AI助手展示你的收藏的Anki插件。
这是什么?
AnkiMCP 服务器在 Anki 内部运行本地 MCP 服务器,允许像 Claude 这样的 AI 助手与你的抽认卡收藏互动。这支持了 AI 驱动的学习会话、卡片创建和管理。
这是 ankimcp.ai 项目的一部分。
首次运行时的备注
首次运行时,该插件从 PyPI 下载 pydantic_core(~2MB)。这是必须的,因为pydantic_core包含平台特定的二进制文件(Windows/macOS/Linux),无法捆绑在单个插件文件中。
第二个原生依赖 rpds(来自 rpds-py)处理方式相同——但它几乎从不被下载:Anki 已经将 rpds 作为其自身 jsonschema 的传递依赖发布,所以插件只是导入它。下载只有在极少数导入失败的安装时才会启动。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
AnkiMCP Server (Addon)
An Anki addon that exposes your collection to AI assistants via the Model Context Protocol (MCP).
What is this?
AnkiMCP Server runs a local MCP server inside Anki, allowing AI assistants like Claude to interact with your flashcard collection. This enables AI-powered study sessions, card creation, and collection management.
Part of the ankimcp.ai project.
Note on First Run
On first run, this addon downloads pydantic_core (~2MB) from PyPI. This is required because pydantic_core contains platform-specific binaries (Windows/macOS/Linux) that cannot be bundled in a single addon file.
A second native dependency, rpds (from rpds-py), is handled the same way — but it is almost never downloaded: Anki already ships rpds as a transitive dependency of its own jsonschema, so the addon just imports it. The download only kicks in on the rare install where that import fails. Both downloads are cached under Anki’s own data folder (outside the addon’s own folder, so it survives addon updates cleanly on every OS), falling back to the addon’s _cache/ directory when that location isn’t available — so either way they happen once, not on every launch. The old in-folder fallback cache is only ever removed once the outside-the-folder cache has proven itself usable (a successful load from it) and is never touched while a native module is still loaded from it — a failed first attempt (e.g. offline) leaves the old cache untouched rather than destroyed.
Features
- Local HTTP server - Runs on
http://127.0.0.1:3141/by default - Remote tunnel - Access your collection from anywhere via a public HTTPS URL
- MCP protocol - Compatible with any MCP client (Claude Desktop, etc.)
- Auto-start - HTTP server starts automatically when Anki opens
- Tunnel-friendly - Works with Cloudflare Tunnel, ngrok, or the built-in tunnel (exposing the HTTP server this way also requires extending the allowed hosts/origins)
- DNS-rebinding protection - The HTTP server validates
Host/Originheaders against a loopback allowlist by default; extend it for tunnel/reverse-proxy exposure - Optional API key - Require an
Authorization: Bearertoken on the HTTP transport viahttp_api_key(AnkiConnect-style; empty = disabled) - Toolbar indicator - A
● AnkiMCPitem in the top toolbar shows tunnel connection state at a glance (opt out viashow_toolbar_indicator)
安装
npx mcp-remote http://127.0.0.1:3141配置
{
"mcpServers": {
"anki": {
"command": "npx",
"args": ["mcp-remote", "http://127.0.0.1:3141"]
}
}
}