anki-sync-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@anki-sync-mcpAdd a card to my 'Spanish' deck: front 'hola', back 'hello'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
anki-sync-mcp
A headless, sync-native Anki MCP sidecar for always-on AI agents.
anki-sync-mcp lets an MCP client safely manage a real Anki collection without Anki
Desktop or AnkiConnect. It runs as an authenticated Streamable HTTP service, uses Anki's
collection and sync APIs, and synchronizes with AnkiWeb or a self-hosted Anki sync server.
Unlike desktop bridges, it is designed to run unattended in Docker. Writes are serialized, idempotent, persisted across restarts, and synchronized before and after mutation. Destructive and schema-changing tools are disabled by default and use preview tokens plus verified backups when enabled.
It supports decks, notes, cards, tags, note types, templates, media, scheduling controls, review history and analytics, backups, and explicit full-sync recovery.
Quick start with Docker Compose
Requirements: Docker Compose, Python 3 for token generation, and an AnkiWeb or self-hosted sync account.
git clone https://github.com/raslab/anki-sync-mcp.git
cd anki-sync-mcp
mkdir -p secrets
python -c 'import secrets; print(secrets.token_urlsafe(32))' > secrets/anki_mcp_token
read -rsp "Anki sync password: " ANKI_PASSWORD
printf '%s' "$ANKI_PASSWORD" > secrets/anki_sync_password
unset ANKI_PASSWORD
chmod 600 secrets/*
export ANKI_SYNC_USERNAME="your-sync-username"
export ANKI_SYNC_HOST="" # empty for AnkiWeb; otherwise an HTTPS sync-server URL
docker compose up -d --build
docker compose exec anki-mcp anki-mcp-healthcheckThe included Compose configuration exposes MCP only to containers on its private assistant
network. Connect your agent container to that network and configure:
URL:
http://anki-mcp:8000/mcpHeader:
Authorization: Bearer <contents of secrets/anki_mcp_token>
For a client running directly on the host, add this to the anki-mcp service in
compose.yaml, then run docker compose up -d again:
ports:
- "127.0.0.1:8000:8000"Use http://127.0.0.1:8000/mcp as the MCP URL. After connecting, call
anki_sync_login once. The resulting sync host key is stored in the persistent Docker volume,
so you can later remove ANKI_SYNC_PASSWORD_FILE from compose.yaml and delete the password
secret when automatic reauthentication is not required.
Do not run two sidecars, Anki Desktop, or any other process against the same collection file. Keep destructive, schema, and full-sync feature flags disabled except during deliberate maintenance.
Configuration
Configuration is read from environment variables when the service starts. compose.yaml
supplies safe defaults and mounts the authentication token and initial sync password as Docker
secrets. Variables written as ${NAME:-default} can be overridden through the shell or a
Compose .env file. To change a fixed value, or use one of the settings not present in the
Compose file, add it under services.anki-mcp.environment.
Server and access
Variable | Default | Description |
|
| Address on which the HTTP server listens. |
|
| HTTP listen port ( |
|
| MCP endpoint path. It must be an absolute, static, non-root path and must not overlap |
| required alternative | Bearer token supplied directly. Use exactly one of this setting and |
| required alternative | Path to a file containing the bearer token. One trailing newline is ignored. Compose mounts |
|
| Comma-separated tool groups to register. Allowed values are |
|
| Comma-separated HTTP |
|
| Comma-separated browser origins accepted by MCP transport security. Add explicit trusted origins when using a browser-based client. |
|
| Uvicorn log level, such as |
The /health/live and /health/ready endpoints are not bearer-authenticated. The supplied
Compose network keeps them private unless you publish the container port.
Collection and synchronization
Variable | Default | Description |
|
| Local Anki collection file. Compose persists its parent directory in the |
| empty | AnkiWeb username or self-hosted sync username. Required for |
| optional alternative | Sync password supplied directly. It is optional after authentication has been persisted; do not set it together with |
| optional alternative | Path to the sync-password file. Compose mounts |
| empty (AnkiWeb) | Custom sync-server HTTP(S) base URL. Non-loopback servers require HTTPS; credentials, query strings, and fragments are rejected. |
|
| Synchronize before coordinated reads. Individual read tools can still request a sync with |
|
| Synchronize before and after coordinated mutations. Disabling this permits local changes to remain unsynchronized. |
|
| Maximum wait for media synchronization ( |
|
| Startup behavior: |
The persisted anki_data volume also contains synchronization authentication state, mutation
receipts, and backups. Preserve the volume across container recreation.
Safety and resource limits
Variable | Default | Description |
|
| Registers delete and FSRS rescheduling preview/apply tools when |
|
| Registers explicit full-download and full-upload recovery tools. It must also be enabled for schema-changing tools. |
|
| Registers note-type and template mutation tools when |
|
| Registers the administrative card-answering tool, which changes scheduling state. |
|
| Lifetime of destructive-operation preview tokens ( |
|
| Maximum notes accepted by one atomic batch-create operation ( |
|
| Maximum |
|
| Maximum collection items that bounded list/search and tag operations may scan ( |
|
| UTF-8 byte limit for each rendered text field in responses ( |
|
| Maximum fields or templates returned for a note or note type ( |
|
| Maximum decoded size of a media file read, written, or renamed ( |
|
| Maximum serialized tool-result size ( |
|
| Maximum MCP request-body size ( |
Boolean values accept the forms supported by Pydantic settings, including true/false,
1/0, and yes/no. Invalid or unknown configuration causes startup to fail instead of
silently falling back to a default.
Development
Requires Python 3.12 and uv.
uv sync --frozen --all-groups
uv run pytest
uv run ruff check .
uv run pyrightLicense
MIT — free to use, modify, and distribute under the license terms.
Trademark disclaimer
This is an independent, unofficial project. It is not affiliated with, endorsed by, or sponsored by Anki, AnkiWeb, Ankitects Pty Ltd, or their maintainers. Anki and AnkiWeb are trademarks of their respective owners.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/raslab/anki-sync-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server