AnkiWeb MCP
This MCP server lets you manage AnkiWeb cards/decks, study due cards, discover shared decks, and analyze/sync your collection with agent-oriented automation tools.
Create, get, search, and batch-import flashcards; detect duplicate notes/prompts.
List, create, rename, delete, inspect limits for, and triage decks.
Review and grade due flashcards in a study session.
Search/inspect community shared decks and generate topic briefs.
Sync collection data to local SQLite, run read-only SQL, export/import JSONL, and check archive status.
Use context, search, recall, teach, learnings, and playbook tools to help agents discover and remember workflows.
Enables interaction with AnkiWeb/Anki to manage decks and flashcards, add notes with custom notetype fields, batch-import cards from Markdown, review and grade due cards in the terminal, triage deck backlogs, detect duplicate prompts across decks, and search or brief community shared decks.
AnkiWeb CLI (ankiweb)
A terminal-native Go CLI and MCP server for AnkiWeb, built by Sameer Bajaj. Canonical homepage & documentation: sameerbajaj.com/tools/ankiweb-cli.
Every existing Anki tool requires the desktop Anki GUI running with the AnkiConnect add-on bound to a local port. ankiweb talks directly to AnkiWeb's cloud services, enabling fast card creation with custom templates, batch Markdown importing, in-terminal flashcard reviews, deck triage, and community shared deck discovery — from any terminal or headless machine.
⚡ Highlights
Dynamic Custom Card Templates: Add cards to any deck respecting custom notetypes with arbitrary fields (
--field "Additional Info=...",--field "Source=..."), not just basicFrontandBack.Markdown & Note Batch Importer (
card import): Extract flashcards directly from Markdown reading notes, structured Q&A blocks, bullet pairs, and cloze syntax ({{c1::...}}).Interactive Terminal Study (
study): Review and grade due flashcards directly in the CLI with instant keyboard flips and 1–4 ease score recording (Again,Hard,Good,Easy).Deck Backlog Triage (
deck triage): Analyze review backlog debt ratios, detect bottleneck decks, and estimate clearance days across nested deck trees.Cross-Deck Duplicate Detection (
card duplicates): Identify duplicate notes and colliding prompts across multiple decks in your collection.Community Deck Topic Briefing (
shared brief): Surface top-rated community decks using Bayesian approval rate smoothing and audio/image media coverage filters.Offline SQLite & FTS5: Fast local caching with full-text search across your collection.
AI Agent Native (MCP Server): Ships with a built-in Model Context Protocol server (
ankiweb-mcp) and--agentJSON envelopes for autonomous assistants.
Related MCP server: Mousetail
📦 Installation
From Source (Go 1.22+)
# Install the ankiweb CLI
go install github.com/sameerbajaj/ankiweb-cli/cmd/ankiweb@latest
# Optionally install the MCP server
go install github.com/sameerbajaj/ankiweb-cli/cmd/ankiweb-mcp@latestFrom Releases
Download precompiled binaries for macOS, Linux, and Windows from GitHub Releases.
🔐 Authentication
AnkiWeb uses session cookie authentication. You can authenticate in one of two ways:
Environment Variable (Recommended for CI / Headless):
export ANKIWEB_COOKIES="ankiweb=YOUR_SESSION_COOKIE"Interactive Login:
ankiweb auth loginVerify Auth Status:
ankiweb auth status
Note: Public community shared deck searches (ankiweb shared search, ankiweb shared brief) require no authentication.
🚀 Quick Start
1. Check health & environment
ankiweb doctor2. List your decks & due review counts
ankiweb deck list3. Add a flashcard with custom template fields
# Basic card
ankiweb card add --deck "Default" --front "What is Raft?" --back "A distributed consensus algorithm" --tags "cs"
# Custom notetype with arbitrary fields
ankiweb card add \
--deck "Computer Science" \
--notetype "Technical Concept" \
--front "Byzantine Fault Tolerance" \
--back "Safety in presence of arbitrary failing nodes" \
--field "Additional Info=Used in Tendermint and PBFT" \
--field "Source=Castro & Liskov 1999" \
--tags "cs,distributed-systems"4. Batch import flashcards from Markdown
ankiweb card import --file study-notes.md --deck "Medicine"Supported Markdown patterns:
Heading Q&A:
## Questionfollowed by answer paragraphExplicit Q/A:
Q: Question/A: AnswerBullet pairs:
- Front :: BackCloze syntax:
Text with {{c1::cloze deletion}}
5. Review flashcards in your terminal
ankiweb study --deck "Spanish" --limit 206. Triage deck review backlogs & pacing
ankiweb deck triage7. Find duplicate prompts across decks
ankiweb card duplicates8. Discover top-rated community shared decks
# Get a topic briefing with Bayesian approval ratings and audio coverage
ankiweb shared brief "Japanese"
# Search shared decks with media filters
ankiweb shared search "Spanish" --limit 20📖 Command Reference
ankiweb card
add— Add a new note/card with support for custom fields (--field Name=Value)get— Inspect note details and field values by note IDsearch— Search your collection using Anki query syntaxnotetypes— List available notetypes, fields, and decks in your collectionimport— Batch parse and import cards from Markdown files or stdinduplicates— Detect colliding prompts and duplicate notes across decks
ankiweb deck
list— List all decks with new, learn, and review queue countscreate— Create a new deckrename— Rename an existing deckdelete— Delete a decklimits— Inspect daily new and review card study limitstriage— Analyze backlog debt ratios and estimated clearance pacing
ankiweb study
study— Start an interactive or agent-automated review session
ankiweb shared
search— Search public community decks on AnkiWebinfo— View detailed ratings, samples, and reviews for a shared deckbrief— Generate a topic summary comparing highest-rated, freshest, and audio-rich decks
Utility
doctor— Run environment diagnostics and connectivity verificationsync— Sync collection data to local SQLite database for offline fast queriessql— Run raw SQL queries against your local collection storewhich— Natural language command discovery
🤖 Agent & Automation Usage
Every command supports non-interactive execution with structured outputs:
--agent: Enables non-interactive JSON envelopes with execution metadata.--json: Formats output as JSON.--select field1,field2: Projects only specific fields for minimal token usage.--dry-run: Previews the network mutation payload without executing it.
# Dry-run preview of a card creation
ankiweb card add --deck "Default" --front "Hello" --back "World" --dry-run
# Structured agent query
ankiweb deck triage --agentModel Context Protocol (MCP) Setup
Run the bundled MCP server in Claude Desktop, Cursor, or Codex:
{
"mcpServers": {
"ankiweb": {
"command": "ankiweb-mcp",
"env": {
"ANKIWEB_COOKIES": "ankiweb=YOUR_COOKIE"
}
}
}
}👤 Author
Developed by Sameer Bajaj.
📄 License
Licensed under the Apache License, Version 2.0. See LICENSE for details.
Available Tools
37 toolscard_addC
Add or update a note/card in your AnkiWeb collection. Optional: deck, notetype, front (plus 2 more). Returns the new Card.
Inputs: back, deck, tags, front, +1 more.
card_duplicatesCRead-only
Detect duplicate notes and colliding prompts across decks in your collection.
Inputs: csv, yes, deck, json, +19 more.
card_getCRead-only
Get details and field values for a note. Optional: note_id. Returns the new Card.
Inputs: note_id.
card_importCDestructive
Batch import flashcards from Markdown files, Q&A blocks, and cloze notes into any deck.
Inputs: csv, yes, deck, file, +22 more.
card_notetypesBRead-only
List available note types and decks in your collection.
Inputs: no named parameters.
card_searchBRead-only
Search notes in your collection. Optional: query. Returns array of Card.
Inputs: query.
contextARead-only
Get API domain context: resource taxonomy, auth requirements, query tips, and unique capabilities. Call this first.
Inputs: no named parameters.
deck_createB
Create a new deck in your collection. Required: name. Returns the new Deck.
Inputs: name (required).
deck_deleteB
Delete a deck from your collection. Required: deck_id.
Inputs: deck_id (required).
deck_limitsBRead-only
Get daily study and review limits for a deck. Required: deck_id.
Inputs: deck_id (required).
deck_listBRead-only
List all decks with due, learn, and new card counts. Returns array of Deck.
Inputs: no named parameters.
deck_renameB
Rename an existing deck. Required: deck_id, name. Returns the new Deck.
Inputs: name (required), deck_id (required).
deck_triageCRead-only
Analyze review backlog debt ratios, bottleneck decks, and estimated clearance days.
Inputs: csv, yes, json, agent, +18 more.
exportCDestructive
Export data to JSONL or JSON for backup, migration, or analysis
Inputs: resource (required), id, csv, yes, +22 more.
importBDestructive
Import data from JSONL file via API create/upsert calls
Inputs: input (required), resource (required), csv, yes, +21 more.
learnings_candidatesBRead-only
List auto-captured improvement candidates awaiting judgment
Inputs: csv, yes, json, agent, +21 more.
learnings_confirmB
Confirm an open candidate: print its full payload, then materialize it
Inputs: id (required), csv, yes, json, +19 more.
learnings_forgetADestructive
Delete learnings matching a query (use --all to wipe every rule for that query)
Inputs: query (required), all, csv, yes, +22 more.
learnings_listBRead-only
List recorded learnings from the local ankiweb search_learnings table
Inputs: csv, yes, json, agent, +25 more.
learnings_rejectBDestructive
Reject a candidate and tombstone its derivation signature
Inputs: id (required), csv, yes, json, +19 more.
learnings_statsBRead-only
Report learn-loop effectiveness metrics from the local events table
Inputs: csv, yes, json, agent, +18 more.
playbook_amendB
Append a note to an existing playbook (LLM-fired self-correction, silent)
Inputs: csv, yes, json, agent, +20 more.
playbook_listCRead-only
List stored playbooks (query_family, content presence, last observed)
Inputs: csv, yes, json, agent, +18 more.
recallBRead-only
Check prior learnings for a query before running discovery (LLM-fired, pre-discovery)
Inputs: query (required), csv, yes, json, +22 more.
searchARead-only
Full-text search across all synced data. Faster than paginating list endpoints. Requires sync first.
Inputs: query (required), limit.
sqlARead-only
Run read-only SQL against local database. Use for ad-hoc analysis, aggregations, and joins across synced resources. Requires sync first.
Inputs: query (required).
studyCDestructive
Review and grade due flashcards interactively in your terminal with keyboard shortcuts.
Inputs: csv, yes, deck, json, +20 more.
syncCDestructive
Sync API data to local SQLite for offline search and analysis
Inputs: csv, yes, full, json, +29 more.
teachB
Record a query -> resource mapping for future recall (LLM-fired, silent)
Inputs: csv, yes, json, agent, +28 more.
teach_lookupC
Install a manual entity-lookup row (kind, canonical, value)
Inputs: csv, yes, json, kind, +21 more.
teach_patternC
Install a manual generalization pattern (query_template, resource_template, entity_kind)
Inputs: csv, yes, json, agent, +24 more.
teach_playbookC
Record a CLI playbook + free-text notes for a query family
Inputs: csv, yes, json, agent, +23 more.
workflow_archiveCDestructive
Sync all resources to local store for offline access and search
Inputs: csv, yes, full, json, +20 more.
workflow_statusBRead-only
Show local archive status and sync state for all resources
Inputs: csv, yes, json, agent, +18 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 37 tools
Several clusters overlap confusingly: sync vs workflow_archive both mean 'pull resources into local store', while search vs card_search vs sql all do querying with murky boundaries. The teach/teach_lookup/teach_pattern/teach_playbook/recall/learnings_*/playbook_* family is a dense maze of meta-learning tools an agent will struggle to choose between. Core deck_* and card_* tools are distinguishable, but the descriptions alone don't fully resolve the overlaps.
The dominant pattern is resource_action (deck_list, card_search, shared_info, learnings_confirm, workflow_status), which is applied consistently across most families. A handful of bare verbs (sync, search, sql, study, teach, import, export) break the pattern, but they read clearly and map to obvious single-purpose actions.
At 37 tools the surface is oversized for an Anki client, and a large fraction is internal agent-harness machinery (teach_*, learnings_*, playbook_*, recall) rather than Anki domain operations. A user/agent scanning this set must sift through many niche meta-tools to reach the core deck/card operations.
Deck lifecycle is well covered (create, list, limits, rename, delete, triage) and cards support add/update, get, search, import, and duplicate detection. However, there is no explicit card/note delete, no media handling, no programmatic review/scheduling control beyond the interactive study tool, and shared decks can be searched/viewed but not downloaded or imported — leaving real dead ends.
Maintenance
Related MCP Connectors
Remote MCP server for saving, searching, syncing, and managing Teak cards.
Remote MCP server for notes, tasks, kanban boards and docs - the Slates agentic workspace
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceSelf-hosted MCP server connecting AI assistants like Claude to Anki for AI-assisted flashcard generation and sync. It supports multi-tenant, authenticated operations to add, search, and analyze cards in real Anki collections.AGPL 3.0
- AlicenseAqualityDmaintenanceThe simplest and most stable MCP server for Anki, enabling LLMs to perform core Anki operations (CRUD) directly without addons.1317MIT
- AlicenseAqualityCmaintenanceMCP stdio server for controlling local Anki via AnkiConnect. Enables LLMs to manage Anki decks and notes through a standardized tool interface.116 npmMIT
- AlicenseAqualityDmaintenanceMCP server for Anki via AnkiConnect, enabling creation, search, and management of flashcards directly from Claude Code or any MCP client.11MIT