Skip to content

Commit b7c66a7

Browse files
anatoly314claude
andcommitted
fix: Support AnkiWeb installs with absolute imports
AnkiWeb uses the addon ID (e.g., "124672614") as the directory name, while .ankiaddon installs use "anki_mcp_server" from manifest.json. This broke all absolute imports when installed from AnkiWeb. Add sys.modules alias so "anki_mcp_server" resolves to the current package regardless of directory name. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a171b6c commit b7c66a7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

anki_mcp_server/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
import sys
33
from pathlib import Path
44

5+
# Ensure absolute imports work regardless of directory name.
6+
# AnkiWeb installs use the addon ID (e.g., "124672614") as directory name,
7+
# but .ankiaddon installs use "anki_mcp_server" from manifest.json.
8+
sys.modules.setdefault("anki_mcp_server", sys.modules[__name__])
9+
510
__version__ = "0.1.1"
611

712
# Packages we vendor that might conflict with other addons

0 commit comments

Comments
 (0)