AnkiWeb MCP Server
# claude-ankiweb-plugin
An AnkiWeb plugin for Claude (Claude desktop app and Claude Code). It connects directly to `ankiweb.net` and `ankiuser.net` over HTTPS so you can list and manage decks, add or edit flashcards, search notes, and study due cards without running Anki Desktop locally.
## Requirements
- Python 3.11+
- [`uv`](https://docs.astral.sh/uv/getting-started/installation/)
- An [AnkiWeb](https://ankiweb.net/) account
## Installation
### Claude Desktop
In the Claude desktop app, open **Customize → Plugins**:
- Browse the plugin directory for **ankiweb**, or
- Click **Add → Add from a Repository** and enter `jklnr/claude-ankiweb-plugin`.
### Claude Code
```text
/plugin install ankiweb --marketplace jklnr/claude-ankiweb-plugin
```
For local development:
```bash
claude --plugin-dir /path/to/claude-ankiweb-plugin
```
## Authentication
When you use an AnkiWeb tool while signed out, `ankiweb_login` opens a local `127.0.0.1` sign-in form in your browser, authenticates against AnkiWeb, and stores the session cookies in your OS keychain (falling back to `~/.config/claude-ankiweb/session.json` with `0600` permissions).
You can also configure credentials in Claude's plugin settings (`ankiweb_email` and `ankiweb_password`) or via environment variables:
| Variable | Description |
| :--- | :--- |
| `ANKIWEB_EMAIL` | Account email for non-interactive sign-in |
| `ANKIWEB_PASSWORD` | Account password paired with `ANKIWEB_EMAIL` |
| `ANKIWEB_COOKIE` | Raw `ankiweb.net` session cookie string |
| `ANKIUSER_COOKIE` | Raw `ankiuser.net` session cookie string (defaults to `ANKIWEB_COOKIE`) |
| `ANKIWEB_CONFIG_DIR` | Directory for fallback `session.json` (default: `~/.config/claude-ankiweb`) |
| `ANKIWEB_DISABLE_KEYRING` | Set to `1` to use `session.json` instead of the OS keychain |
## Commands and Tools
Slash commands: `/ankiweb:auth`, `/ankiweb:decks`, `/ankiweb:add`, `/ankiweb:study`.
| MCP Tool | Description |
| :--- | :--- |
| `ankiweb_auth_status` | Check whether the current AnkiWeb session is signed in and usable |
| `ankiweb_login` | Open a local `127.0.0.1` browser sign-in form |
| `ankiweb_logout` | Clear saved session cookies from the OS keychain and disk |
| `ankiweb_list_decks` | List decks, card totals, and due counts (`new`, `learning`, `review`) |
| `ankiweb_create_deck` | Create a deck (supports `Parent::Child` subdecks) |
| `ankiweb_rename_deck` | Rename a deck by `deck_id` |
| `ankiweb_remove_deck` | Delete a deck and its cards |
| `ankiweb_list_notetypes` | List note types (`Basic`, `Cloze`, etc.) and field names |
| `ankiweb_add_note` | Add a flashcard note to a deck |
| `ankiweb_add_notes_batch` | Add multiple flashcard notes in one call |
| `ankiweb_search_notes` | Search notes using Anki search syntax (`deck:...`, `tag:...`, `is:due`) |
| `ankiweb_get_note` | Get field values and tags for a `note_id` |
| `ankiweb_update_note` | Update fields or tags on an existing `note_id` |
| `ankiweb_get_study_cards` | Get the current lookahead window of due study cards |
| `ankiweb_answer_card` | Submit a review rating (`again`, `hard`, `good`, `easy`) |
## Privacy & Data Handling
- This plugin runs locally via `uv` and communicates only with `ankiweb.net` and `ankiuser.net` over HTTPS. It uses no third-party servers, analytics, or telemetry.
- Passwords entered in the local `127.0.0.1` sign-in form are sent directly to `ankiweb.net` and discarded; only session cookies and a masked email are stored locally in the OS keychain or `~/.config/claude-ankiweb/session.json`.
- Deck names, card counts, note contents, search queries, and review answers are sent directly between your device and your AnkiWeb account during tool calls. Run `ankiweb_logout` to remove stored session cookies.
## Tests
```bash
uv run pytest -v
```
## Disclaimer
Independent community project; not affiliated with or endorsed by Ankitects Pty Ltd.
## License
[Apache-2.0](LICENSE)
TDQS
Scored across 15 tools
Each tool maps to a distinct resource/action pair: auth (status/login/logout), decks (list/create/rename/remove), notes (add/add_notes_batch/search/get/update), and study (get_study_cards/answer_card). The only near-overlap is add_note vs add_notes_batch, and the descriptions make the single-vs-batch split unambiguous. get_study_cards and answer_card are also clearly delineated by the explicit note that answering returns the next window.
All 15 tools share the ankiweb_ prefix followed by a consistent snake_case verb_noun pattern (list_decks, create_deck, search_notes, answer_card, etc.). The only minor deviation is ankiweb_auth_status being a noun phrase, but it is still readable and predictable within the set.
15 tools is well within the ideal 3-15 range for an AnkiWeb client. Each tool covers a needed operation across auth, deck management, note CRUD, and study review, with no redundant or filler tools.
The surface covers auth, deck lifecycle (list/create/rename/delete), note read/write/search, and study review, but there is no way to delete a note or card, which is a notable gap for collection management. Note types are also read-only (list only), and there is no bulk update/remove path despite the batch add.