Skip to main content
Glama

srs-mcp

与代理无关的 MCP 服务器,用于间隔重复学习——**无需 Anki GUI、无需 Xvfb、无需 AnkiConnect。**自带代理;它提供卡片盒 + 调度器。

它将 FSRS(Free Spaced Repetition Scheduler,现代 Anki 使用的同款算法)封装在一个小巧的 SQLite 存储之上,因此代理可以创建卡片、查看到期卡片并记录回忆情况——完全无头运行。

为什么不用无头 Anki?

无头驱动 Anki 桌面应用意味着需要 Qt + 虚拟帧缓冲(Xvfb)+ AnkiConnect 插件——既脆弱又和版本强耦合。如果你需要与手机上的 Anki 互通,anki PyPI 包可以在无 GUI 的情况下驱动真实的 .anki2 集合。但如果你只是想要 API 背后的间隔重复,你根本不需要 Anki:FSRS 是一个库,而这个服务器只是围绕它的约 200 行代码。

Related MCP server: Memory MCP Server

工具

  • add_card(front, back) -> {card_id, due} — 创建并调度一张卡片。保持 back 简短——一个词或一个短语;无法在几秒内评分的卡片是笔记,而不是闪卡

  • due_cards(q=None, limit=20) -> [{card_id, front, back, deck, due}] — 当前到期的卡片,可选地按主题缩小范围(q="horace")

  • grade_card(card_id, rating) -> {card_id, rating, next_due, reps} — 记录回忆情况(again/hard/good/easy,或 1-4)

  • edit_card(card_id, front=None, back=None) — 就地编辑内容;调度保持不变(修正拼写错误/缩短冗长答案,而不是重复创建)

  • suspend_card(card_id) / unsuspend_card(card_id) — 搁置一张卡片(保留其历史,从到期队列中移除)/ 恢复它

  • list_cards(q=None, limit=50) — 无论到期日期如何,概览所有卡片

  • delete_card(card_id) — 删除一张(重置/清理)

  • stats(deck=None) -> {total, due_now, suspended, reviews, decks}

查找卡片:搜索,而非牌组

卡片通过搜索其文本来查找——due_cards(q="horace")——而不是预先将它们归档到牌组中。不再有任何东西写入 deck 字段;把主题写进卡片本身("Horace, Odes 1.11: …"),它就能保持可被找到。

牌组是单值、自由文本、精确匹配的标签,没有附加任何按牌组的调度,所以它们没有带来搜索做不到的事情,反而牺牲了准确性:在用于衡量的牌组上,代理们发明了十个 Horace 的名称,跨越五种分隔符约定,因此最好的 deck="Horace" 只能从 97 张 Horace 卡片中返回 20 张,而 q="horac" 返回 89 张——包括那些被错误归档到 Talks 下的。due_cards/list_cards/stats 上的列和 deck= 过滤器保留给旧版本标记的卡片。参见 plans/002-decks.md。

复习循环:due_cards → 用 front 考问用户 → 对照 back 检查 → grade_card。FSRS 根据评分计算下一个到期日期。

运行

uv sync
# HTTP (default; for Railway / remote agents)
PORT=8000 uv run srs-mcp
# or stdio (local agent)
MCP_TRANSPORT=stdio uv run srs-mcp

存储

两种后端,启动时选择:

  • Postgres(共享牌组) — 将 SRS_DATABASE_URL(或 DATABASE_URL)设置为 Postgres 连接字符串(例如 Neon DB)。指向同一 URL 的每个部署都读写一个共享牌组,因此你可以从任何地方(本地、Railway 等)添加和复习卡片。FSRS 卡片 ID 很大,所以 Postgres 上的 cards.card_id 列是 BIGINT。需要 psycopg 依赖(已声明)。

  • SQLite(回退) — 当未设置 *DATABASE_URL 时,卡片存放在 SRS_DB 指定的 SQLite 文件中(默认 ./srs.db)。单主机/离线。在 SQLite-on-Railway 设置中,在 /data 挂载一个卷并保持 SRS_DB=/data/srs.db,这样卡片盒就能在重新部署后存活。

模式完全相同(表 cards),并在首次使用时自动创建。

Available Tools

9 tools
add_cardA

Author a new flashcard and schedule it. front is the prompt/question, back is the answer. Optional deck groups cards (default 'default'). Returns JSON {card_id, due}. The card is due immediately (first review).

Inputs: back (required), front (required), deck. Returns: result

delete_cardC

Delete a card by id (reset / cleanup).

Inputs: card_id (required). Returns: result

due_cardsA

List cards due for review now (due <= now), soonest first. Optionally filter by deck. Returns a JSON array of {card_id, front, back, deck, due}. Quiz the user with front, check against back, then call grade_card. Returns '[]' when nothing is due.

Inputs: deck, limit. Returns: result

edit_cardA

Edit a card's content without disturbing its schedule. Update any of front, back, deck (omit or pass null to leave unchanged); the FSRS review state (difficulty, stability, due date, reps) is preserved. Use this to fix typos or add context instead of creating a duplicate card. Returns JSON {card_id, front, back, deck}.

Inputs: card_id (required), back, deck, front. Returns: result

grade_cardA

Record a review of a card. rating is how well it was recalled: 'again' (forgot), 'hard', 'good', or 'easy' (1-4 also accepted). FSRS updates the schedule; returns JSON {card_id, rating, next_due, reps}.

Inputs: rating (required), card_id (required). Returns: result

list_cardsA

List cards (newest first) regardless of due date, for an overview. Optionally filter by deck. Returns JSON array of {card_id, front, back, deck, due, reps, suspended}.

Inputs: deck, limit. Returns: result

statsA

Summary of the card box: total cards, how many are due now, total reviews, and the deck list. Optionally scope counts to one deck.

Inputs: deck. Returns: result

suspend_cardA

Shelve a card: keep it (with its full history and schedule) but remove it from the due queue, so it won't surface in due_cards until unsuspended. Reversible, non-destructive alternative to delete_card for cards you're unsure about. Returns JSON {card_id, suspended}.

Inputs: card_id (required). Returns: result

unsuspend_cardA

Un-shelve a previously suspended card, returning it to the review queue (it becomes due again per its existing schedule). Returns JSON {card_id, suspended}.

Inputs: card_id (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

    TDQS

    A4/5.0

    Scored across 9 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: adding, deleting, editing, listing, reviewing, grading, stats, suspending, and unsuspending cards. No two tools overlap in functionality.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern in snake_case, e.g., add_card, delete_card, grade_card. Names are predictable and readable.

    Tool Count5/5

    9 tools is well-scoped for a spaced repetition system, covering all essential operations without bloat. Each tool earns its place.

    Completeness4/5

    Covers core CRUD, review workflow, statistics, and suspension. Missing explicit deck management (e.g., create/delete deck) but decks are manageable via card properties.

    Maintenance

    ActivityStale
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to store, search, and manage persistent memories, todos, kanban boards, reminders, and progress trackers in a local SQLite database.
      1
      Apache 2.0
    • A
      license
      A
      quality
      C
      maintenance
      Provides spaced-repetition scheduling with the SM-2 algorithm as MCP tools, enabling agents to manage review items like flashcards or vocab locally. It supports adding, grading, and listing due items, plus optional pro features for export and forecast.
      6
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI clients to create spaced-repetition flashcards from material being learned, quiz users aloud, grade answers, and schedule reviews using the FSRS algorithm through a self-hosted MCP server.
      7
      AGPL 3.0