DA

danielpmichalski/anki-cloud

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

20 stars 5 forks 质量 55 趋势 10NOASSERTION

一个完整的Anki Sync Server,包含OAuth2.0、REST API和MCP服务器,具备你最终以理想方式使用Anki所需的一切。

概览

一台以隐私为先的开源Anki同步服务器,配备一流的REST API和MCP服务器,实现无缝的LLM到Anki工作流程。用户甲板数据存储在自己的云存储中(Google Drive、Dropbox 等)——该服务是无状态基础设施,从不存储用户数据。 “Anki”是Ankitects Pty Ltd.的注册商标。本项目与Ankitects无关联或认可。 同步服务器通过 Dockerfile.sync 从本地从 sync-platform-cloud/ 编译。它对 Anki 客户端进行共享 SQLite 数据库认证,并解析每个用户的 Google Drive 后端。需要 Google OAuth 凭证。 运行前,请在你的 OAuth 应用中注册这些回调 URI: (云控制台→ API 和服务 →凭证): (可选 — → 开发者设置→ OAuth 应用中): 在 .env 中设置 TRUSTED_ORIGINS 为你的前端 URL(逗号分隔),这样 Better Auth 才能接受来自网页界面的请求。如果未设置,默认为 FRONTEND_URL。

概述(AI 翻译)

一个以隐私为先的开源Anki同步服务器,配备一流的REST API和MCP服务器, 实现无缝的LLM到Anki工作流程。用户卡组数据存储在独立的云存储中 (Google Drive、Dropbox 等)—— 这种服务是无状态的基础设施,永远不会成立 用户数据。

商标说明:“Anki”是Ankitects Pty Ltd.的注册商标。本项目 与Ankitects无关联或认可。


管理堆栈

同步服务器通过 Dockerfile.sync 从本地编译。 它会对 Anki 客户端进行共享的 SQLite 数据库认证,并解析每个用户的 Google Drive后端。需要Google OAuth凭证。

运行前,请在你的 OAuth 应用中注册这些回调 URI:

** Google**(云控制台→ API 和服务 →凭证):

GitHub(可选 — → OAuth 应用开发者设置→设置):

在.env中设置TRUSTED_ORIGINS为你的前端URL(逗号分隔),这样Better Auth才接受 来自网页界面的请求。如果未设置,默认为FRONTEND_URL。

第一次构建: docker compose up --build 从源代码编译 Rust 同步服务器 (第一次运行时约10–20分钟)。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

anki-cloud

A privacy-first, open-source Anki sync server with a first-class REST API and MCP server, enabling seamless LLM-to-Anki workflows. User deck data lives in their own cloud storage (Google Drive, Dropbox, etc.) — this service is stateless infrastructure that never holds user data.

Trademark note: “Anki” is a registered trademark of Ankitects Pty Ltd. This project is not affiliated with or endorsed by Ankitects.


Running the stack

The sync server is compiled locally from sync-platform-cloud/ via Dockerfile.sync. It authenticates Anki clients against the shared SQLite database and resolves each user’s Google Drive backend. Google OAuth credentials are required.

Before running, register these callback URIs in your OAuth apps:

Google (Cloud Console → APIs & Services → Credentials):

{BETTER_AUTH_URL}/v1/auth/callback/google             # sign-in callback
{FRONTEND_URL}/v1/me/storage/connect/google/callback  # Google Drive callback

GitHub (optional — Settings → Developer settings → OAuth Apps):

{BETTER_AUTH_URL}/v1/auth/callback/github             # sign-in callback

Set TRUSTED_ORIGINS in .env to your frontend URL(s) (comma-separated) so Better Auth accepts requests from the web UI. Defaults to FRONTEND_URL if unset.

cp .env.example .env   # fill in all credentials
docker compose up --build

First build: docker compose up --build compiles the Rust sync server from source (~10–20 min on first run). Subsequent starts are instant once the image is cached.

If you’re actively developing sync-platform-cloud/ or anki-cloud-sync, rebuild only the sync image:

docker compose build anki-sync-server
docker compose up

To develop against a local checkout of anki-cloud-sync (instead of fetching git deps):

docker compose -f docker-compose.yml -f docker-compose.dev.yml up --build

docker-compose.dev.yml overrides anki-sync-server to build directly from ../anki-cloud-sync.


API reference

Once the stack is running, two endpoints are available:

URL Purpose
http://localhost:3000/openapi.json OpenAPI 3.1 spec — import into Postman via Import → Link
http://localhost:3000/docs Scalar interactive UI

All data endpoints (/v1/decks/*, /v1/notes/*, /v1/cards/*) require an API key:

Authorization: Bearer ak_

Generate a key in the web UI under Account → API Keys, or via POST /v1/me/api-keys.

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "anki-cloud": { "command": "bun", "args": [ "run", "/path/to/anki-cloud/mcp/src/index.ts" ], "env": { "API_URL": "http://localhost:3000", "API_KEY": "ak_your_key_here" } } } }