Headless AnkiConnect-compatible REST API server with AnkiWeb sync support and MCP server integration
4.4K
Headless AnkiConnect-compatible REST API server with AnkiWeb sync support and MCP server integration. Run your Anki collection on any server without the Anki desktop app.
docker run -d \
-p 8765:8765 \
-v /path/to/collection.anki2:/data/collection.anki2 \
-e ANKICONNECT_COLLECTION_PATH=/data/collection.anki2 \
-e [email protected] \
-e ANKICONNECT_ANKIWEB_PASS=your_password \
--name anki-connect-server \
glechic/anki-connect-server:latest
version: '3.8'
services:
anki-connect-server:
image: glechic/anki-connect-server:latest
container_name: anki-connect-server
ports:
- "8765:8765"
volumes:
- ./collection.anki2:/data/collection.anki2
environment:
- ANKICONNECT_COLLECTION_PATH=/data/collection.anki2
- ANKICONNECT_ANKIWEB_USER=${ANKIWEB_USER}
- ANKICONNECT_ANKIWEB_PASS=${ANKIWEB_PASS}
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8765/health"]
interval: 30s
timeout: 10s
retries: 3
| Variable | Required | Default | Description |
|---|---|---|---|
ANKICONNECT_COLLECTION_PATH | No | temp path | Path to your .anki2 collection file |
ANKICONNECT_PORT | No | 8765 | Server port |
ANKICONNECT_BIND | No | 0.0.0.0 | Bind address |
ANKICONNECT_ANKIWEB_USER | No | - | AnkiWeb username (for sync) |
ANKICONNECT_ANKIWEB_PASS | No | - | AnkiWeb password (for sync) |
ANKICONNECT_ANKIWEB_URL | No | - | Custom sync server URL |
curl -X POST http://localhost:8765/api \
-H "Content-Type: application/json" \
-d '{"action": "deckNames", "version": 6}'
curl -X POST http://localhost:8765/api \
-H "Content-Type: application/json" \
-d '{
"action": "addNote",
"version": 6,
"params": {
"note": {
"deckName": "Default",
"modelName": "Basic",
"fields": {"Front": "Hello", "Back": "World"}
}
}
}'
curl -X POST http://localhost:8765/api \
-H "Content-Type: application/json" \
-d '{"action": "sync", "version": 6}'
The container includes a health check endpoint:
curl http://localhost:8765/health
# Returns: {"status":"healthy"}
The image also includes MCP server support for AI assistants:
docker run -d \
-v /path/to/collection.anki2:/data/collection.anki2 \
-e ANKICONNECT_COLLECTION_PATH=/data/collection.anki2 \
glechic/anki-connect-server \
uv run anki-connect-server mcp
/data - Directory for Anki collection and media files
collection.anki2 file here⚠️ Important:
127.0.0.1 if only local access is neededgit clone https://github.com/glechic/anki-connect-server.git
cd anki-connect-server
docker build -t anki-connect-server .
Content type
Image
Digest
sha256:ded1d6df0…
Size
108.9 MB
Last updated
7 days ago
docker pull glechic/anki-connect-server