anki-mcp-server 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- anki_mcp_server-0.2.0/.claude-plugin/marketplace.json +15 -0
- anki_mcp_server-0.2.0/.github/workflows/ci.yml +66 -0
- anki_mcp_server-0.2.0/.github/workflows/release.yml +60 -0
- anki_mcp_server-0.2.0/.gitignore +11 -0
- anki_mcp_server-0.2.0/CHANGELOG.md +23 -0
- anki_mcp_server-0.2.0/LICENSE +21 -0
- anki_mcp_server-0.2.0/PKG-INFO +306 -0
- anki_mcp_server-0.2.0/PRIVACY.md +40 -0
- anki_mcp_server-0.2.0/README.md +282 -0
- anki_mcp_server-0.2.0/SECURITY.md +18 -0
- anki_mcp_server-0.2.0/assets/icon.png +0 -0
- anki_mcp_server-0.2.0/install.ps1 +20 -0
- anki_mcp_server-0.2.0/install.sh +27 -0
- anki_mcp_server-0.2.0/plugins/anki-flashcards/.claude-plugin/plugin.json +18 -0
- anki_mcp_server-0.2.0/plugins/anki-flashcards/.mcp.json +8 -0
- anki_mcp_server-0.2.0/plugins/anki-flashcards/LICENSE +21 -0
- anki_mcp_server-0.2.0/plugins/anki-flashcards/README.md +48 -0
- anki_mcp_server-0.2.0/plugins/anki-flashcards/icon.png +0 -0
- anki_mcp_server-0.2.0/plugins/anki-flashcards/skills/anki-flashcards/SKILL.md +43 -0
- anki_mcp_server-0.2.0/pyproject.toml +43 -0
- anki_mcp_server-0.2.0/scripts/build_addon.py +27 -0
- anki_mcp_server-0.2.0/scripts/build_mcpb.py +133 -0
- anki_mcp_server-0.2.0/scripts/make_icon.py +62 -0
- anki_mcp_server-0.2.0/src/anki_mcp_server/__init__.py +3 -0
- anki_mcp_server-0.2.0/src/anki_mcp_server/__main__.py +3 -0
- anki_mcp_server-0.2.0/src/anki_mcp_server/anki.py +198 -0
- anki_mcp_server-0.2.0/src/anki_mcp_server/bridge_addon/anki_mcp_bridge/__init__.py +394 -0
- anki_mcp_server-0.2.0/src/anki_mcp_server/bridge_addon/anki_mcp_bridge/config.json +3 -0
- anki_mcp_server-0.2.0/src/anki_mcp_server/bridge_addon/anki_mcp_bridge/config.md +1 -0
- anki_mcp_server-0.2.0/src/anki_mcp_server/bridge_addon/anki_mcp_bridge/manifest.json +8 -0
- anki_mcp_server-0.2.0/src/anki_mcp_server/bridge_install.py +84 -0
- anki_mcp_server-0.2.0/src/anki_mcp_server/config.py +57 -0
- anki_mcp_server-0.2.0/src/anki_mcp_server/helpers.py +142 -0
- anki_mcp_server-0.2.0/src/anki_mcp_server/importing.py +119 -0
- anki_mcp_server-0.2.0/src/anki_mcp_server/server.py +866 -0
- anki_mcp_server-0.2.0/src/anki_mcp_server/setup_wizard.py +427 -0
- anki_mcp_server-0.2.0/src/anki_mcp_server/tts.py +40 -0
- anki_mcp_server-0.2.0/tests/__init__.py +0 -0
- anki_mcp_server-0.2.0/tests/mock_anki.py +213 -0
- anki_mcp_server-0.2.0/tests/test_server.py +333 -0
- anki_mcp_server-0.2.0/tests/test_setup.py +97 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "anki-mcp-server",
|
|
3
|
+
"description": "Anki flashcards for Claude: create, import, edit, organize and add audio to your Anki cards.",
|
|
4
|
+
"owner": {
|
|
5
|
+
"name": "MeisamHakimi",
|
|
6
|
+
"url": "https://github.com/MeisamHakimi"
|
|
7
|
+
},
|
|
8
|
+
"plugins": [
|
|
9
|
+
{
|
|
10
|
+
"name": "anki-flashcards",
|
|
11
|
+
"source": "./plugins/anki-flashcards",
|
|
12
|
+
"description": "Create, import, search, edit and organize Anki flashcards, add pronunciation audio, and sync to your phone."
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ${{ matrix.os }}
|
|
11
|
+
strategy:
|
|
12
|
+
fail-fast: false
|
|
13
|
+
matrix:
|
|
14
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
15
|
+
python-version: ["3.10", "3.12", "3.13"]
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: ${{ matrix.python-version }}
|
|
21
|
+
- run: python -m pip install -e ".[dev]"
|
|
22
|
+
- run: python -m pytest -q
|
|
23
|
+
- run: python scripts/build_addon.py
|
|
24
|
+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
|
|
25
|
+
- uses: actions/setup-node@v4
|
|
26
|
+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
|
|
27
|
+
with:
|
|
28
|
+
node-version: "20"
|
|
29
|
+
- name: Build and validate the Claude Desktop extension
|
|
30
|
+
run: python scripts/build_mcpb.py
|
|
31
|
+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
|
|
32
|
+
- uses: actions/upload-artifact@v4
|
|
33
|
+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
|
|
34
|
+
with:
|
|
35
|
+
name: anki_mcp_bridge.ankiaddon
|
|
36
|
+
path: dist/anki_mcp_bridge.ankiaddon
|
|
37
|
+
|
|
38
|
+
installer:
|
|
39
|
+
# Runs the one-line installers in dry-run mode against this checkout. Runners have no Anki, so the wizard must
|
|
40
|
+
# stop at step 1 with install instructions, which proves uv + package install + wizard start work on each OS.
|
|
41
|
+
runs-on: ${{ matrix.os }}
|
|
42
|
+
strategy:
|
|
43
|
+
fail-fast: false
|
|
44
|
+
matrix:
|
|
45
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
46
|
+
steps:
|
|
47
|
+
- uses: actions/checkout@v4
|
|
48
|
+
- name: install.sh --dry-run
|
|
49
|
+
if: runner.os != 'Windows'
|
|
50
|
+
shell: bash
|
|
51
|
+
run: |
|
|
52
|
+
export ANKI_MCP_SOURCE="anki-mcp-server @ file://$GITHUB_WORKSPACE"
|
|
53
|
+
sh install.sh --dry-run --yes > out.txt 2>&1 || true
|
|
54
|
+
cat out.txt
|
|
55
|
+
grep -q "setup (dry run" out.txt
|
|
56
|
+
grep -qE "apps.ankiweb.net|would run: brew install" out.txt
|
|
57
|
+
- name: install.ps1 --dry-run
|
|
58
|
+
if: runner.os == 'Windows'
|
|
59
|
+
shell: pwsh
|
|
60
|
+
run: |
|
|
61
|
+
$env:ANKI_MCP_SOURCE = "anki-mcp-server @ file:///$($env:GITHUB_WORKSPACE -replace '\\','/')"
|
|
62
|
+
./install.ps1 --dry-run --yes *> out.txt
|
|
63
|
+
Get-Content out.txt
|
|
64
|
+
if (-not (Select-String -Path out.txt -Pattern "setup \(dry run" -Quiet)) { exit 1 }
|
|
65
|
+
if (-not (Select-String -Path out.txt -Pattern "apps.ankiweb.net" -Quiet)) { exit 1 }
|
|
66
|
+
$global:LASTEXITCODE = 0
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
# Runs when a GitHub release is published (tag vX.Y.Z): publishes the package to PyPI with trusted publishing
|
|
4
|
+
# (no API token stored anywhere) and attaches the Claude Desktop extension and the bridge add-on to the release.
|
|
5
|
+
on:
|
|
6
|
+
release:
|
|
7
|
+
types: [published]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
permissions:
|
|
16
|
+
contents: write # attach files to the release
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
- uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.12"
|
|
22
|
+
- uses: actions/setup-node@v4
|
|
23
|
+
with:
|
|
24
|
+
node-version: "20"
|
|
25
|
+
- name: Check that the tag, package, plugin and launcher versions agree
|
|
26
|
+
run: |
|
|
27
|
+
v=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
|
|
28
|
+
test "v$v" = "$GITHUB_REF_NAME" || { echo "Tag $GITHUB_REF_NAME doesn't match version $v"; exit 1; }
|
|
29
|
+
grep -q "\"anki-mcp-server==$v\"" plugins/anki-flashcards/.mcp.json || { echo ".mcp.json isn't pinned to $v"; exit 1; }
|
|
30
|
+
grep -q "\"version\": \"$v\"" plugins/anki-flashcards/.claude-plugin/plugin.json || { echo "plugin.json version isn't $v"; exit 1; }
|
|
31
|
+
- run: python -m pip install build -e ".[dev]"
|
|
32
|
+
- run: python -m pytest -q
|
|
33
|
+
- run: python -m build
|
|
34
|
+
- run: python scripts/build_addon.py
|
|
35
|
+
- run: python scripts/build_mcpb.py
|
|
36
|
+
- name: Attach the desktop extension and the bridge add-on to the release
|
|
37
|
+
env:
|
|
38
|
+
GH_TOKEN: ${{ github.token }}
|
|
39
|
+
run: gh release upload "$GITHUB_REF_NAME" dist/anki-mcp-server.mcpb dist/anki_mcp_bridge.ankiaddon --clobber
|
|
40
|
+
- uses: actions/upload-artifact@v4
|
|
41
|
+
with:
|
|
42
|
+
name: python-dist
|
|
43
|
+
path: |
|
|
44
|
+
dist/*.whl
|
|
45
|
+
dist/*.tar.gz
|
|
46
|
+
|
|
47
|
+
pypi:
|
|
48
|
+
needs: build
|
|
49
|
+
runs-on: ubuntu-latest
|
|
50
|
+
environment:
|
|
51
|
+
name: pypi
|
|
52
|
+
url: https://pypi.org/project/anki-mcp-server/
|
|
53
|
+
permissions:
|
|
54
|
+
id-token: write # trusted publishing
|
|
55
|
+
steps:
|
|
56
|
+
- uses: actions/download-artifact@v4
|
|
57
|
+
with:
|
|
58
|
+
name: python-dist
|
|
59
|
+
path: dist
|
|
60
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.0 (2026-10-16)
|
|
4
|
+
|
|
5
|
+
- **Claude plugin** "Anki Flashcards (community)" in `plugins/anki-flashcards` (MCP server and a workflow skill), with a marketplace file so it can be added with `/plugin marketplace add MeisamHakimi/anki-mcp-server`
|
|
6
|
+
- **Claude Desktop extension** (`anki-mcp-server.mcpb`) for one-click installs; Claude Desktop manages Python itself. Settings for read-only mode and deleting
|
|
7
|
+
- Published on **PyPI** (`uvx anki-mcp-server`), released automatically by GitHub Actions with trusted publishing
|
|
8
|
+
- Every tool now has a `title`; the audio tool is marked as reaching an outside service
|
|
9
|
+
- `setup --skip-claude` for plugin users
|
|
10
|
+
- Privacy policy (`PRIVACY.md`), security policy (`SECURITY.md`) and an icon
|
|
11
|
+
|
|
12
|
+
## 0.1.0 (2026-10-07)
|
|
13
|
+
|
|
14
|
+
First release.
|
|
15
|
+
|
|
16
|
+
- Read: `anki_status`, `anki_find_notes`, `anki_list_tags`, `anki_open_browser`, `anki_tts_status`
|
|
17
|
+
- Add: `anki_create_deck`, `anki_add_notes`, `anki_import_file` (TSV/CSV, header/columns mapping, tag rules, Anki plain-text exports), `anki_sync`
|
|
18
|
+
- Audio: `anki_generate_audio` with built-in Google Translate voices (no add-on needed) or AwesomeTTS via the bridge add-on; only fills empty fields
|
|
19
|
+
- Change and delete with preview → confirm tokens and automatic backups: `anki_update_notes`, `anki_move_notes`, `anki_rename_deck` (works without the bridge), `anki_rename_profile`, `anki_delete_notes`, `anki_delete_deck`
|
|
20
|
+
- `anki_install_bridge` tool and `anki-mcp-server install-bridge` command to install the bundled bridge add-on
|
|
21
|
+
- One-line installers (`install.sh`, `install.ps1`) and an `anki-mcp-server setup` wizard: installs uv, checks Anki (offers Homebrew/Flatpak install), installs and verifies AnkiConnect from AnkiWeb, optionally installs the bridge, restarts Anki, and configures Claude Desktop / Claude Code with backups; `--dry-run` supported
|
|
22
|
+
- Installs from GitHub zip archives, so git isn't required
|
|
23
|
+
- Localhost-only Anki connections, allowlisted AnkiConnect actions, read-only and no-delete modes, auto-launch of Anki with clear setup hints when Anki or AnkiConnect is missing
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 MeisamHakimi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: anki-mcp-server
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: MCP server for Anki (via AnkiConnect): add, import, search, edit and organize notes and decks from Claude or any MCP client.
|
|
5
|
+
Project-URL: Homepage, https://github.com/MeisamHakimi/anki-mcp-server
|
|
6
|
+
Project-URL: Issues, https://github.com/MeisamHakimi/anki-mcp-server/issues
|
|
7
|
+
Author: MeisamHakimi
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: anki,ankiconnect,claude,flashcards,mcp,model-context-protocol,spaced-repetition
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Topic :: Education
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Requires-Dist: gtts>=2.5
|
|
19
|
+
Requires-Dist: httpx>=0.27
|
|
20
|
+
Requires-Dist: mcp<3,>=2.3
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# anki-mcp-server
|
|
26
|
+
|
|
27
|
+
An [MCP](https://modelcontextprotocol.io) server that lets Claude (or any MCP client) work with your **Anki** flashcards. It can create decks, add notes, import TSV/CSV files, search, edit, move, rename and delete, **add pronunciation audio**, and sync to AnkiWeb so changes reach AnkiDroid / AnkiMobile.
|
|
28
|
+
|
|
29
|
+
> "Create a deck Spanish::Verbs and add these 10 verbs with example sentences."
|
|
30
|
+
> "Import `~/Downloads/spanish.csv` into my Spanish deck. Do a dry run first."
|
|
31
|
+
> "Add Spanish pronunciation audio to the notes I added today, then sync."
|
|
32
|
+
> "Find every card tagged `verbs` that has no example sentence."
|
|
33
|
+
> "Move all notes tagged `grammar` into Spanish::Grammar."
|
|
34
|
+
|
|
35
|
+
It works on **macOS, Windows and Linux**, with Anki Desktop and the free [AnkiConnect](https://ankiweb.net/shared/info/2055492159) add-on.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Install
|
|
40
|
+
|
|
41
|
+
### 1. Install Anki Desktop (once)
|
|
42
|
+
|
|
43
|
+
Download it from **<https://apps.ankiweb.net>**, install it, and **open it once**: its first window asks for a language and creates your profile.
|
|
44
|
+
- **macOS:** open the `.dmg` and drag Anki to Applications. With Homebrew: `brew install --cask anki`.
|
|
45
|
+
- **Windows:** run the installer (`anki-…-windows.exe`).
|
|
46
|
+
- **Linux:** use the official package from the download page, or Flatpak: `flatpak install flathub net.ankiweb.Anki`.
|
|
47
|
+
|
|
48
|
+
Anki 23.10 or newer is required.
|
|
49
|
+
|
|
50
|
+
*Phone:* to get your cards on your phone, create a free [AnkiWeb](https://ankiweb.net) account, click **Sync** in Anki, and sign in to AnkiDroid (Android) or AnkiMobile (iPhone) with the same account.
|
|
51
|
+
|
|
52
|
+
### 2. Connect it to Claude: pick one
|
|
53
|
+
|
|
54
|
+
| You use | Easiest option |
|
|
55
|
+
|---|---|
|
|
56
|
+
| **Claude Desktop** (chat) | [A. Desktop extension](#a-claude-desktop-extension-one-click): one click, nothing else to install |
|
|
57
|
+
| **Claude Code** or **Cowork** | [B. Plugin](#b-claude-code--cowork-plugin) |
|
|
58
|
+
| Not sure, or you want everything set up for you | [C. One-line installer](#c-one-line-installer-sets-up-everything) |
|
|
59
|
+
|
|
60
|
+
Use only one of A and C for Claude Desktop; otherwise Claude sees the tools twice.
|
|
61
|
+
|
|
62
|
+
#### A. Claude Desktop extension (one click)
|
|
63
|
+
|
|
64
|
+
1. **AnkiConnect:** in Anki choose **Tools → Add-ons → Get Add-ons…**, enter **`2055492159`**, click OK, then **restart Anki**.
|
|
65
|
+
2. Download **[anki-mcp-server.mcpb](https://github.com/MeisamHakimi/anki-mcp-server/releases/latest/download/anki-mcp-server.mcpb)** from the latest release.
|
|
66
|
+
3. **Double-click** it, or in Claude Desktop go to **Settings → Extensions → Advanced settings → Install Extension…**, then click **Install**.
|
|
67
|
+
|
|
68
|
+
Claude Desktop takes care of Python and everything else. In the extension's settings you can turn on **read-only mode** or turn off deleting.
|
|
69
|
+
|
|
70
|
+
#### B. Claude Code / Cowork plugin
|
|
71
|
+
|
|
72
|
+
- **Claude Code:** run these two commands in a session:
|
|
73
|
+
|
|
74
|
+
```text
|
|
75
|
+
/plugin marketplace add MeisamHakimi/anki-mcp-server
|
|
76
|
+
/plugin install anki-flashcards@anki-mcp-server
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
- **Claude app (Cowork):** go to **Customize → Plugins → Add → Add marketplace**, enter `MeisamHakimi/anki-mcp-server`, then add **Anki Flashcards (community)**.
|
|
80
|
+
|
|
81
|
+
The plugin adds the server and a skill that teaches Claude good Anki habits: dry runs first, and your approval before any change. It needs [uv](https://docs.astral.sh/uv/getting-started/installation/) and AnkiConnect. After installing uv, run `uvx anki-mcp-server setup --skip-claude` to check Anki and install AnkiConnect. The server runs on your computer, so the plugin works in **Claude Code and in Cowork sessions on your computer**, not in regular claude.ai chat (use option A for that).
|
|
82
|
+
|
|
83
|
+
#### C. One-line installer (sets up everything)
|
|
84
|
+
|
|
85
|
+
**macOS / Linux** (Terminal):
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
curl -LsSf https://raw.githubusercontent.com/MeisamHakimi/anki-mcp-server/main/install.sh | sh
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Windows** (PowerShell):
|
|
92
|
+
|
|
93
|
+
```powershell
|
|
94
|
+
powershell -ExecutionPolicy ByPass -c "irm https://raw.githubusercontent.com/MeisamHakimi/anki-mcp-server/main/install.ps1 | iex"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
The installer:
|
|
98
|
+
1. installs [uv](https://docs.astral.sh/uv/) if it's missing. uv brings its own Python, so you don't need Python or git.
|
|
99
|
+
2. starts the setup wizard, which **asks before every change**:
|
|
100
|
+
- checks that Anki is installed (and offers to install it with Homebrew/Flatpak, or opens the download page),
|
|
101
|
+
- installs the **AnkiConnect** add-on from AnkiWeb (the same download Anki's *Get Add-ons* uses, verified before installing),
|
|
102
|
+
- optionally installs the **Anki MCP Bridge** add-on (recommended if you use AwesomeTTS),
|
|
103
|
+
- restarts Anki and checks the connection,
|
|
104
|
+
- adds the server to **Claude Desktop** (backing up your config; an existing `anki` entry is never replaced without asking) and to **Claude Code** if it's installed.
|
|
105
|
+
|
|
106
|
+
Add `--dry-run` to see what it would do without changing anything (`… | sh -s -- --dry-run`). To read the scripts first, see [install.sh](install.sh) and [install.ps1](install.ps1).
|
|
107
|
+
|
|
108
|
+
### 3. Try it
|
|
109
|
+
|
|
110
|
+
Restart Claude Desktop **completely** (⌘Q on Mac, File → Exit on Windows) after options A or C. Then say **"Check my Anki status."**
|
|
111
|
+
|
|
112
|
+
You don't need to open Anki first: if it isn't running, the server starts it in the background. Claude asks permission the first time it uses each tool.
|
|
113
|
+
|
|
114
|
+
### Manual setup
|
|
115
|
+
|
|
116
|
+
1. **AnkiConnect:** in Anki choose **Tools → Add-ons → Get Add-ons…**, enter **`2055492159`**, click OK, then restart Anki.
|
|
117
|
+
2. **uv:** run `curl -LsSf https://astral.sh/uv/install.sh | sh` (macOS/Linux) or `powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"` (Windows). Then find the **full path** of uvx with `which uvx` (macOS/Linux) or `where uvx` (Windows).
|
|
118
|
+
3. **Claude Desktop:** go to Settings → Developer → Edit Config, add the following inside the top-level `{ }`, save, and fully restart Claude. Use the full uvx path: desktop apps often can't see your terminal's PATH.
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
"mcpServers": {
|
|
122
|
+
"anki": {
|
|
123
|
+
"command": "/Users/<you>/.local/bin/uvx",
|
|
124
|
+
"args": ["anki-mcp-server"]
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
If `"mcpServers"` already exists, add just the `"anki": {…}` part inside it.
|
|
130
|
+
4. **Claude Code:**
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
claude mcp add anki --scope user -- uvx anki-mcp-server
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
5. **Other MCP clients:** run `uvx anki-mcp-server` (or `pip install anki-mcp-server`, then run `anki-mcp-server`) as a stdio server.
|
|
137
|
+
|
|
138
|
+
**macOS tip:** if Anki responds slowly while it's in the background, run this once and restart Anki:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
defaults write net.ankiweb.dtop NSAppSleepDisabled -bool true
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Updating
|
|
145
|
+
|
|
146
|
+
- **Desktop extension:** download the newer `.mcpb` from Releases and install it again.
|
|
147
|
+
- **Plugin:** updates arrive automatically from the marketplace.
|
|
148
|
+
- **Installer:** run it again, then restart Claude.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Pronunciation audio (text-to-speech)
|
|
153
|
+
|
|
154
|
+
Audio works **out of the box**:
|
|
155
|
+
|
|
156
|
+
> "Add audio of the Word field into the Audio field for deck:"English" notes."
|
|
157
|
+
> "Add Spanish audio (lang es) of the Front field into the Back field for notes added today."
|
|
158
|
+
|
|
159
|
+
- **Built-in engine (default):** free Google Translate voices in 60+ languages (`lang`: `en`, `es`, `fr`, `de`, `ja`, `zh-CN`, …) and English accents (`accent`: `com` US, `co.uk`, `com.au`, `ca`, `co.in`). No add-on or API key is needed. It needs internet, and the text being spoken is sent to Google.
|
|
160
|
+
- **AwesomeTTS:** if you use the [AwesomeTTS](https://ankiweb.net/shared/info/1436550454) add-on and install the bridge add-on (below), audio uses your AwesomeTTS voice and presets automatically.
|
|
161
|
+
- **Nothing is overwritten:** only notes whose audio field is empty get audio. Use `dry_run` to preview.
|
|
162
|
+
|
|
163
|
+
Audio is stored as `[sound:…]` in the field you choose. If your note type has no audio field, use an existing one (e.g. `Back`), or add a field in Anki via Tools → Manage Note Types → Fields.
|
|
164
|
+
|
|
165
|
+
## Optional: the Anki MCP Bridge add-on
|
|
166
|
+
|
|
167
|
+
Everything works without it. The bridge adds three things AnkiConnect can't do:
|
|
168
|
+
- Rename your **Anki profile** (e.g. "User 1" → your name)
|
|
169
|
+
- **Exact deck renames**, which keep the deck description and allow capitalization-only changes. Without the bridge, renames move the cards to a newly named deck, which keeps the cards, review history and options.
|
|
170
|
+
- Use your **AwesomeTTS** voice
|
|
171
|
+
|
|
172
|
+
**Install:** say yes when the installer offers it, or ask Claude *"Install the Anki MCP bridge"*. Then restart Anki.
|
|
173
|
+
|
|
174
|
+
It listens on `127.0.0.1:8766` only, refuses requests from web browsers, and never returns AwesomeTTS settings or API keys. AwesomeTTS support relies on AwesomeTTS internals (tested with 1.89.4), so an AwesomeTTS update could break only that feature.
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Safety
|
|
179
|
+
|
|
180
|
+
Your collection is personal data you've built over years, so this server is cautious by default:
|
|
181
|
+
|
|
182
|
+
- **Local connections only.** It uses the stdio transport (no network listener) and only talks to Anki on `127.0.0.1`; other URLs are rejected. The one exception is built-in TTS, which sends the spoken text to Google (see [Privacy Policy](#privacy-policy)).
|
|
183
|
+
- **Adding never overwrites.** Notes are added with `allowDuplicate=false`; duplicates are reported back as skipped. `dry_run` previews adds, imports and audio.
|
|
184
|
+
- **Changes and deletions are two-step.** A tool that edits, moves, renames or deletes first returns a **preview** and a `confirm_token`, without changing anything. The change only runs when the tool is called again with that token. The token is rejected if the arguments differ, if the notes changed since the preview, or if the server restarted. The server tells the model to get your explicit approval first.
|
|
185
|
+
- **Backups before every change** go to `~/.anki-mcp-server/backups/`: affected notes as JSON, and deleted decks as an `.apkg` with review history (restore it via Anki → File → Import). AnkiConnect edits bypass Anki's undo, so these backups are your undo. Anki's own automatic backups (File → Switch Profile → Open Backup) are another safety net.
|
|
186
|
+
- **Allowlisted actions.** Only the AnkiConnect actions this server needs are used. Note-type, template and deck-option editing are never exposed.
|
|
187
|
+
- **Modes.** `ANKI_MCP_READ_ONLY=1` exposes only read tools. `ANKI_MCP_ALLOW_DELETE=0` hides the delete tools.
|
|
188
|
+
- **Tool annotations.** Every tool is marked read-only or destructive, so MCP clients can ask for confirmation appropriately.
|
|
189
|
+
|
|
190
|
+
## Tools
|
|
191
|
+
|
|
192
|
+
| Tool | Kind | What it does |
|
|
193
|
+
|---|---|---|
|
|
194
|
+
| `anki_status` | read | AnkiConnect version, profile, decks, note types and their fields, available features |
|
|
195
|
+
| `anki_find_notes` | read | [Anki search syntax](https://docs.ankiweb.net/searching.html) → notes with fields, tags and decks |
|
|
196
|
+
| `anki_list_tags` | read | All tags |
|
|
197
|
+
| `anki_open_browser` | read | Opens Anki's Browse window filtered by a search |
|
|
198
|
+
| `anki_tts_status` | read | Available audio engines, languages and AwesomeTTS presets |
|
|
199
|
+
| `anki_create_deck` | add | Creates a deck (`Parent::Child` for subdecks); a no-op if it exists |
|
|
200
|
+
| `anki_add_notes` | add | Adds notes; duplicates skipped; `dry_run` |
|
|
201
|
+
| `anki_import_file` | add | Imports `.txt/.tsv/.csv`: header or `columns` mapping, a `tags` column, `tag_rules`, Anki plain-text exports, `dry_run` |
|
|
202
|
+
| `anki_generate_audio` | add | Text-to-speech into empty audio fields (Google built-in or AwesomeTTS) |
|
|
203
|
+
| `anki_sync` | add | Syncs with AnkiWeb |
|
|
204
|
+
| `anki_update_notes` | change | Edits fields and tags (preview → confirm, backup) |
|
|
205
|
+
| `anki_move_notes` | change | Moves notes to another deck (preview → confirm, backup) |
|
|
206
|
+
| `anki_rename_deck` | change | Renames a deck and its subdecks (preview → confirm) |
|
|
207
|
+
| `anki_rename_profile` | change | Renames the Anki profile (preview → confirm; bridge) |
|
|
208
|
+
| `anki_install_bridge` | change | Installs or updates the bridge add-on (preview → confirm) |
|
|
209
|
+
| `anki_delete_notes` | delete | Deletes notes (preview → confirm, JSON backup) |
|
|
210
|
+
| `anki_delete_deck` | delete | Deletes a deck and its cards (preview → confirm, `.apkg` + JSON backup) |
|
|
211
|
+
|
|
212
|
+
### Note types and field names
|
|
213
|
+
|
|
214
|
+
You can use friendly field names. Matching is case-insensitive, and a unique prefix works: `"example"` maps to a field called `Example sentence`. If you don't pass `model`, adds and imports use `ANKI_DEFAULT_MODEL`, else the note type most used in the target deck, else Anki's standard `Basic` (Front/Back).
|
|
215
|
+
|
|
216
|
+
### Importing files
|
|
217
|
+
|
|
218
|
+
```text
|
|
219
|
+
word meaning example
|
|
220
|
+
resilient able to recover quickly She is remarkably resilient.
|
|
221
|
+
GRAMMAR NOTE: present perfect have/has + past participle I have lived here for years.
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
> "Import `~/vocab.txt` into `English::Vocabulary`. Tag rows whose word starts with `GRAMMAR NOTE:` as `grammar` and everything else as `vocab`."
|
|
225
|
+
|
|
226
|
+
This becomes:
|
|
227
|
+
|
|
228
|
+
```json
|
|
229
|
+
{"path": "~/vocab.txt", "deck": "English::Vocabulary",
|
|
230
|
+
"tag_rules": [{"field": "Word", "starts_with": "GRAMMAR NOTE:", "tag": "grammar"}],
|
|
231
|
+
"default_tag": "vocab", "dry_run": true}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
- **Delimiter:** tab, comma, semicolon or pipe, auto-detected. Tab-separated files are read literally; other delimiters follow CSV quoting rules. Files must be UTF-8.
|
|
235
|
+
- **Columns:** taken from a header row if there is one (auto-detected when it matches field names), else from `columns`, else in the note type's field order. Use `""` to skip a column and `"tags"` for a space-separated tags column.
|
|
236
|
+
- **Anki exports:** "Notes in Plain Text" exports work, including their `#separator:` and `#columns:` lines.
|
|
237
|
+
- **Tag rules:** each rule needs `field`, `tag`, and one of `starts_with`, `contains` or `regex`. They're case-insensitive unless you set `"case_sensitive": true`.
|
|
238
|
+
|
|
239
|
+
## Configuration (optional)
|
|
240
|
+
|
|
241
|
+
Set these in the `env` block of your MCP config.
|
|
242
|
+
|
|
243
|
+
| Variable | Default | Meaning |
|
|
244
|
+
|---|---|---|
|
|
245
|
+
| `ANKI_CONNECT_URL` | `http://127.0.0.1:8765` | AnkiConnect address (must be localhost) |
|
|
246
|
+
| `ANKI_CONNECT_API_KEY` | – | Set this if you configured `apiKey` in AnkiConnect |
|
|
247
|
+
| `ANKI_MCP_BRIDGE_URL` | `http://127.0.0.1:8766` | Bridge add-on address (must be localhost) |
|
|
248
|
+
| `ANKI_AUTO_LAUNCH` | `1` | Start Anki if it isn't running |
|
|
249
|
+
| `ANKI_LAUNCH_COMMAND` | per OS | Custom command to start Anki, e.g. `flatpak run net.ankiweb.Anki` |
|
|
250
|
+
| `ANKI_BASE` | per OS | Anki's data folder, used to install the bridge (Anki: Tools → Add-ons → View Files, one level up) |
|
|
251
|
+
| `ANKI_MCP_BACKUP_DIR` | `~/.anki-mcp-server/backups` | Where backups go |
|
|
252
|
+
| `ANKI_DEFAULT_MODEL` | – | Default note type for adds/imports |
|
|
253
|
+
| `ANKI_MCP_READ_ONLY` | `0` | `1` = read tools only |
|
|
254
|
+
| `ANKI_MCP_ALLOW_DELETE` | `1` | `0` = hide the delete tools |
|
|
255
|
+
|
|
256
|
+
```json
|
|
257
|
+
"anki": {
|
|
258
|
+
"command": "/Users/<you>/.local/bin/uvx",
|
|
259
|
+
"args": ["anki-mcp-server"],
|
|
260
|
+
"env": { "ANKI_MCP_ALLOW_DELETE": "0" }
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## Troubleshooting
|
|
265
|
+
|
|
266
|
+
| Problem | Fix |
|
|
267
|
+
|---|---|
|
|
268
|
+
| Claude doesn't list the **anki** tools | Fully quit and reopen Claude. Run the installer again (it fixes the config), or check that the config uses the **full path** to `uvx`. Claude Desktop → Settings → Developer shows the server's error. |
|
|
269
|
+
| "Can't connect to AnkiConnect" | Run the installer again, or install AnkiConnect manually and restart Anki. To check, run `curl -s localhost:8765 -X POST -d '{"action":"version","version":6}'`; it should print `{"result": 6, ...}`. |
|
|
270
|
+
| "Anki isn't installed / couldn't be found" | Install Anki (step 1) and open it once. For a non-standard install, set `ANKI_LAUNCH_COMMAND`. |
|
|
271
|
+
| "Started Anki, but AnkiConnect didn't answer" | Anki is waiting at the profile picker or a dialog; check its window. Otherwise AnkiConnect isn't installed. |
|
|
272
|
+
| Slow or timing out on macOS | Run the App Nap command from *Manual setup*, then restart Anki. |
|
|
273
|
+
| Audio fails | Built-in audio needs internet. If several requests fail, Google may be rate-limiting; try again later or with a smaller `limit`. |
|
|
274
|
+
| An edit shows `not_applied` | The note was open in Anki's editor or Browse window. Close it and retry. |
|
|
275
|
+
| "needs the Anki MCP Bridge add-on" | Ask Claude to install the bridge, then restart Anki. |
|
|
276
|
+
| Restoring something | Decks: import the `.apkg` from the backup folder (File → Import). Notes: the JSON backups contain every field and tag. Whole collection: Anki's File → Switch Profile → Open Backup. |
|
|
277
|
+
|
|
278
|
+
## Development
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
git clone https://github.com/MeisamHakimi/anki-mcp-server && cd anki-mcp-server
|
|
282
|
+
python -m venv .venv && .venv/bin/pip install -e ".[dev]"
|
|
283
|
+
.venv/bin/pytest # tests use fake AnkiConnect and bridge servers; Anki isn't needed
|
|
284
|
+
python scripts/build_addon.py # builds dist/anki_mcp_bridge.ankiaddon
|
|
285
|
+
python scripts/build_mcpb.py # builds dist/anki-mcp-server.mcpb (needs Node.js)
|
|
286
|
+
claude plugin validate ./plugins/anki-flashcards # checks the Claude plugin
|
|
287
|
+
.venv/bin/anki-mcp-server setup --dry-run # try the setup wizard without changing anything
|
|
288
|
+
npx @modelcontextprotocol/inspector .venv/bin/anki-mcp-server # try the tools interactively
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
## Privacy Policy
|
|
292
|
+
|
|
293
|
+
anki-mcp-server runs entirely on your computer. The author collects no data and runs no servers, and there is no telemetry.
|
|
294
|
+
- **Your notes** are read and changed locally through Anki/AnkiConnect on `127.0.0.1`. Tool results go to the AI app you use (e.g. Claude) under that app's privacy policy.
|
|
295
|
+
- **Third parties, only when you use these features:**
|
|
296
|
+
- **Google** receives the text being spoken by the built-in text-to-speech.
|
|
297
|
+
- **AnkiWeb** receives your collection when you sync, through Anki itself.
|
|
298
|
+
- **AnkiWeb, PyPI, GitHub and astral.sh** serve the downloads during installation; these requests contain no personal data.
|
|
299
|
+
- **Retention:** backups stay in `~/.anki-mcp-server/backups/` on your computer until you delete them. Nothing is kept by the author.
|
|
300
|
+
- **Contact:** [GitHub issues](https://github.com/MeisamHakimi/anki-mcp-server/issues), or private reports through [security advisories](https://github.com/MeisamHakimi/anki-mcp-server/security/advisories/new).
|
|
301
|
+
|
|
302
|
+
Full policy: [PRIVACY.md](PRIVACY.md). Security policy: [SECURITY.md](SECURITY.md).
|
|
303
|
+
|
|
304
|
+
## License
|
|
305
|
+
|
|
306
|
+
MIT. This is an unofficial community project, not affiliated with or endorsed by Anki/Ankitects, AnkiConnect, AwesomeTTS, Google or Anthropic.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Privacy Policy
|
|
2
|
+
|
|
3
|
+
*Last updated: 2026-10-16. Applies to anki-mcp-server, its Claude plugin ("Anki Flashcards"), its Claude Desktop extension, and the Anki MCP Bridge add-on.*
|
|
4
|
+
|
|
5
|
+
anki-mcp-server is free, open-source software that runs **on your own computer**. The author does not operate any server for it and does not collect, receive, store or sell any of your data. There is no analytics, telemetry or tracking.
|
|
6
|
+
|
|
7
|
+
## What data it handles and where it goes
|
|
8
|
+
|
|
9
|
+
| Data | Where it goes | When |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| Your Anki notes, decks, tags and profile name | Read and changed **locally** through Anki and the AnkiConnect add-on on `127.0.0.1`. Tool results are returned to the AI app you use (e.g. Claude), which processes them under **that** app's privacy policy (for Claude: <https://www.anthropic.com/legal/privacy>) | Whenever you or the AI use a tool |
|
|
12
|
+
| Text you turn into audio with the **built-in** text-to-speech engine | Sent to **Google's** Translate text-to-speech service to create the MP3 file ([Google Privacy Policy](https://policies.google.com/privacy)) | Only when `anki_generate_audio` runs with the `google` engine (the default when AwesomeTTS isn't installed) |
|
|
13
|
+
| Text you turn into audio with **AwesomeTTS** | Handled by the AwesomeTTS add-on and the voice service *you* configured in it | Only when `anki_generate_audio` uses the `awesometts` engine |
|
|
14
|
+
| Your whole collection, when you sync | Sent by Anki itself to **AnkiWeb** ([AnkiWeb privacy](https://ankiweb.net/account/privacy)) | Only when `anki_sync` runs or you sync in Anki |
|
|
15
|
+
| Nothing personal: software downloads | The installer and setup download uv (astral.sh), this package (PyPI / GitHub) and, if you agree, the AnkiConnect add-on (ankiweb.net). These requests contain no personal data | Only during installation / setup |
|
|
16
|
+
|
|
17
|
+
## Storage and retention
|
|
18
|
+
|
|
19
|
+
- **Backups:** before editing, moving, renaming or deleting, the affected notes are saved as JSON (and deleted decks as `.apkg`) in `~/.anki-mcp-server/backups/` (or `ANKI_MCP_BACKUP_DIR`). They stay on your computer until **you** delete them.
|
|
20
|
+
- **Audio files** are stored in your Anki collection's media folder like any other Anki media.
|
|
21
|
+
- **Configuration:** setup writes the server entry into your Claude Desktop configuration (after asking, with a backup) and installs add-ons into Anki's add-ons folder.
|
|
22
|
+
- Nothing else is stored, and nothing is kept by the author.
|
|
23
|
+
|
|
24
|
+
## Third-party sharing
|
|
25
|
+
|
|
26
|
+
The author shares no data with anyone. Data only reaches the third parties listed above (Google, AnkiWeb, your AI app, your AwesomeTTS voice service), and only through the actions described there.
|
|
27
|
+
|
|
28
|
+
## Your choices
|
|
29
|
+
|
|
30
|
+
- Use `ANKI_MCP_READ_ONLY=1` (read-only) or `ANKI_MCP_ALLOW_DELETE=0` (no delete tools).
|
|
31
|
+
- Avoid sending text to Google by using AwesomeTTS with a local voice, or by not using the audio tool.
|
|
32
|
+
- Uninstall at any time: remove the server from your Claude configuration, delete `~/.anki-mcp-server/`, and remove the add-ons in Anki (Tools → Add-ons).
|
|
33
|
+
|
|
34
|
+
## Children
|
|
35
|
+
|
|
36
|
+
The software is not directed at children under 13 and collects no personal information from anyone.
|
|
37
|
+
|
|
38
|
+
## Changes and contact
|
|
39
|
+
|
|
40
|
+
Changes to this policy are published in this file with a new date. Questions or requests: open an issue at <https://github.com/MeisamHakimi/anki-mcp-server/issues>, or report privately via <https://github.com/MeisamHakimi/anki-mcp-server/security/advisories/new>.
|