anki-mcp
Enables safe, review-first Anki authoring with tools to inspect structure, create note types, add notes, preview renderings, and manage cards via AnkiConnect.
README
anki-mcp
MCP server for safe, review-first Anki authoring built on official Anki concepts: profile, deck, note type, note, card, tag, and media.
It is designed for agents that need to inspect existing Anki structure, create or revise note types, add notes, preview the real Anki rendering, and only then release cards into study.
The package was renamed from anki-mcps to @yama662607/anki-mcp. The CLI command is now anki-mcp.
Why this exists
- avoid custom abstractions on top of Anki's own data model
- keep note creation review-first by suspending new cards until they are accepted
- let agents learn from existing decks and note types before writing new content
- keep note type changes additive-safe and validate them before apply
Features
- deck and note discovery for example-driven authoring
- additive-safe note type authoring with
dryRun=trueby default - lightweight note type linting with structured
errorsandwarningsbefore apply - direct note creation with
modelName,deckName,fields, andtags - review-first isolation by suspending new cards until the user keeps them
- optimistic conflict detection for
update_note - batch add/delete note operations with stable per-item outcomes
- local media import for audio and image fields
- frozen v1 contract resource at
anki://contracts/v1/tools
Requirements
- Node.js 22+
- Anki with AnkiConnect enabled
- optional: the
anki-connect-extensionadd-on for read-only native preview instead of edit-dialog fallback
Quick start
- Install
@yama662607/anki-mcpfrom npm. - Start Anki with AnkiConnect enabled.
- Add the MCP server to your client.
- Ask the agent to run
get_runtime_statusfirst. - Use the review-first flow:
add_note->open_note_preview->update_noteorset_note_cards_suspended(false).
For a first-time setup guide, see 5-minute quick start.
Dependency model
AnkiConnectis required for real Anki usageanki-connect-extensionis optional and provides a read-only native preview path- without the extension,
open_note_previewfalls back to opening the edit dialog - in
ANKI_GATEWAY_MODE=memory, neither dependency is required because the server is running in test mode
Installation
From npm
npm install -g @yama662607/anki-mcp
From source
npm install
npm run build
Running
As a local command
anki-mcp
From source
npm run dev
MCP client setup
Codex
Official Codex setup is codex mcp add or ~/.codex/config.toml.
Add the server with the CLI:
codex mcp add anki-mcp \
--env ANKI_CONNECT_URL=http://127.0.0.1:8765 \
--env ANKI_ACTIVE_PROFILE=default \
-- anki-mcp
Equivalent ~/.codex/config.toml entry:
[mcp_servers.anki-mcp]
command = "anki-mcp"
[mcp_servers.anki-mcp.env]
ANKI_ACTIVE_PROFILE = "default"
ANKI_CONNECT_URL = "http://127.0.0.1:8765"
Claude-style clients
Some MCP clients use mcpServers JSON instead.
{
"mcpServers": {
"anki-mcp": {
"command": "anki-mcp",
"env": {
"ANKI_CONNECT_URL": "http://127.0.0.1:8765",
"ANKI_ACTIVE_PROFILE": "default"
}
}
}
}
Environment
ANKI_CONNECT_URLdefault:http://127.0.0.1:8765ANKI_ACTIVE_PROFILEoptional fallback for read toolsANKI_MCP_DB_PATHdefault: user state directory (~/Library/Application Support/anki-mcp/anki-mcp.sqliteon macOS,%LOCALAPPDATA%\anki-mcp\anki-mcp.sqliteon Windows,$XDG_STATE_HOME/anki-mcp/anki-mcp.sqliteor~/.local/state/anki-mcp/anki-mcp.sqliteon Linux)ANKI_GATEWAY_MODE=memoryfor deterministic local tests without Anki
ANKI_MCP_DB_PATH is the internal SQLite path used for idempotency and operational metadata. DRAFT_DB_PATH is still accepted as a backward-compatible fallback.
Core workflow
- Verify setup with
get_runtime_status. - Discover existing structure with
list_decks,list_note_types,get_note_type_schema,search_notes, andget_notes. - Create missing decks with
ensure_deck. - Create or revise note types with
upsert_note_type(dryRun=true)and inspectresult.validation. - Add review-pending content with
add_noteoradd_notes_batch. - Inspect the real Anki rendering with
open_note_preview(the extension path uses a read-only native previewer, not a live editor dialog). - After user feedback, call
update_note,delete_note, orset_note_cards_suspended(suspended=false).
Media workflow
import_media_asset- Insert returned
asset.fieldValueinto the target note field add_noteorupdate_noteopen_note_preview
Main docs
- 5-minute quick start
- Operating model
- Contracts and tool surface
- Note type authoring
- Real Anki E2E
- Migration from pack/card-type APIs
- Public release checklist
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.