Skip to main content
Glama
fabianissam

AnkiConnect MCP Server

by fabianissam
README.md
# AnkiConnect MCP Server

Python MCP server for [AnkiConnect](https://git.sr.ht/~foosoft/anki-connect). **Deck review assistant:** walk through a deck card by card, spot gaps (verb forms, declension), fix with approval.

## Prerequisites

- Anki 2.1.x running in the background
- [AnkiConnect](https://git.sr.ht/~foosoft/anki-connect) add-on (install code: `2055492159`)
- Python 3.11+

Verify AnkiConnect: open [http://127.0.0.1:8765](http://127.0.0.1:8765) — you should see `AnkiConnect`.

## Installation

```bash
cd AnkiConnectMCP
python -m pip install -e .
```

## Cursor MCP configuration

In [`.cursor/mcp.json`](.cursor/mcp.json) (or Cursor Settings → MCP):

```json
{
  "mcpServers": {
    "anki-connect": {
      "command": "python",
      "args": ["-m", "anki_connect_mcp.server"],
      "cwd": "C:/Users/Fabian/Desktop/Projekte/AnkiConnectMCP",
      "env": {
        "PYTHONPATH": "src",
        "ANKI_CONNECT_URL": "http://127.0.0.1:8765"
      }
    }
  }
}
```

Reload the MCP server after code changes.

## How it works

Typical session — **no JSON, just chat**:

```
Du:  „Geh mein Italienisch-Deck durch — Verben sollen alle Formen auf einer Karte haben“

KI:  list_deck_cards(deck_name="Italienisch", offset=0)
     → #1–#15 mit Front/Back

     Chat-Analyse:
     #3  mangiare — Partizip fehlt
     #7  il libro — nicht dekliniert
     Soll ich #3 anpassen?

Du:  „ja, Partizip mangiato“

KI:  BEFORE/AFTER im Chat + edit_card(note_id=…, back="…")

Du:  „weiter“ / „nächster Block“ / „#7 auch“
```

New chat message while Run is pending = revision, not blind apply.

## Tools

| Tool | Description |
|------|-------------|
| `list_decks` | Deck names |
| `list_deck_cards` | **Numbered page of cards** for systematic review |
| `get_card` | One card in detail |
| `search_cards` | Targeted search (verbs, tags, text) |
| `edit_card` | Apply one approved edit |
| `add_card` | Add one new card |

## Security

- Read tools never modify Anki.
- Writes only after Cursor Run approval.
- No delete tools. Optional `ALLOWED_DECKS` allowlist.
- One tool at a time (server lock).

## License

MIT

TDQS

A4.2/5.0

Scored across 6 tools

Disambiguation4/5

Most tools have clearly distinct purposes: listing decks, listing cards in a deck, fetching one card, adding, searching, and editing. list_deck_cards and search_cards overlap somewhat as card-retrieval operations, but their descriptions explicitly separate systematic review from targeted lookup.

Naming Consistency5/5

All tool names follow a consistent lower_snake_case verb_noun pattern: list_decks, list_deck_cards, get_card, add_card, search_cards, edit_card. The naming is predictable and easy to navigate.

Tool Count5/5

Six tools is a well-scoped set for an Anki card and deck workflow. Each tool covers a distinct functional action without unnecessary redundancy and the count feels appropriate for the server's purpose.

Completeness4/5

The server covers core card lifecycle operations well: listing decks, viewing cards, adding cards, searching, and editing cards. The main gap is the lack of a delete_card tool, and there is minimal deck-management coverage beyond listing, but the primary review-oriented workflow is well supported.

Maintenance

ActivityMaintained
ResponsivenessNo issues