You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+26-1Lines changed: 26 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -229,7 +229,32 @@ All `print()` statements and `logging` output appears in the terminal.
229
229
-[MCP Protocol](https://modelcontextprotocol.io/) - Model Context Protocol specification
230
230
-[FastMCP](https://github.com/jlowin/fastmcp) - MCP SDK used by this addon
231
231
232
-
## Common Issues
232
+
## Known Gotchas
233
+
234
+
### Imports Must Be Relative
235
+
236
+
All imports in this addon use **relative imports** (e.g., `from ....tool_decorator import Tool`). This is the Anki addon ecosystem standard — AnkiConnect does this too. Absolute imports (`from anki_mcp_server.config import ...`) break AnkiWeb installs because AnkiWeb uses the addon ID (`124672614/`) as the directory name, not the package name.
237
+
238
+
### Anki Scheduler API Pitfalls
239
+
240
+
-`col.sched.deck_due_tree()` — correct way to get deck stats (AnkiConnect pattern). Tree nodes have: `deck_id`, `name`, `new_count`, `learn_count`, `review_count`, `total_in_deck` (Anki 2.1.46+)
241
+
-`col.sched.counts()` — returns (new, learning, review) for the **currently selected** deck
242
+
-`col.sched.counts_for_deck_today()` — does **NOT** work in modern Anki, silently returns wrong values
243
+
- Raw SQL (`col.db`) is acceptable for analytics/stats (revlog, card stats) — AnkiConnect does this too. For deck stats, always prefer `deck_due_tree()` over SQL.
244
+
245
+
### Python Version Compatibility
246
+
247
+
- MCP Python SDK requires Python >= 3.10 (uses `match`/`case`, `X | Y` syntax) — hard blocker, no workaround
248
+
- Anki 25.02 and earlier: Python 3.9 (**not supported**)
249
+
- Anki 25.07+: Python 3.13 (supported)
250
+
- No Anki version ships Python 3.10/3.11/3.12 — went directly from 3.9 → 3.13
251
+
-`__init__.py` has an early version check that raises `ImportError` with a clear message on Python < 3.10
252
+
253
+
### Install Methods
254
+
255
+
Always test both install methods when making changes:
256
+
-`.ankiaddon` file (double-click or *Tools → Add-ons → Install from file...*)
257
+
- AnkiWeb code (`124672614`) — directory name is the addon ID, not the package name
Copy file name to clipboardExpand all lines: README.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -138,7 +138,8 @@ These tools interact with Anki's user interface:
138
138
139
139
## Requirements
140
140
141
-
- Anki 25.x or later (Python 3.13)
141
+
-**Anki 25.07 or later** (ships Python 3.13)
142
+
- Anki 25.02 and earlier ship Python 3.9, which is **not supported** — the MCP SDK requires Python 3.10+ ([#8](https://github.com/ankimcp/anki-mcp-server-addon/issues/8))
0 commit comments