Anki MCP

v0.1.2
io.github.Ryhus/anki-mcp Checked 1 day ago Published 10 days ago

Manage local Anki notes, cards, decks, note types, media, and deck packages via AnkiConnect.

Values you need

VariableWhat it is
ANKI_URLrequired AnkiConnect base URL on your computer. Keep Anki Desktop open; omit /api/v1. Default: http://127.0.0.1:8765
ANKI_API_MODEoptional Use v1 for the full tool set with compatible AnkiConnect, or legacy for older add-ons. Default: v1
ANKI_REQUEST_TIMEOUT_MSoptional Request deadline in integer milliseconds, including queue wait: 1 to 300000. Default: 30000
ANKI_MEDIA_IMPORT_DIRSoptional Optional trusted local media folders. Separate with : on macOS/Linux or ; on Windows.
ANKI_PACKAGE_IMPORT_DIRoptional Optional existing absolute folder for local .apkg imports. Requires API v1.
ANKI_PACKAGE_EXPORT_DIRoptional Optional existing absolute folder for local .apkg exports. Requires API v1.

npm (npx) discovery passed

Requires Node.js 18+

Run in a terminal
claude mcp add anki-mcp -e ANKI_URL=http://127.0.0.1:8765 -- npx -y @ryhus/anki-mcp@0.1.2
Add to claude_desktop_config.json
{
  "mcpServers": {
    "anki-mcp": {
      "args": [
        "-y",
        "@ryhus/anki-mcp@0.1.2"
      ],
      "command": "npx",
      "env": {
        "ANKI_URL": "http://127.0.0.1:8765"
      }
    }
  }
}
Add to ~/.cursor/mcp.json
{
  "mcpServers": {
    "anki-mcp": {
      "args": [
        "-y",
        "@ryhus/anki-mcp@0.1.2"
      ],
      "command": "npx",
      "env": {
        "ANKI_URL": "http://127.0.0.1:8765"
      }
    }
  }
}
Add to .vscode/mcp.json
{
  "inputs": [
    {
      "description": "ANKI_URL",
      "id": "anki-url",
      "password": true,
      "type": "promptString"
    }
  ],
  "servers": {
    "anki-mcp": {
      "args": [
        "-y",
        "@ryhus/anki-mcp@0.1.2"
      ],
      "command": "npx",
      "env": {
        "ANKI_URL": "${input:anki-url}"
      },
      "type": "stdio"
    }
  }
}
Add to ~/.codex/config.toml
[mcp_servers.anki-mcp]
command = "npx"
args = ["-y", "@ryhus/anki-mcp@0.1.2"]
env = { "ANKI_URL" = "http://127.0.0.1:8765" }

For AI agents

  1. Ask the user for: ANKI_URL. Never invent or guess these values; secrets go into the client config, not into chat logs.
  2. Pick the user's MCP client and apply the matching config from the first install method (it is the one verified by the smoke test when available).
  3. Restart or reload the client so it starts the server.
  4. Verify: the server should expose these tools: list-decks, create-deck, rename-deck, list-deck-presets, get-deck-preset, create-deck-preset, update-deck-preset, assign-deck-preset, ….
  5. If it fails, check that the required runtime is installed (Node.js 18+) and that the values above are set.

Machine-readable: install.md · manifest.json